public void LoadGrid() { DoWork("加载项目数据", "加载项目数据", () => { LstXMBProjectInfo = client.GetIXMBProjectInfoService().GetList(""); }, (ex) => { if (ex == null) { gcXMBProjectInfo.DataSource = LstXMBProjectInfo; } }); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void XMBProjectInfoSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { bindingSource1.EndEdit(); RefXMBProjectInfo.ProjectBalance = ProjectBalanceEdit.Text; if (!norm.Validate()) { XtraMessageBox.Show("填写项不符合验证规则"); return; } DoWork("保存数据", "保存数据", () => { client.GetIXMBProjectInfoService().Update(RefXMBProjectInfo, LoginInfor.LoginName); //添加操作记录 cmn_operation opreation = new cmn_operation(); opreation.SystemNo = AppConfig.SYSTEM_NO; opreation.BusinessNo = RefXMBProjectInfo.ProjectNo; opreation.BusinessName = RefXMBProjectInfo.ProjectName; opreation.Version = RefXMBProjectInfo.Version; opreation.OperationNo = "0"; opreation.OperationName = "修改"; //获取服务器时间 DataTable dt = GpClient.CreateInstance().Execute("SELECT GETDATE() AS NowDate", CommandType.Text).Table; if (dt != null) { if (dt.Rows.Count > 0) { opreation.OperationDate = DateTime.Parse(dt.Rows[0]["NowDate"].ToString()); } } else { opreation.OperationDate = DateTime.Now; } opreation.OperByUserName = LoginInfor.UserName; opreation.Remark = String.Format("{0} 在 {1} 修改了本条记录", LoginInfor.UserName, opreation.OperationDate); Erp.GpServiceClient.GpClient.CreateInstance().CmnOperationAdd(opreation, LoginInfor.LoginName); }, (ex) => { if (ex == null) { IsEdit = false; #region 刷新当前选择项目 if (AppConfig.SelectProject != null && AppConfig.SelectProject.ProjectNo == RefXMBProjectInfo.ProjectNo) { ProjectInfo project = new ProjectInfo(); project.ProjectName = RefXMBProjectInfo.ProjectName; project.ProjectNo = RefXMBProjectInfo.ProjectNo; AppConfig.SelectProject = new MeteringPaymentClient().GetIProjectInfoService().GetCurrencyAndExchangeRate(project); } #endregion //if (MainHandler != null) // MainHandler.LoadGrid(); //this.Close(); } }); }