Example #1
0
        /// <summary>
        /// 保存
        /// </summary>
        private void Save()
        {
            try
            {
                if (string.IsNullOrEmpty(this.txtTitle.Text.Trim()))
                {
                    //HtmlPage.Window.Alert("档案标题不能为空!");
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("SELECTFIRST", "ARCHIVE"));
                    return;
                }
                if (string.IsNullOrEmpty(sDate.SelectedDate.ToString()))
                {
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "LENDTIME"));
                    return;
                }
                if (string.IsNullOrEmpty(eDate.SelectedDate.ToString()))
                {
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "EXPECTEDRETURNTIME"));
                    return;
                }
                if (Convert.ToDateTime(sDate.SelectedDate.ToString()) > Convert.ToDateTime(eDate.SelectedDate.ToString()))
                {
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("DATEGREATERERROR", "LENDTIME,EXPECTEDRETURNTIME"));
                    return;
                }
                RefreshUI(RefreshedTypes.ShowProgressBar);


                //lendingArchives.T_OA_ARCHIVES = archiveLending.archives;
                //lendingArchives.T_OA_ARCHIVES.ARCHIVESID = archiveLending.archives.ARCHIVESID;
                //lendingArchives.USERID = Common.CurrentLoginUserInfo.EmployeeID;  //是否要从组织架构里选
                lendingArchives.STARTDATE   = Convert.ToDateTime(this.sDate.SelectedDate);
                lendingArchives.PLANENDDATE = Convert.ToDateTime(this.eDate.SelectedDate);
                if (action == Action.Add)
                {
                    lendingArchives.LENDARCHIVESID     = System.Guid.NewGuid().ToString();
                    lendingArchives.CREATEUSERID       = Common.CurrentLoginUserInfo.EmployeeID;
                    lendingArchives.CREATEUSERNAME     = Common.CurrentLoginUserInfo.EmployeeName;
                    lendingArchives.CREATEPOSTID       = Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                    lendingArchives.CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                    lendingArchives.CREATECOMPANYID    = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                    lendingArchives.OWNERID            = Common.CurrentLoginUserInfo.EmployeeID;
                    lendingArchives.OWNERNAME          = Common.CurrentLoginUserInfo.EmployeeName;
                    lendingArchives.OWNERPOSTID        = Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                    lendingArchives.OWNERDEPARTMENTID  = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                    lendingArchives.OWNERCOMPANYID     = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                    lendingArchives.CREATEDATE         = DateTime.Now;
                    lendingArchives.CHECKSTATE         = Utility.GetCheckState(CheckStates.UnSubmit);
                    client.AddArchivesLendingAsync(lendingArchives, "Add");
                }
                else
                {
                    lendingArchives.UPDATEUSERID = Common.CurrentLoginUserInfo.EmployeeID;
                    lendingArchives.CHECKSTATE   = "0";
                    lendingArchives.UPDATEDATE   = DateTime.Now;

                    lendingArchives.UPDATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName;
                    client.UpdateArchivesLendingAsync(lendingArchives, "Edit");
                }
            }
            catch (Exception ex)
            {
                RefreshUI(RefreshedTypes.HideProgressBar);
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), ex.Message.ToString());
            }
        }