//检测数量 改变 (检测数量对应明细条数) private void calcPCFogCheckQuantity_EditValueChanged(object sender, EventArgs e) { var needRows = (int)this.calcPCFogCheckQuantity.Value - this._pcfog.Details.Count; if (needRows >= 0) { for (int i = 0; i < needRows; i++) { Model.PCFogCheckDetail detail = new Book.Model.PCFogCheckDetail(); detail.PCImpactCheckDetailId = Guid.NewGuid().ToString(); detail.PCFogCheckId = this._pcfog.PCFogCheckId; detail.CommentLDate = DateTime.Now; detail.CommentLTime = DateTime.Now; detail.CommentRDate = DateTime.Now; detail.CommentRTime = DateTime.Now; this._pcfog.Details.Add(detail); } this.gridControl1.RefreshDataSource(); } else { for (int i = 0; i < Math.Abs(needRows); i++) { this._pcfog.Details.Remove(this._pcfog.Details.Last()); } } }
private void btn_Add_Click(object sender, EventArgs e) { Model.PCFogCheckDetail pcfcd = new Book.Model.PCFogCheckDetail(); pcfcd.PCImpactCheckDetailId = Guid.NewGuid().ToString(); pcfcd.PCFogCheckId = this._pcfog.PCFogCheckId; pcfcd.CommentLDate = DateTime.Now; pcfcd.CommentLTime = DateTime.Now; pcfcd.CommentRDate = DateTime.Now; pcfcd.CommentRTime = DateTime.Now; this._pcfog.Details.Add(pcfcd); this.gridControl1.RefreshDataSource(); }
protected override void AddNew() { this._pcfog = new Book.Model.PCFogCheck(); this._pcfog.PCFogCheckId = this._pcfogManager.GetId(); this._pcfog.PCFogCheckDate = DateTime.Now.Date; this._pcfog.PCFogCheckQuantity = 1; //默认检测数量为1 this._pcfog.Details = new List <Model.PCFogCheckDetail>(); Model.PCFogCheckDetail pcfcd = new Book.Model.PCFogCheckDetail(); pcfcd.PCImpactCheckDetailId = Guid.NewGuid().ToString(); pcfcd.PCFogCheckId = this._pcfog.PCFogCheckId; pcfcd.CommentLDate = DateTime.Now; pcfcd.CommentLTime = DateTime.Now; pcfcd.CommentRDate = DateTime.Now; pcfcd.CommentRTime = DateTime.Now; this._pcfog.Details.Add(pcfcd); }
protected override void AddNew() { this._pcfog = new Book.Model.PCFogCheck(); this._pcfog.PCFogCheckId = this._pcfogManager.GetId(); this._pcfog.PCFogCheckDate = DateTime.Now.Date; this._pcfog.PCFogCheckQuantity = 6; //默认检测数量为1 this._pcfog.ProductUnitId = "f7f95879-3444-494b-92eb-2aa784c52e8c"; //默认单位PCS this._pcfog.Details = new List <Model.PCFogCheckDetail>(); Model.PCFogCheckDetail pcfcd = new Book.Model.PCFogCheckDetail(); pcfcd.PCImpactCheckDetailId = Guid.NewGuid().ToString(); pcfcd.PCFogCheckId = this._pcfog.PCFogCheckId; pcfcd.CommentLDate = DateTime.Now; pcfcd.CommentLTime = DateTime.Now; pcfcd.CommentRDate = DateTime.Now; pcfcd.CommentRTime = DateTime.Now; pcfcd.CheckStandard = this.repositoryItemComboBox1.Items[0].ToString(); this._pcfog.Details.Add(pcfcd); }