private void btn_Add_Click(object sender, EventArgs e) { ListForm f = new ListForm(2); if (f.ShowDialog(this) == DialogResult.OK) { if (f.keys != null && f.keys.Count > 0) { Model.RelationXODetail detail; foreach (var item in f.keys) { detail = new Book.Model.RelationXODetail(); detail.RelationXODetailId = Guid.NewGuid().ToString(); detail.RelationXOId = this._relationXO.RelationXOId; detail.PCInputCheckId = item.PCInputCheckId; detail.LotNumber = item.LotNumber; detail.ProductName = item.Product == null ? null : item.Product.ProductName; detail.InvoiceXOCusId = item.InvoiceXOCusId; if (this._relationXO.Detail != null && this._relationXO.Detail.Count > 0) { if (this._relationXO.Detail.Any(d => d.PCInputCheckId == detail.PCInputCheckId)) { MessageBox.Show(detail.PCInputCheckId + "已存在,請勿重複添加!", this.Text, MessageBoxButtons.OK); continue; } } this._relationXO.Detail.Add(detail); } } } this.gridControl1.RefreshDataSource(); }
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ListForm f = new ListForm(); if (f.ShowDialog(this) == DialogResult.OK) { this._PCInputCheck = f.SelectItem; this.action = "view"; this.Refresh(); } }