屠宰场客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.4 KiB

using BO.BO;
using BO.Utils.BillRpc;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ButcherWeight
{
public partial class RecordView : Form
{
bool changed = false;
List<WeightDetail> mRecords;
public RecordView(List<WeightDetail> records)
{
InitializeComponent();
detailGridView.AutoGenerateColumns = false;
mRecords = records;
BindGrid();
}
void BindGrid()
{
detailGridView.DataSource = null;
if (mRecords.Any())
detailGridView.DataSource = mRecords.Where(x => !x.Delete).ToList();
detailGridView.Refresh();
}
private void closeBtn_Click(object sender, EventArgs e)
{
if (changed)
DialogResult = DialogResult.OK;
this.Close();
}
private void detailGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
return;
if (e.ColumnIndex != detailGridView.ColumnCount - 1)
return;
var entity = detailGridView.CurrentRow.DataBoundItem as WeightDetail;
if (entity.ID == 0)
mRecords.Remove(entity);
else
entity.Delete = true;
if (!changed)
changed = true;
BindGrid();
}
}
}