private void gridView1_KeyDown(object sender, KeyEventArgs e) { if (this.action == "insert" || this.action == "update") { // if (this.CanAdd(this.produceStatistics.Details)) { if (e.KeyData == Keys.Enter) { Model.ProduceStatisticsDetail detail = new Book.Model.ProduceStatisticsDetail(); detail.ProduceStatisticsDetailId = Guid.NewGuid().ToString(); detail.DetailDate = DateTime.Now; //cate.Description = string.Empty; detail.PronoteHeaderID = this._pronoteHeaderID; detail.ProceduresId = this._proceduresId; detail.ProduceQuantity = 0; detail.HeGeQuantity = 0; detail.Employee0Id = BL.V.ActiveOperator.EmployeeId; this._Details.Add(detail); this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); } } //if (e.KeyData == Keys.Delete) //{ // // this.simpleButtonRemove.PerformClick(); //} this.gridControl1.RefreshDataSource(); } }
private void gridView1_KeyDown(object sender, KeyEventArgs e) { if (this.action == "insert" || this.action == "update") { if (e.KeyData == Keys.Enter) { Model.ProduceStatisticsDetail detail = new Book.Model.ProduceStatisticsDetail(); detail.ProduceStatisticsDetailId = Guid.NewGuid().ToString(); detail.DetailDate = DateTime.Now; detail.ProduceQuantity = 0; detail.HeGeQuantity = 0; detail.Employee0Id = BL.V.ActiveOperator.EmployeeId; this.produceStatistics.Details.Add(detail); this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); } this.gridControl1.RefreshDataSource(); } }
protected override void AddNew() { this.produceStatistics = new Model.ProduceStatistics(); this.produceStatistics.ProduceStatisticsId = this.produceStatisticsManager.GetId(); this.produceStatistics.ProduceStatisticsDate = DateTime.Now; this.produceStatistics.Details = new List <Model.ProduceStatisticsDetail>(); if (this.action == "insert") { Model.ProduceStatisticsDetail detail = new Book.Model.ProduceStatisticsDetail(); detail.ProduceStatisticsDetailId = Guid.NewGuid().ToString(); detail.DetailDate = DateTime.Now; detail.ProduceQuantity = 0; detail.HeGeQuantity = 0; detail.Employee0Id = BL.V.ActiveOperator.EmployeeId; this.produceStatistics.Details.Add(detail); } }
private void simpleButton1_Click(object sender, EventArgs e) { if (this.bindingSourceDetails.Current != null) { this.produceStatistics.Details.Remove(this.bindingSourceDetails.Current as Book.Model.ProduceStatisticsDetail); if (this.produceStatistics.Details.Count == 0) { Model.ProduceStatisticsDetail detail = new Book.Model.ProduceStatisticsDetail(); detail.ProduceStatisticsDetailId = Guid.NewGuid().ToString(); detail.DetailDate = DateTime.Now; detail.ProduceQuantity = 0; detail.HeGeQuantity = 0; detail.Employee0Id = BL.V.ActiveOperator.EmployeeId; this.produceStatistics.Details.Add(detail); this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); this.gridControl1.RefreshDataSource(); } this.gridControl1.RefreshDataSource(); } }
public override void Refresh() { this._Details = this.produceStatisticsDetailManager.SelectbyPronoteHeaderProcedures(this._pronoteHeaderID, this._proceduresId); this.bindingSourceDetails.DataSource = this._Details; if (this.action == "insert") { Model.ProduceStatisticsDetail detail = new Book.Model.ProduceStatisticsDetail(); detail.ProduceStatisticsDetailId = Guid.NewGuid().ToString(); detail.DetailDate = DateTime.Now; //cate.Description = string.Empty; detail.PronoteHeaderID = this._pronoteHeaderID; detail.ProceduresId = this._proceduresId; detail.ProduceQuantity = 0; detail.HeGeQuantity = 0; detail.Employee0Id = BL.V.ActiveOperator.EmployeeId; this._Details.Add(detail); this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); this.gridControl1.RefreshDataSource(); } switch (this.action) { case "insert": this.gridView1.OptionsBehavior.Editable = true; break; case "update": this.gridView1.OptionsBehavior.Editable = true; break; case "view": this.gridView1.OptionsBehavior.Editable = false; break; default: break; } base.Refresh(); }