void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { SUPP_M001_PurPlan temp = sUPPM001PurPlanBindingSource.Current as SUPP_M001_PurPlan; if (temp != null) { var ppServer = Unity.Instance.GetService <ISUPP_M001_PurPlanService>(); this.gridControl1.DataSource = ppServer.GetPurMat().Where(a => a.PurPlNo == temp.PurPlNo).ToList(); } }
public void Create(SUPP_M001_PurPlan SUPP_M001_PurPlan) { SUPP_M001_PurPlan.CreateDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; SUPP_M001_PurPlan.CreateUser = tempUser.UserName; SUPP_M001_PurPlan.Validate(); this.SUPP_M001_PurPlanRepository.Add(SUPP_M001_PurPlan); this.runtimeService.Commit(); }
public void Update(SUPP_M001_PurPlan SUPP_M001_PurPlan) { SUPP_M001_PurPlan.ModifyDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; SUPP_M001_PurPlan.ModifyUser = tempUser.UserName; SUPP_M001_PurPlan.Validate(); var existstb_Sys_Menu = this.GetById(SUPP_M001_PurPlan.Id); this.SUPP_M001_PurPlanRepository.SetValues(SUPP_M001_PurPlan, existstb_Sys_Menu); this.runtimeService.Commit(); }
private void EditForm(string formText, string btnCommand) { SUPP_M001_PurPlan temp = this.sUPPM001PurPlanBindingSource.Current as SUPP_M001_PurPlan; PurPlanEditForm edit = new PurPlanEditForm(temp); edit.Text = formText; edit.Tag = btnCommand; if (edit.ShowDialog() != DialogResult.OK) { sUPPM001PurPlanBindingSource.CancelEdit(); } }
void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { SUPP_M001_PurPlan temp = sUPPM001PurPlanBindingSource.Current as SUPP_M001_PurPlan; if (temp != null) { var purDetailServer = Unity.Instance.GetService <ISUPP_M001_PurPlan_DetailService>(); this.sUPPM001PurPlanDetailBindingSource.DataSource = purDetailServer.GetSuppDetail().Where(a => a.PurPlNo == temp.PurPlNo).ToList(); this.gridControl2.DataSource = purPlanService.GetPurMat().Where(a => a.PurPlNo == temp.PurPlNo).OrderBy(a => a.MatCode).ToList(); gridView2_FocusedRowChanged(null, null); } else { this.sUPPM001PurPlanDetailBindingSource.DataSource = null; this.gridControl2.DataSource = null; } }
private void EditForm(string formText, string btnCommand) { SUPP_M001_PurPlan temp = this.sUPPM001PurPlanBindingSource.Current as SUPP_M001_PurPlan; PlaningEditForm edit = new PlaningEditForm(temp); edit.Text = formText; edit.Tag = btnCommand; if (edit.ShowDialog() != DialogResult.OK) { sUPPM001PurPlanBindingSource.CancelEdit(); } else { gridView1_FocusedRowChanged(null, null); } }
public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // MessageBox.Show(e.Item.Caption); //新增 if (e.Item.Caption == BtnCommandEnum.Add) { sUPPM001PurPlanBindingSource.AddNew(); SUPP_M001_PurPlan temp = this.sUPPM001PurPlanBindingSource.Current as SUPP_M001_PurPlan; temp.TxDt = DateTime.Now.Date; EditForm("采购计划新增", BtnCommandEnum.Add); } else if (e.Item.Caption == BtnCommandEnum.Edit) { SUPP_M001_PurPlan temp = sUPPM001PurPlanBindingSource.Current as SUPP_M001_PurPlan; if (temp == null) { throw new AppException("请先选择要修改的数据"); } EditForm("采购计划修改", BtnCommandEnum.Edit); } else if (e.Item.Caption == BtnCommandEnum.Delete) { if (ERPHelper.Instance.MessageDel()) { SUPP_M001_PurPlan temp = sUPPM001PurPlanBindingSource.Current as SUPP_M001_PurPlan; purPlanService.Delete(temp.Id); sUPPM001PurPlanBindingSource.RemoveCurrent(); } } else if (e.Item.Caption == BtnCommandEnum.Watch) { SUPP_M001_PurPlan temp = sUPPM001PurPlanBindingSource.Current as SUPP_M001_PurPlan; if (temp == null) { throw new AppException("请先选择要查看的数据"); } EditForm("采购计划查看", BtnCommandEnum.Watch); } else if (e.Item.Caption == BtnCommandEnum.Refresh) { InitData(); } }
public void Save(SUPP_M001_PurPlan purPlan, List <SUPP_M001_PurPlan_Detail> purMatData) { tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; var existsdevice = this.GetById(purPlan.Id); if (existsdevice == null) { purPlan.CompCode = tempUser.CompCode; purPlan.CreateDt = DateTime.Now; purPlan.CreateUser = tempUser.UserName; purPlan.Validate(); this.SUPP_M001_PurPlanRepository.Add(purPlan); } else { purPlan.ModifyDt = DateTime.Now; purPlan.ModifyUser = tempUser.UserName; purPlan.Validate(); this.SUPP_M001_PurPlanRepository.SetValues(purPlan, existsdevice); } foreach (var purMat in purMatData) { var existspurMat = purDetailRepository.GetByID(purMat.Id); if (existspurMat == null) { purMat.CompCode = tempUser.CompCode; purMat.CreateDt = DateTime.Now; purMat.CreateUser = tempUser.UserName; purMat.Validate(); this.purDetailRepository.Add(purMat); } else { purMat.ModifyDt = DateTime.Now; purMat.ModifyUser = tempUser.UserName; purMat.Validate(); this.purDetailRepository.SetValues(purMat, existspurMat); } } this.runtimeService.Commit(); }
public PurPlanEditForm(SUPP_M001_PurPlan tempData) { InitializeComponent(); this.tempData = tempData; }
public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // MessageBox.Show(e.Item.Caption); //新增 if (e.Item.Caption == BtnCommandEnum.Add) { sUPPM001PurPlanBindingSource.AddNew(); SUPP_M001_PurPlan temp = this.sUPPM001PurPlanBindingSource.Current as SUPP_M001_PurPlan; temp.TxDt = DateTime.Now.Date; EditForm("采购计划新增", BtnCommandEnum.Add); } else if (e.Item.Caption == BtnCommandEnum.Edit) { SUPP_M001_PurPlan temp = sUPPM001PurPlanBindingSource.Current as SUPP_M001_PurPlan; if (temp == null) { throw new AppException("请先选择要修改的数据"); } EditForm("采购计划修改", BtnCommandEnum.Edit); } else if (e.Item.Caption == BtnCommandEnum.Delete) { if (ERPHelper.Instance.MessageDel()) { SUPP_M001_PurPlan temp = sUPPM001PurPlanBindingSource.Current as SUPP_M001_PurPlan; purPlanService.DelPurAndDetail(temp.Id); sUPPM001PurPlanBindingSource.RemoveCurrent(); gridView1_FocusedRowChanged(null, null); } } else if (e.Item.Caption == BtnCommandEnum.Watch) { SUPP_M001_PurPlan temp = sUPPM001PurPlanBindingSource.Current as SUPP_M001_PurPlan; if (temp == null) { throw new AppException("请先选择要查看的数据"); } EditForm("采购计划查看", BtnCommandEnum.Watch); } else if (e.Item.Caption == BtnCommandEnum.Refresh) { InitData(); } else if (e.Item.Caption == BtnCommandEnum.SuppSet) { SUPP_M001_PurPlan temp = this.sUPPM001PurPlanBindingSource.Current as SUPP_M001_PurPlan; PurPlanEditForm frm = new PurPlanEditForm(temp); frm.Text = "采购安排"; frm.Tag = BtnCommandEnum.Add; if (frm.ShowDialog() == DialogResult.OK) { InitData(); } } else if (e.Item.Caption == "审核") { SUPP_M001_PurPlan temp = sUPPM001PurPlanBindingSource.Current as SUPP_M001_PurPlan; if (temp == null) { throw new AppException("请先选择要审核的数据"); } if (ERPHelper.Instance.MessageIf("确定审核通过吗")) { temp.Status = "已审核"; purPlanService.Update(temp); } } else if (e.Item.Caption == "取消审核") { SUPP_M001_PurPlan temp = sUPPM001PurPlanBindingSource.Current as SUPP_M001_PurPlan; if (temp == null) { throw new AppException("请先选择要审核的数据"); } if (ERPHelper.Instance.MessageIf("确定审核通过吗")) { temp.Status = ""; purPlanService.Update(temp); } } }