public frm_Consumable(Maticsoft.Model.ConsumableInfo _ConsumableInfo) { InitializeComponent(); grd_ConsumableInfo.DataContext = _ConsumableInfo; btn_Edit.IsEnabled = true; MCP_CS.SetControl(grd_ConsumableInfo, false, false); //设置控件为不可编辑模式 ShowImg(_ConsumableInfo.C_Picture); }
//新增 private void btn_Add_Click(object sender, RoutedEventArgs e) { Maticsoft.Model.ConsumableInfo _Consum = new Maticsoft.Model.ConsumableInfo(); _Consum.C_Barcode = MCP_CS.ConsumableInfo.GetMaxID(); grd_ConsumableInfo.DataContext = _Consum; IsAdd = true; btn_Save.IsEnabled = true; btn_Add.IsEnabled = false; MCP_CS.SetControl(grd_ConsumableInfo, true, false); //设置控件为不可编辑模式 }
// //入库 // private void btn_Storage_Click(object sender, RoutedEventArgs e) { _ConsumOperation.Operation = Maticsoft.BLL.cls_Consumable.ConsumableOperation.Storage; //模式为入库模式 MCP_CS.SetControl(grd_Rec_Or_Stog, true, true); MCP_CS.SetControl_Button(grd_Rec_Or_Stog, true, false); grd_Rec_Or_Stog.DataContext = new Maticsoft.Model.ConsumableStorage(); dgv_ConsumableList.ItemsSource = _dataList_Storage; lab_title.Content = "耗材入库"; lab_User.Content = "入库人:"; txb_Consumable_Barcode.IsEnabled = false; txb_ConsumableName.IsEnabled = false; }
// //领料 // private void btn_Receive_Click(object sender, RoutedEventArgs e) { _ConsumOperation.Operation = Maticsoft.BLL.cls_Consumable.ConsumableOperation.Receive; //模式为领料模式 MCP_CS.SetControl(grd_Rec_Or_Stog, true, true); //Text控件可编辑 MCP_CS.SetControl_Button(grd_Rec_Or_Stog, true, false); //按钮可编辑 grd_Rec_Or_Stog.DataContext = new Maticsoft.Model.ConsumableReceive(); //数据显示控件指定数据源 dgv_ConsumableList.ItemsSource = _dataList_Receive; lab_title.Content = "耗材领料"; lab_User.Content = "领用人:"; txb_Consumable_Barcode.IsEnabled = false; txb_ConsumableName.IsEnabled = false; }
// //保存 // private void btn_Save_Click(object sender, RoutedEventArgs e) { Maticsoft.Model.ConsumableInfo _Consum = (Maticsoft.Model.ConsumableInfo)grd_ConsumableInfo.DataContext; if (IsAdd) //添加模式 { MCP_CS.ConsumableInfo.Add(_Consum); btn_Add.IsEnabled = true; My_MessageBox.My_MessageBox_Query("添加成功!"); grd_ConsumableInfo.DataContext = new Maticsoft.Model.ConsumableInfo(); } else //更新模式 { MCP_CS.ConsumableInfo.Update(_Consum); } MCP_CS.SetControl(grd_ConsumableInfo, false, false); //设置控件为不可编辑模式 }
// //保存 // private void btn_Save_Click(object sender, RoutedEventArgs e) { int tem = _ConsumOperation.ConsumableSave(dgv_ConsumableList); if (tem > 0) { My_MessageBox.My_MessageBox_Message("保存成功记录 " + tem + "条!"); _dataList_Receive.Clear(); _dataList_Storage.Clear(); MCP_CS.SetControl(grd_Rec_Or_Stog, false, true); MCP_CS.SetControl_Button(grd_Rec_Or_Stog, false, false); } else { My_MessageBox.My_MessageBox_Message("保存失败!请重试"); } }
// //编辑 // private void btn_Edit_Click(object sender, RoutedEventArgs e) { IsAdd = false; MCP_CS.SetControl(grd_ConsumableInfo, true, false); //设置控件为不可编辑模式 }
public frm_Consumable() { InitializeComponent(); MCP_CS.SetControl(grd_ConsumableInfo, false, false); //设置控件为不可编辑模式 btn_Edit.IsEnabled = false; }