public void Create(ERP_C001_Code ERP_C001_Code) { ERP_C001_Code.CreateDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; ERP_C001_Code.CreateUser = tempUser.UserName; ERP_C001_Code.CompCode = tempUser.CompCode; ERP_C001_Code.Validate(); this.ERP_C001_CodeRepository.Add(ERP_C001_Code); this.runtimeService.Commit(); }
public void Update(ERP_C001_Code ERP_C001_Code) { ERP_C001_Code.ModifyDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; ERP_C001_Code.ModifyUser = tempUser.UserName; ERP_C001_Code.Validate(); var existstb_Sys_Menu = this.GetById(ERP_C001_Code.Id); this.ERP_C001_CodeRepository.SetValues(ERP_C001_Code, existstb_Sys_Menu); this.runtimeService.Commit(); }
private void EditForm(string formText, string btnCommand) { ERP_C001_Code temp = eRPC001CodeBindingSource.Current as ERP_C001_Code; C001CodeEditForm edit = new C001CodeEditForm(temp); edit.Text = formText; edit.Tag = btnCommand; if (edit.ShowDialog() != DialogResult.OK) { eRPC001CodeBindingSource.CancelEdit(); } }
public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // MessageBox.Show(e.Item.Caption); //新增 if (e.Item.Caption == BtnCommandEnum.Add) { ERP_C001_CodeDictionary codeDic = this.eRPC001CodeDictionaryBindingSource.Current as ERP_C001_CodeDictionary; if (codeDic == null) { throw new AppException("请先选择类别"); } eRPC001CodeBindingSource.AddNew(); ERP_C001_Code temp = eRPC001CodeBindingSource.Current as ERP_C001_Code; temp.CodeID = codeDic.Code; temp.CodeIDDesc = codeDic.FullName; // temp.CodeID = treeCodeType.FocusedNode[treeColumnCodeID] == null ? null : treeCodeType.FocusedNode[treeColumnCodeID].ToStr(); //temp.CodeIDDesc = treeCodeType.FocusedNode[treeColumnCodeIDDesc] == null ? null : treeCodeType.FocusedNode[treeColumnCodeIDDesc].ToStr(); EditForm("基础代号新增", BtnCommandEnum.Add); InitData(); } else if (e.Item.Caption == BtnCommandEnum.Edit) { EditForm("基础代号修改", BtnCommandEnum.Edit); } else if (e.Item.Caption == BtnCommandEnum.Delete) { if (ERPHelper.Instance.MessageDel()) { var temp = eRPC001CodeBindingSource.Current as ERP_C001_Code; if (temp == null) { throw new AppException("请先选择要删除的数据"); } codeService.Delete(temp.Id); eRPC001CodeBindingSource.RemoveCurrent(); } } else if (e.Item.Caption == BtnCommandEnum.AddCodeDic) { eRPC001CodeDictionaryBindingSource.AddNew(); ERP_C001_CodeDictionary temp = this.eRPC001CodeDictionaryBindingSource.Current as ERP_C001_CodeDictionary; temp.ParentId = "0"; EditDicForm("类型新增", BtnCommandEnum.AddCodeDic); } else if (e.Item.Caption == BtnCommandEnum.EditCodeDic) { EditDicForm("类型修改", BtnCommandEnum.EditCodeDic); } }
public C001CodeEditForm(ERP_C001_Code tempData) { InitializeComponent(); //this.codeService = codeService; eRPC001CodeBindingSource.DataSource = tempData; }