コード例 #1
0
        public ActionResult Deactivation(GovernmentFundsViewModel GovernmentFundsVM)
        {
            GovernmentFundsBLL GovernmentFundBLL = new GovernmentFundsBLL();

            GovernmentFundBLL.GovernmentFundID             = GovernmentFundsVM.GovernmentFundID;
            GovernmentFundBLL.LetterDate                   = GovernmentFundsVM.LetterDate;
            GovernmentFundBLL.LetterNo                     = GovernmentFundsVM.LetterNo;
            GovernmentFundBLL.Notes                        = GovernmentFundsVM.Notes;
            GovernmentFundBLL.DeactiveDate                 = GovernmentFundsVM.DeactiveDate;
            GovernmentFundBLL.DeductionStartDate           = GovernmentFundsVM.DeductionStartDate;
            GovernmentFundBLL.GovernmentFundDeactiveReason = GovernmentFundsVM.GovernmentFundDeactiveReason;
            GovernmentFundBLL.LoginIdentity                = UserIdentity;

            Result result = GovernmentFundBLL.Deactivate();

            if (result.EnumMember == GovernmentFundsValidationEnum.RejectedBecauseOfBeforeHiringDate.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationBeforeHiringText.ToString());
            }
            else if (result.EnumMember == GovernmentFundsValidationEnum.RejectedBecauseOfDeactivationDateShouldNotBeLessThanDeductionStartDate.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationBeforeDeductionStartDateText.ToString());
            }
            else if (result.EnumMember == GovernmentFundsValidationEnum.RejectedBecauseOfAlreadyDeactivated.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationAlreadyDeactivatedText.ToString());
            }
            else if (result.EnumMember == GovernmentFundsValidationEnum.RejectedBecauseOfMonthlyDeductionAmountShouldNotGreaterThanTotalDeductionAmount.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationDeductionAmountShouldNotGreaterThenTotalDeductionAmountText);
            }

            return(Json(new { GovernmentFundID = GovernmentFundBLL.GovernmentFundID }, JsonRequestBehavior.AllowGet));
        }