private void Save() { try { if (Check()) { RefreshUI(RefreshedTypes.ShowProgressBar); //点击保存后显示进度条 T_SYS_DICTIONARY StrContractLevel = cbContractLevel.SelectedItem as T_SYS_DICTIONARY; //合同级别 string StrFlag = string.Empty; string StartTime = string.Empty; //开始时间 string StrEndTime = string.Empty; //结束时间 StartTime = this.StartTime.Text; StrEndTime = this.EndTime.Text; DateTime DtStart = new DateTime(); DateTime DtEnd = new DateTime(); if (!string.IsNullOrEmpty(StartTime) && !string.IsNullOrEmpty(StrEndTime)) { DtStart = System.Convert.ToDateTime(StartTime); DtEnd = System.Convert.ToDateTime(StrEndTime); if (DtStart >= DtEnd) { Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("StartDateEndDatemustbegreaterthan", "")); this.StartTime.Focus(); RefreshUI(RefreshedTypes.HideProgressBar);//关闭进度条动画 return; } } if (this.rbtYes.IsChecked == true)//商务合同 { StrFlag = "0"; } if (this.RbtNo.IsChecked == true)//人事合同 { StrFlag = "1"; } if (actions == FormTypes.New) { string strContractTypeID = ((T_OA_CONTRACTTYPE)tbxContractTypeID.SelectedItem).CONTRACTTYPEID;//类型ID ctappObj.CONTRACTAPPID = System.Guid.NewGuid().ToString(); ctappObj.CONTRACTTYPEID = strContractTypeID; ctappObj.CONTRACTLEVEL = StrContractLevel.DICTIONARYVALUE.ToString(); ctappObj.CHECKSTATE = Utility.GetCheckState(CheckStates.UnSubmit); //未提交 ctappObj.CREATEUSERID = Common.CurrentLoginUserInfo.EmployeeID; //创建人 ctappObj.STARTDATE = DtStart; ctappObj.ENDDATE = DtEnd; ctappObj.EXPIRATIONREMINDER = Convert.ToInt32(nudBalanceMonth.Value);//到期提醒天数 ctappObj.CONTENT = ContractText.RichTextBoxContext; ctappObj.CONTRACTFLAG = StrFlag; //合同标志 ctappObj.CREATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName; //创建人姓名 ctappObj.OWNERID = Common.CurrentLoginUserInfo.EmployeeID; //所属用户ID ctappObj.OWNERNAME = Common.CurrentLoginUserInfo.EmployeeName; //所属用户名 ctappObj.OWNERCOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID; //所属公司ID ctappObj.OWNERDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; //所属部门ID ctappObj.OWNERPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID; //所属岗位ID ctappObj.CREATECOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID; //创建公司ID ctappObj.CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; //创建部门ID ctappObj.CREATEPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID; //创建岗位ID //ctrFile.FormID = ctappObj.CONTRACTAPPID;//上传附件 //if (string.IsNullOrEmpty(PartyaId))//如果甲方ID不为空 //{ // ctappObj.PARTYA = txtPartya.Text; //} //if (string.IsNullOrEmpty(PartybId))//如果乙方ID不为空 //{ // ctappObj.PARTYB = txtPartyb.Text; //} //ctrFile.Save(); cmsfc.ContractApprovalAddAsync(ctappObj); } else { string strContractTypeID = ((T_OA_CONTRACTTYPE)tbxContractTypeID.SelectedItem).CONTRACTTYPEID;//类型ID ctappObj.CONTRACTTYPEID = strContractTypeID; ctappObj.CONTRACTLEVEL = StrContractLevel.DICTIONARYVALUE.ToString(); ctappObj.STARTDATE = DtStart; ctappObj.ENDDATE = DtEnd; ctappObj.EXPIRATIONREMINDER = Convert.ToInt32(nudBalanceMonth.Value);//到期提醒天数 ctappObj.CONTENT = ContractText.RichTextBoxContext; ctappObj.UPDATEUSERID = Common.CurrentLoginUserInfo.EmployeeID; //修改人ID ctappObj.UPDATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName; //修改人姓名 ctappObj.CHECKSTATE = Utility.GetCheckState(CheckStates.UnSubmit); //未提交 ctappObj.CONTRACTFLAG = StrFlag; //合同标志 //ctrFile.FormID = ctappObj.CONTRACTAPPID;//上传附件 //if (string.IsNullOrEmpty(PartyaId))//如果乙方ID不为空 //{ // ctappObj.PARTYA = txtPartya.Text; //} //if (string.IsNullOrEmpty(PartybId))//如果乙方ID不为空 //{ // ctappObj.PARTYB = txtPartyb.Text; //} //ctrFile.Save(); cmsfc.UpdateContraApprovalAsync(ctappObj, "Edit"); } } } catch (Exception ex) { ExceptionManager.SendException("保存Save函数", "OA", "T_OA_CONTRACTAPP", "保存返回错误", ex, ExceptionLevel.Middle, ExceptionType.Error); ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("ERRORINFO"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); } }