bool SaveData() { bool ret = false; CRM_JobMastResult info = Form_GetEditEntity() as CRM_JobMastResult; WCFAddUpdateResult rst = new WCFAddUpdateResult(); if (this.DataIsChanged) { CRM_JobMastLogic logic = new CRM_JobMastLogic(this); rst = logic.AddOrUpdate(info); } else { rst.KeyGuid = info.EmpJobGuid; } if (rst.KeyGuid != null) { ret = true; } else { ret = false; } return(ret); }
private void btnSubmit_Click(object sender, EventArgs e) { CRM_JobMastResult info = Form_GetEditEntity() as CRM_JobMastResult; WCFAddUpdateResult rst = new WCFAddUpdateResult(); if (this.DataIsChanged) { CRM_JobMastLogic logic = new CRM_JobMastLogic(this); rst = logic.AddOrUpdate(info); } else { rst.KeyGuid = info.EmpJobGuid; } if (rst.KeyGuid != null) { WF_AuditRecordLogic logicWF = new WF_AuditRecordLogic(this); WCFAddUpdateResult rstAudit = logicWF.SubmitBill(new Entity.UserModel.WF.WF_AuditRecordParam() { SourceTableEngName = "CRM_JobMast", SourceBillGuid = info.EmpJobGuid, SourceBillNo = info.BillNo }); if (rstAudit.Key > 0) { LoadData(); this.ShowMessage("提交成功!"); } } }
object Form_GetEditEntity() { CRM_JobMastResult info = new CRM_JobMastResult(); info.EmpJobGuid = GuidKey; info = this.ConvertControlToEntity <CRM_JobMastResult>(this.grpMain.Controls, info, null); info = this.ConvertControlToEntity <CRM_JobMastResult>(this.grpContext.Controls, info, null); info = this.ConvertControlToEntity <CRM_JobMastResult>(this.panEditInfo.Controls, info, null); if (this.chkJobType1.Checked) { info.JobType = "日报"; } if (this.chkJobType2.Checked) { info.JobType = "周报"; } if (this.chkJobType3.Checked) { info.JobType = "月报"; } this.SetDataIsChanged <CRM_JobMastResult>(info); return(info); }
public WCFAddUpdateResult AddOrUpdate(CRM_JobMastResult param) { WCFAddUpdateResult ret = new WCFAddUpdateResult(); ExeResult rst = new ExeResult(); rst = this.Execute("ZNLCRM.BLL.HR.CRM_JobMastBLL", "AddOrUpdate", param); ret = (rst == null ? new WCFAddUpdateResult() : rst.Result as WCFAddUpdateResult); return(ret); }
private void btnCheck_Click(object sender, EventArgs e) { //frmAuditRecordList frmRecord = new frmAuditRecordList("CRM_JobMast", GuidKey, this.txtBillNo.Text); //frmRecord.BeforePassEvent = SaveData; //frmRecord.AfterPassEvent = LoadData; //frmRecord.ShowDialog(); CRM_JobMastResult info = Form_GetEditEntity() as CRM_JobMastResult; this.WF_CheckBill("CRM_JobMast", info.BillNo, info.EmpJobGuid, this.DataIsChanged, SaveData, LoadData); }
private void btnSave_Click(object sender, EventArgs e) { CRM_JobMastResult info = Form_GetEditEntity() as CRM_JobMastResult; if (!this.DataIsChanged) { this.ShowNoChangedMsg(); return; } CRM_JobMastLogic logic = new CRM_JobMastLogic(this); WCFAddUpdateResult pageList = this.AsyncExecute <WCFAddUpdateResult, CRM_JobMastResult>(info, logic.AddOrUpdate, SaveComplete); }
public CRM_JobMastResult GetInfo(CRM_JobMastParam param) { CRM_JobMastResult ret = new CRM_JobMastResult(); ExeResult rst = new ExeResult(); if (param.EmpJobGuid == null) { this.ShowMessage("请指定要修改的记录!"); return(ret); } rst = this.Execute("ZNLCRM.BLL.HR.CRM_JobMastBLL", "GetInfo", param); ret = rst == null ? new CRM_JobMastResult() : rst.Result as CRM_JobMastResult; return(ret); }
/// <summary> /// 获取上一条或下一条记录 /// </summary> /// <param name="param">条件实体</param> /// <returns></returns> public CRM_JobMastResult GetNextOrPreInfo(CRM_JobMastParam param) { this.CheckSession(); CRM_JobMastResult rst = new CRM_JobMastResult(); #region 判断 if (param.EmpJobGuid == null) { throw new WarnException("请指定关键字GUID!"); } #endregion #region 保存实体 WhereClip where = CRM_JobMast._.EmpJobGuid == param.EmpJobGuid; where = Sys_EmpDataRightBLL.GetEmpIDInWhere(where, CRM_JobMast._.JobDate, CRM_JobMast._.BeLongEmpID, CRM_JobMast._.OrgID, CRM_JobMast._.DeptID, this.SessionInfo); rst = this.Select <CRM_JobMastResult>(where); #endregion return(rst); }
void LoadData() { if (GuidKey == null) { return; } CRM_JobMastLogic logic = new CRM_JobMastLogic(this); CRM_JobMastResult rst = logic.GetInfo(new CRM_JobMastParam() { EmpJobGuid = GuidKey }); if (rst == null) { return; } this.ConvertEntityToControl(this.grpMain.Controls, rst, null); this.ConvertEntityToControl(this.grpContext.Controls, rst, null); this.ConvertEntityToControl(this.panEditInfo.Controls, rst, null); this.CheckIsReadOnly <CRM_JobMastResult>(rst); this.CheckAuditStatus <CRM_JobMastResult>(rst, this.grpMain, this.grpContext, this.panEditInfo); this.chkJobType1.Checked = false; this.chkJobType2.Checked = false; this.chkJobType3.Checked = false; if (rst.JobType == "日报") { this.chkJobType1.Checked = true; } if (rst.JobType == "周报") { this.chkJobType2.Checked = true; } if (rst.JobType == "月报") { this.chkJobType3.Checked = true; } this.EditBeforeData = rst; CheckAuditButton("CRM_JobMast", GuidKey, this.btnSubmit, this.btnTakeBack, this.btnCheck, this.btnCancelCheck); this.DataIsChanged = false; }
private void btnTakeBack_Click(object sender, EventArgs e) { CRM_JobMastResult info = Form_GetEditEntity() as CRM_JobMastResult; WCFAddUpdateResult rst = new WCFAddUpdateResult(); if (GuidKey != null) { WF_AuditRecordLogic logicWF = new WF_AuditRecordLogic(this); WCFAddUpdateResult rstAudit = logicWF.TakeBackBill(new Entity.UserModel.WF.WF_AuditRecordParam() { SourceTableEngName = "CRM_JobMast", SourceBillGuid = info.EmpJobGuid }); if (rstAudit.Key > 0) { LoadData(); this.ShowMessage("收回成功!"); } } }
/// <summary> /// 删除实体 /// </summary> /// <param name="param">删除条件实体</param> /// <returns></returns> public WCFAddUpdateResult DelInfo(CRM_JobMastParam param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); int affect = 0; try { #region 判断 if (param.EmpJobGuid == null) { throw new WarnException("请指定要删除的记录!"); } #endregion WhereClip where = GetWhereClip(param); CRM_JobMastResult oldInfo = this.GetInfo(param); oldInfo = Sys_EmpDataRightBLL.SetRecIsEdit <CRM_JobMastResult>(oldInfo, "BeLongEmpID", "", "OrgID", this.SessionInfo); if (oldInfo.RecStatu != 2) { throw new WarnException("您无权删除当前记录!"); } CRM_JobMastResult info = new CRM_JobMastResult(); info.IsDeleted = true; info.UpdatedTime = DateTime.Now; info.UpdatedEmpID = this.SessionInfo.UserID; affect = this.Update <CRM_JobMastResult>(info, where); #region 设置返回值 ret.Key = affect; #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
/// <summary> /// 添加和新增修改 /// </summary> /// <param name="param">新增或修改的实体</param> /// <returns></returns> public WCFAddUpdateResult AddOrUpdate(CRM_JobMastResult param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { int affect = 0; #region 判断 if (param.JobName.ToStringHasNull().Trim() == "") { throw new WarnException("请指定报告标题!"); } if (param.JobType.ToStringHasNull().Trim() == "") { throw new WarnException("请指定报告类型"); } if (param.JobDate == null) { throw new WarnException("请指定报告日期!"); } if (param.JobContext.ToStringHasNull().Trim() == "") { throw new WarnException("请指定报告内容!"); } if (param.JobContext.VarcharLen() > 8000) { throw new WarnException("请指定报告内容超长,请指定4000个汉字,8000个英文!"); } #endregion #region 系统默认值 param.Summary = param.JobContext; if (param.EmpJobGuid != null) { WhereClip where = CRM_JobMast._.EmpJobGuid == param.EmpJobGuid; param.GCompanyID = this.SessionInfo.CompanyID; param.UpdatedEmpID = this.SessionInfo.UserID; param.UpdatedTime = DateTime.Now; affect = this.Update <CRM_JobMastResult>(param, where); } else { Sys_CodeRulerBLL codeRulerBll = new Sys_CodeRulerBLL(); codeRulerBll.SessionInfo = this.SessionInfo; param.BillNo = codeRulerBll.GetBillNo(new Entity.UserModel.Sys.SYS_CredentialCodeRuleParam() { BillDate = DateTime.Today, TableName = "CRM_JobMast" }); param.Status = "New"; param.EmpJobGuid = Guid.NewGuid(); param.GCompanyID = this.SessionInfo.CompanyID; param.CreatedEmpID = this.SessionInfo.UserID; param.CreatedTime = DateTime.Now; param.BeLongEmpID = this.SessionInfo.UserID; param.BelongEmpName = this.SessionInfo.UserName; param.IsDeleted = false; affect = this.Insert <CRM_JobMastResult>(param); } #region 设置返回值 ret.Key = param.EmpJobID; ret.KeyGuid = param.EmpJobGuid; ret.BillNo = param.BillNo; ret.CreatedTime = param.CreatedTime; ret.CreatedEmpID = param.CreatedEmpID; ret.CreatedEmpName = param.CreatedEmpName; ret.UpdatedEmpID = param.UpdatedEmpID; ret.UpdatedEmpName = param.UpdatedEmpName; ret.UpdatedTime = param.UpdatedTime; #endregion #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }