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

                    if (actions == FormTypes.New)
                    {
                        InfoObj.CONTRACTTEMPLATEID = System.Guid.NewGuid().ToString();//模板编号
                        if (tbxContractTypeID.SelectedItem == null)
                        {
                            return;
                        }
                        T_OA_CONTRACTTYPE ent = tbxContractTypeID.SelectedItem as T_OA_CONTRACTTYPE;
                        InfoObj.T_OA_CONTRACTTYPE  = ent;;                                                  //类型编号
                        InfoObj.CONTENT            = tbxContractText.RichTextBoxContext;
                        InfoObj.CREATEUSERID       = Common.CurrentLoginUserInfo.EmployeeID;                //创建人ID
                        InfoObj.CREATEUSERNAME     = Common.CurrentLoginUserInfo.EmployeeName;              //创建人姓名
                        InfoObj.OWNERID            = Common.CurrentLoginUserInfo.EmployeeID;                //所属用户ID
                        InfoObj.OWNERNAME          = Common.CurrentLoginUserInfo.EmployeeName;              //所属用户名
                        InfoObj.OWNERCOMPANYID     = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;    //所属公司ID
                        InfoObj.OWNERDEPARTMENTID  = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; //所属部门ID
                        InfoObj.OWNERPOSTID        = Common.CurrentLoginUserInfo.UserPosts[0].PostID;       //所属岗位ID
                        InfoObj.CREATECOMPANYID    = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;    //创建公司ID
                        InfoObj.CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; //创建部门ID
                        InfoObj.CREATEPOSTID       = Common.CurrentLoginUserInfo.UserPosts[0].PostID;       //创建岗位ID
                        InfoObj.OWNERNAME          = Common.CurrentLoginUserInfo.EmployeeName;

                        ContractManagement.ContractTemplateAddAsync(InfoObj);
                    }
                    else
                    {
                        if (tbxContractTypeID.SelectedItem == null)
                        {
                            return;
                        }
                        T_OA_CONTRACTTYPE ent = tbxContractTypeID.SelectedItem as T_OA_CONTRACTTYPE;

                        InfoObj.CONTENT           = tbxContractText.RichTextBoxContext;
                        InfoObj.UPDATEUSERID      = Common.CurrentLoginUserInfo.EmployeeID;   //修改人ID
                        InfoObj.UPDATEUSERNAME    = Common.CurrentLoginUserInfo.EmployeeName; //修改人姓名
                        InfoObj.T_OA_CONTRACTTYPE = ent;

                        ContractManagement.UpdateContraTemplateAsync(InfoObj);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.SendException("保存Save函数", "OA", "T_OA_CONTRACTTEMPLATE", "保存时返回错误", ex, ExceptionLevel.Middle, ExceptionType.Error);
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("ERRORINFO"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
            }
        }