Example #1
0
        public ActionResult Edit(GovernmentFundsViewModel GovernmentFundsVM)
        {
            GovernmentFundsBLL GovernmentFundBLL = new GovernmentFundsBLL();

            GovernmentFundBLL.GovernmentFundID = GovernmentFundsVM.GovernmentFundID;
            GovernmentFundBLL.EmployeeCode     = new EmployeesCodesBLL()
            {
                EmployeeCodeID = GovernmentFundsVM.EmployeeCodeID
            };
            GovernmentFundBLL.GovernmentDeductionType = GovernmentFundsVM.GovernmentDeductionType;
            GovernmentFundBLL.GovernmentFundType      = GovernmentFundsVM.GovernmentFundType;
            GovernmentFundBLL.LoanNo                 = GovernmentFundsVM.LoanNo;
            GovernmentFundBLL.LoanDate               = GovernmentFundsVM.LoanDate;
            GovernmentFundBLL.DeductionStartDate     = GovernmentFundsVM.DeductionStartDate;
            GovernmentFundBLL.MonthlyDeductionAmount = GovernmentFundsVM.MonthlyDeductionAmount;
            GovernmentFundBLL.TotalDeductionAmount   = GovernmentFundsVM.TotalDeductionAmount;
            GovernmentFundBLL.ContractNo             = GovernmentFundsVM.ContractNo;
            GovernmentFundBLL.BankIPAN               = GovernmentFundsVM.BankIPAN;
            GovernmentFundBLL.KSACity                = new KSACitiesBLL()
            {
                KSACityID = GovernmentFundsVM.KSACity.KSACityID
            };
            GovernmentFundBLL.SponserToIDNo = GovernmentFundsVM.SponserToIDNo;
            GovernmentFundBLL.SponserToName = GovernmentFundsVM.SponserToName;
            GovernmentFundBLL.LoginIdentity = UserIdentity;


            Result result = GovernmentFundBLL.Update();

            if (result.EnumMember == GovernmentFundsValidationEnum.RejectedBecauseOfBeforeHiringDate.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationBeforeHiringText.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));
        }