Esempio n. 1
0
        private void Save()
        {
            try
            {
                if (licenseObj.T_OA_LICENSEMASTER == null)
                {
                    this.txtLicenseName.Text = "";
                    //HtmlPage.Window.Alert("请先选择证照!");
                    Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("SELECTFIRST", "LICENSE"));
                    return;
                }
                if (licenseObj.STARTDATE == null)
                {
                    Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "LENDTIME"));
                    return;
                }
                if (licenseObj.ENDDATE == null)
                {
                    Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "EXPECTEDRETURNTIME"));
                    return;
                }
                if (Convert.ToDateTime(licenseObj.STARTDATE) > Convert.ToDateTime(licenseObj.ENDDATE))
                {
                    //HtmlPage.Window.Alert("预订归还时间不能早于借阅时间!");
                    //this.txtTitle.Focus();
                    Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("DATEERROR", "LENDTIME,EXPECTEDRETURNTIME"));
                    return;
                }
                if (string.IsNullOrEmpty(licenseObj.CONTENT))
                {
                    //HtmlPage.Window.Alert("请先填写借阅用途!");
                    Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "PURPOSE"));
                    return;
                }
                RefreshUI(RefreshedTypes.ShowProgressBar);
                if (action == Action.Add)  //新增
                {
                    licenseObj.LICENSEUSERID = Guid.NewGuid().ToString();
                    licenseObj.CHECKSTATE    = ((int)CheckStates.UnSubmit).ToString();

                    licenseObj.CREATEUSERID       = Common.CurrentLoginUserInfo.EmployeeID;
                    licenseObj.CREATEUSERNAME     = Common.CurrentLoginUserInfo.EmployeeName;
                    licenseObj.CREATEPOSTID       = Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                    licenseObj.CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                    licenseObj.CREATECOMPANYID    = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                    licenseObj.CREATEDATE         = DateTime.Now;

                    licenseObj.OWNERID           = Common.CurrentLoginUserInfo.EmployeeID;
                    licenseObj.OWNERNAME         = Common.CurrentLoginUserInfo.EmployeeName;
                    licenseObj.OWNERPOSTID       = Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                    licenseObj.OWNERDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                    licenseObj.OWNERCOMPANYID    = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;

                    licenseObj.HASRETURN = "0";
                    client.AddLicenseBorrowAsync(licenseObj, "Add");
                }
                else    //修改
                {
                    //licenseObj.LENDERID = "admin";
                    licenseObj.UPDATEDATE     = DateTime.Now;
                    licenseObj.UPDATEUSERID   = Common.CurrentLoginUserInfo.EmployeeID;
                    licenseObj.UPDATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName;
                    licenseObj.CHECKSTATE     = "0";
                    client.UpdateLicenseBorrowAsync(licenseObj, "Edit");
                }
            }
            catch (Exception ex)
            {
                RefreshUI(RefreshedTypes.HideProgressBar);
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), ex.Message.ToString());
            }
        }