using BO.BO.Bill; 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 QualityAndOrder { public partial class HurryRecordView : Form { bool changed = false; List mRecords; public HurryRecordView(long fromOrderID) { InitializeComponent(); recordGridView.AutoGenerateColumns = false; mRecords = OrderDetailRpc.GetHurryRecordList(fromOrderID).OrderBy(x => x.ID).ToList(); recordGridView.DataSource = null; recordGridView.DataSource = mRecords; recordGridView.Refresh(); } private void closeBtn_Click(object sender, EventArgs e) { if (changed) DialogResult = DialogResult.OK; this.Close(); } private void recordGridView_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) return; if (e.ColumnIndex <= recordGridView.ColumnCount - 2) return; var entity = recordGridView.CurrentRow.DataBoundItem as HurryRecord; if (e.ColumnIndex == recordGridView.ColumnCount - 2) { OrderDetailRpc.DeleteHurryRecord(entity.ID); _result += entity.HurryNumber; mRecords.Remove(entity); if (!changed) changed = true; recordGridView.DataSource = null; if (mRecords.Any()) recordGridView.DataSource = mRecords; recordGridView.Refresh(); } else { HurryRecordPrint.Print(entity); } } private int _result = 0; public int Result { get { return _result; } } } }