public void Create(ERP_C003_Supplier ERP_C003_Supplier) { ERP_C003_Supplier.CreateDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; ERP_C003_Supplier.CreateUser = tempUser.UserName; ERP_C003_Supplier.Validate(); this.ERP_C003_SupplierRepository.Add(ERP_C003_Supplier); this.runtimeService.Commit(); }
public void Update(ERP_C003_Supplier ERP_C003_Supplier) { ERP_C003_Supplier.ModifyDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; ERP_C003_Supplier.ModifyUser = tempUser.UserName; ERP_C003_Supplier.Validate(); var existstb_Sys_Menu = this.GetById(ERP_C003_Supplier.Id); this.ERP_C003_SupplierRepository.SetValues(ERP_C003_Supplier, existstb_Sys_Menu); this.runtimeService.Commit(); }
/// <summary> /// 根据供应商显示物料 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { ERP_C003_Supplier temp = eRPC003SupplierBindingSource.Current as ERP_C003_Supplier; if (temp != null) { IERP_M001_MaterialService materialService = Unity.Instance.GetService <IERP_M001_MaterialService>(); IERP_C003_Supplier_FileService suppFileService = Unity.Instance.GetService <IERP_C003_Supplier_FileService>(); var matCodeData = materialService.GetMatSupp().Where(a => a.SuppCode == temp.SuppCode).Select(a => a.MatCode).Distinct().ToList(); this.ykGridControl2.DataSource = materialService.GetMaterial().Where(a => matCodeData.Contains(a.MatCode)).ToList(); this.gridView2.BestFitColumns(); this.eRPC003SupplierFileBindingSource.DataSource = suppFileService.GetQuery().Where(a => a.SuppCode == temp.SuppCode).ToList(); } }
private void EditForm(string formText, string btnCommand) { ERP_C003_Supplier temp = this.eRPC003SupplierBindingSource.Current as ERP_C003_Supplier; SupplierEditForm edit = new SupplierEditForm(temp); edit.Text = formText; edit.Tag = btnCommand; if (edit.ShowDialog() != DialogResult.OK) { eRPC003SupplierBindingSource.CancelEdit(); } else { gridView1_FocusedRowChanged(null, null); } }
public void Save(ERP_C003_Supplier supplier, List <ERP_C003_Supplier_File> suppFiles) { tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; var existsdevice = this.GetById(supplier.Id); if (existsdevice == null) { supplier.CompCode = tempUser.CompCode; supplier.CreateDt = DateTime.Now; supplier.CreateUser = tempUser.UserName; supplier.Validate(); this.ERP_C003_SupplierRepository.Add(supplier); } else { supplier.ModifyDt = DateTime.Now; supplier.ModifyUser = tempUser.UserName; supplier.Validate(); this.ERP_C003_SupplierRepository.SetValues(supplier, existsdevice); } foreach (var file in suppFiles) { var existsmatSupp = this.suppFileRepository.GetByID(file.Id); if (existsmatSupp == null) { file.CompCode = tempUser.CompCode; file.CreateDt = DateTime.Now; file.CreateUser = tempUser.UserName; file.Validate(); this.suppFileRepository.Add(file); } else { file.ModifyDt = DateTime.Now; file.ModifyUser = tempUser.UserName; file.Validate(); this.suppFileRepository.SetValues(file, existsmatSupp); } } this.runtimeService.Commit(); }
public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // MessageBox.Show(e.Item.Caption); //新增 if (e.Item.Caption == BtnCommandEnum.Add) { eRPC003SupplierBindingSource.AddNew(); EditForm("供应商资料新增", BtnCommandEnum.Add); } else if (e.Item.Caption == BtnCommandEnum.Edit) { ERP_C003_Supplier temp = eRPC003SupplierBindingSource.Current as ERP_C003_Supplier; if (temp == null) { throw new AppException("请先选择要修改的数据"); } EditForm("供应商资料修改", BtnCommandEnum.Edit); } else if (e.Item.Caption == BtnCommandEnum.Delete) { if (ERPHelper.Instance.MessageDel()) { ERP_C003_Supplier temp = eRPC003SupplierBindingSource.Current as ERP_C003_Supplier; supplierService.Delete(temp.Id); eRPC003SupplierBindingSource.RemoveCurrent(); } } else if (e.Item.Caption == BtnCommandEnum.Watch) { ERP_C003_Supplier temp = eRPC003SupplierBindingSource.Current as ERP_C003_Supplier; if (temp == null) { throw new AppException("请先选择要查看的数据"); } EditForm("供应商资料查看", BtnCommandEnum.Watch); } else if (e.Item.Caption == BtnCommandEnum.Refresh) { InitData(); } }
public SupplierEditForm(ERP_C003_Supplier tempData) { InitializeComponent(); this.tempData = tempData; }