private void simpleButton1_Click(object sender, EventArgs e) { if (this.bindingSourceProduceStatisticsCheckDetail.Current != null) { this._ProduceStatisticsCheck.Details.Remove(this.bindingSourceProduceStatisticsCheckDetail.Current as Book.Model.ProduceStatisticsCheckDetail); if (this._ProduceStatisticsCheck.Details.Count == 0) { Model.ProduceStatisticsCheckDetail detail = new Book.Model.ProduceStatisticsCheckDetail(); detail.ProduceStatisticsCheckDetailId = Guid.NewGuid().ToString(); detail.DetailDate = DateTime.Now; detail.ProduceQuantity = 0; detail.APian = 0; detail.BPian = 0; detail.CPian = 0; detail.FractionDefective = 0; detail.Employee0Id = BL.V.ActiveOperator.EmployeeId; this._ProduceStatisticsCheck.Details.Add(detail); this.bindingSourceProduceStatisticsCheckDetail.Position = this.bindingSourceProduceStatisticsCheckDetail.IndexOf(detail); this.gridControl1.RefreshDataSource(); } this.gridControl1.RefreshDataSource(); } }
private void gridView1_KeyDown(object sender, KeyEventArgs e) { if (this.action == "insert" || this.action == "update") { if (e.KeyData == Keys.Enter) { Model.ProduceStatisticsCheckDetail detail = new Book.Model.ProduceStatisticsCheckDetail(); detail.ProduceStatisticsCheckDetailId = Guid.NewGuid().ToString(); detail.DetailDate = DateTime.Now; detail.ProduceQuantity = 0; detail.APian = 0; detail.BPian = 0; detail.CPian = 0; detail.FractionDefective = 0; detail.Employee0Id = BL.V.ActiveOperator.EmployeeId; this._ProduceStatisticsCheck.Details.Add(detail); this.bindingSourceProduceStatisticsCheckDetail.Position = this.bindingSourceProduceStatisticsCheckDetail.IndexOf(detail); } this.gridControl1.RefreshDataSource(); } }
protected override void AddNew() { this._ProduceStatisticsCheck = new Model.ProduceStatisticsCheck(); this._ProduceStatisticsCheck.ProduceStatisticsCheckId = this.ProduceStatisticsCheckManager.GetId(); this._ProduceStatisticsCheck.ProduceStatisticsCheckDate = DateTime.Now; this._ProduceStatisticsCheck.Details = new List <Model.ProduceStatisticsCheckDetail>(); // if (this.action == "insert") { Model.ProduceStatisticsCheckDetail detail = new Book.Model.ProduceStatisticsCheckDetail(); detail.ProduceStatisticsCheckDetailId = Guid.NewGuid().ToString(); detail.DetailDate = DateTime.Now; detail.ProduceQuantity = 0; detail.APian = 0; detail.BPian = 0; detail.CPian = 0; detail.FractionDefective = 0; detail.Employee0Id = BL.V.ActiveOperator.EmployeeId; this._ProduceStatisticsCheck.Details.Add(detail); } }