Esempio n. 1
0
        private void Save()
        {
            try
            {
                RefreshUI(RefreshedTypes.ShowProgressBar);//点击保存后显示进度条

                if (string.IsNullOrEmpty(this.ContractTitle.Text))
                {
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("PLEASECHOOSETOVIEWTHECONTRACT"));
                    RefreshUI(RefreshedTypes.HideProgressBar);//点击保存后显示进度条
                    return;
                }

                if (string.IsNullOrEmpty(txtTELL.Text))
                {
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "TELL"));
                    RefreshUI(RefreshedTypes.HideProgressBar);//点击保存后显示进度条
                    txtTELL.Focus();
                    return;
                }

                //ctrFile.FormID = cprinting.CONTRACTPRINTID;//附件
                //ctrFile.Save();
                if (actions == FormTypes.New)
                {
                    contractViewObj = new T_OA_CONTRACTVIEW();
                    if (employeepost != null)
                    {
                        contractViewObj.OWNERPOSTID       = employeepost.EMPLOYEEPOSTS[0].T_HR_POST.POSTID;                                 //岗位ID
                        contractViewObj.OWNERCOMPANYID    = employeepost.EMPLOYEEPOSTS[0].T_HR_POST.T_HR_DEPARTMENT.T_HR_COMPANY.COMPANYID; //公司ID
                        contractViewObj.OWNERDEPARTMENTID = employeepost.EMPLOYEEPOSTS[0].T_HR_POST.T_HR_DEPARTMENT.DEPARTMENTID;           //部门ID
                        contractViewObj.OWNERID           = employeepost.EMPLOYEEPOSTS[0].T_HR_EMPLOYEE.EMPLOYEEID;                         //员工ID
                        contractViewObj.OWNERNAME         = employeepost.EMPLOYEEPOSTS[0].T_HR_EMPLOYEE.EMPLOYEECNAME;                      //员工姓名
                    }
                    contractViewObj.CONTRACTVIEWID     = System.Guid.NewGuid().ToString();
                    contractViewObj.T_OA_CONTRACTPRINT = cprinting;                                             //打印实体
                    contractViewObj.TEL                = txtTELL.Text;                                          //联系电话
                    contractViewObj.CHECKSTATE         = Utility.GetCheckState(CheckStates.UnSubmit);           //未提交
                    contractViewObj.CREATEUSERID       = Common.CurrentLoginUserInfo.EmployeeID;                //创建人
                    contractViewObj.CREATEUSERNAME     = Common.CurrentLoginUserInfo.EmployeeName;              //创建人姓名
                    contractViewObj.OWNERID            = Common.CurrentLoginUserInfo.EmployeeID;                //所属用户ID
                    contractViewObj.OWNERNAME          = Common.CurrentLoginUserInfo.EmployeeName;              //所属用户名
                    contractViewObj.OWNERCOMPANYID     = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;    //所属公司ID
                    contractViewObj.OWNERDEPARTMENTID  = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; //所属部门ID
                    contractViewObj.OWNERPOSTID        = Common.CurrentLoginUserInfo.UserPosts[0].PostID;       //所属岗位ID
                    contractViewObj.CREATECOMPANYID    = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;    //创建公司ID
                    contractViewObj.CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; //创建部门ID
                    contractViewObj.CREATEPOSTID       = Common.CurrentLoginUserInfo.UserPosts[0].PostID;       //创建岗位ID

                    cmsfc.ContractViewapplicationsAddAsync(contractViewObj);
                }
                else if (actions == FormTypes.Edit)
                {
                    contractViewObj.T_OA_CONTRACTPRINT = cprinting;                           //打印实体
                    contractViewObj.TEL        = txtTELL.Text;                                //联系电话
                    contractViewObj.CHECKSTATE = Utility.GetCheckState(CheckStates.UnSubmit); //未提交

                    cmsfc.UpdateContractViewAsync(contractViewObj, "Edit");
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.SendException("保存合同查看申请Save事件", "OA", "T_OA_CONTRACTVIEW", "保存合同查看申请时返回错误", ex, ExceptionLevel.Middle, ExceptionType.Error);
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("ERRORINFO"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
            }
        }