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)); }
public ActionResult Delete(GovernmentFundsViewModel GovernmentFundsVM) { try { GovernmentFundsBLL governmentFundBLL = new GovernmentFundsBLL(); governmentFundBLL.LoginIdentity = UserIdentity; governmentFundBLL.Remove(GovernmentFundsVM.GovernmentFundID); return(RedirectToAction("Index")); } catch { return(View()); } }
private GovernmentFundsViewModel GetByGovernmentFundID(int id) { GovernmentFundsBLL GovernmentFundBLL = new GovernmentFundsBLL().GetByGovernmentFundID(id); GovernmentFundsViewModel GovernmentFundVM = new GovernmentFundsViewModel(); if (GovernmentFundBLL != null) { GovernmentFundVM.GovernmentFundID = GovernmentFundBLL.GovernmentFundID; GovernmentFundVM.EmployeeCodeID = GovernmentFundBLL.EmployeeCode.EmployeeCodeID; GovernmentFundVM.LoanNo = GovernmentFundBLL.LoanNo; GovernmentFundVM.LoanDate = GovernmentFundBLL.LoanDate; GovernmentFundVM.DeductionStartDate = GovernmentFundBLL.DeductionStartDate; GovernmentFundVM.MonthlyDeductionAmount = GovernmentFundBLL.MonthlyDeductionAmount; GovernmentFundVM.TotalDeductionAmount = GovernmentFundBLL.TotalDeductionAmount; GovernmentFundVM.RemainingDeductionAmount = GovernmentFundBLL.RemainingDeductionAmount; GovernmentFundVM.EmployeeCode = GovernmentFundBLL.EmployeeCode; GovernmentFundVM.GovernmentFundType = GovernmentFundBLL.GovernmentFundType; GovernmentFundVM.GovernmentDeductionType = GovernmentFundBLL.GovernmentDeductionType; GovernmentFundVM.ContractNo = GovernmentFundBLL.ContractNo; GovernmentFundVM.BankIPAN = GovernmentFundBLL.BankIPAN; GovernmentFundVM.GovernmentFundDeactiveReason = GovernmentFundBLL.GovernmentFundDeactiveReason; if (GovernmentFundBLL.KSACity != null) { GovernmentFundVM.KSACity = new KSACitiesBLL() { KSACityID = GovernmentFundBLL.KSACity.KSACityID, KSACityName = GovernmentFundBLL.KSACity.KSACityName }; } GovernmentFundVM.SponserToIDNo = GovernmentFundBLL.SponserToIDNo; GovernmentFundVM.SponserToName = GovernmentFundBLL.SponserToName; GovernmentFundVM.CreatedDate = GovernmentFundBLL.CreatedDate; GovernmentFundVM.CreatedBy = GovernmentFundVM.GetCreatedByDisplayed(GovernmentFundBLL.CreatedBy); GovernmentFundVM.IsActive = GovernmentFundBLL.IsActive; GovernmentFundVM.LetterDate = GovernmentFundBLL.LetterDate; GovernmentFundVM.LetterNo = GovernmentFundBLL.LetterNo; GovernmentFundVM.Notes = GovernmentFundBLL.Notes; GovernmentFundVM.DeactiveDate = GovernmentFundBLL.DeactiveDate; GovernmentFundVM.EmployeeVM = new EmployeesViewModel() { EmployeeCodeID = GovernmentFundBLL.EmployeeCode.EmployeeCodeID, EmployeeCodeNo = GovernmentFundBLL.EmployeeCode.EmployeeCodeNo, EmployeeNameAr = GovernmentFundBLL.EmployeeCode.Employee.EmployeeNameAr, EmployeeIDNo = GovernmentFundBLL.EmployeeCode.Employee.EmployeeIDNo, }; } return(GovernmentFundVM); }
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)); }