public void Create(ERP_M003_Model ERP_M003_Model) { ERP_M003_Model.CreateDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; ERP_M003_Model.CreateUser = tempUser.UserName; ERP_M003_Model.CompCode = tempUser.CompCode; ERP_M003_Model.Validate(); this.ERP_M003_ModelRepository.Add(ERP_M003_Model); this.runtimeService.Commit(); }
private void EditForm(string formText, string btnCommand) { ERP_M003_Model temp = eRPM003ModelBindingSource.Current as ERP_M003_Model; ModelEditForm edit = new ModelEditForm(temp); edit.Text = formText; edit.Tag = btnCommand; if (edit.ShowDialog() != DialogResult.OK) { eRPM003ModelBindingSource.CancelEdit(); } }
public void Update(ERP_M003_Model ERP_M003_Model) { ERP_M003_Model.ModifyDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; ERP_M003_Model.ModifyUser = tempUser.UserName; ERP_M003_Model.Validate(); var existstb_Sys_Menu = this.GetById(ERP_M003_Model.Id); this.ERP_M003_ModelRepository.SetValues(ERP_M003_Model, existstb_Sys_Menu); this.runtimeService.Commit(); }
public void Save(ERP_M003_Model ERP_M003_Model, List <ERP_M003_Model_Product> modelProductList) { tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; var existsModel = this.GetById(ERP_M003_Model.Id); if (existsModel == null) { ERP_M003_Model.CompCode = tempUser.CompCode; ERP_M003_Model.CreateDt = DateTime.Now; ERP_M003_Model.CreateUser = tempUser.UserName; ERP_M003_Model.Validate(); this.ERP_M003_ModelRepository.Add(ERP_M003_Model); } else { ERP_M003_Model.ModifyDt = DateTime.Now; ERP_M003_Model.ModifyUser = tempUser.UserName; ERP_M003_Model.Validate(); this.ERP_M003_ModelRepository.SetValues(ERP_M003_Model, existsModel); } if (modelProductList != null) { foreach (var product in modelProductList) { var existstproduct = this.modelProductRepository.GetByID(product.Id); if (existstproduct == null) { product.CompCode = tempUser.CompCode; product.CreateDt = DateTime.Now; product.CreateUser = tempUser.UserName; product.Validate(); this.modelProductRepository.Add(product); } else { product.ModifyDt = DateTime.Now; product.ModifyUser = tempUser.UserName; product.Validate(); this.modelProductRepository.SetValues(product, existstproduct); } } } }
public ModelEditForm(ERP_M003_Model tempData) { InitializeComponent(); eRPM003ModelBindingSource.DataSource = tempData; eRPM003ModelProductBindingSource.DataSource = modelService.GetProductListByModelCode(tempData.ModelCode); }