Пример #1
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <returns></returns>
        private bool Save()
        {
            List <SMT.SaaS.FrameworkUI.Validator.ValidatorBase> validators = Group1.ValidateAll();

            if (validators.Count > 0)
            {
                return(false);
            }


            if (!string.IsNullOrEmpty(txtTerminateRemark.Text))
            {
                cancelLeave.REMARK = txtTerminateRemark.Text;
            }

            if (cancelLeave.STARTDATETIME == null || cancelLeave.ENDDATETIME == null)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CANCELLEAVEDATEREQUIRED"));
                return(false);
            }

            if (cancelLeave.LEAVEDAYS == null && cancelLeave.LEAVEHOURS == null)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CANCELLEAVEDATEREQUIRED"));
                return(false);
            }
            if (cancelLeave.LEAVEDAYS <= 0 && cancelLeave.LEAVEHOURS <= 0)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), "销假天数和销假时长不能读为0");
                return(false);
            }
            if (cancelLeave.TOTALHOURS <= 0)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), "销假总时长不能读为0");
                return(false);
            }
            if (FormType == FormTypes.New)
            {
                client.EmployeeCancelLeaveAddAsync(cancelLeave);
            }
            else
            {
                cancelLeave.UPDATEDATE   = System.DateTime.Now;
                cancelLeave.UPDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;

                client.EmployeeCancelLeaveUpdateAsync(cancelLeave);
            }

            return(true);
        }