private void BtnDelete_Click(object sender, EventArgs e) { if (mDataGridItem.CurrentRow == null) { return; } Model.Info_store_out_item item = mDataGridItem.GetCurrentEntity() as Model.Info_store_out_item; string msg = string.Format("确定删除:{0}?", item.Mtl_Name); if (Miles.Framework.UI.Function.Dialog.ShowQuestionYesNo(msg)) { mDataGridItem.DeleteCurrentItem <Model.Info_store_out_item>(); } }
private void BtnAdd_Click(object sender, EventArgs e) { FmMtlSelect fm = new FmMtlSelect(); fm.SelectValue += (obj) => { Info_mtl_item mtl = obj as Info_mtl_item; foreach (var v in mDataGridItem.GetDataSource <Model.Info_store_out_item>()) { if (v.Mtl_Code.Equals(mtl.Mtl_Code)) { MessageBox.Show(string.Format("已存在物料:{0}", mtl.Mtl_Name)); return; } } Model.Info_store_out_item item = Miles.Coro.Common.Utils.CopyToOther <Info_mtl_item, Model.Info_store_out_item>(mtl); item.Plan_OutQty = dicMatchTbItems.ContainsKey(item.Mtl_Code) ? dicMatchTbItems[item.Mtl_Code].Value:0; mDataGridItem.AddItem <Model.Info_store_out_item>(item); }; fm.ShowDialog(); }