Example #1
0
        public bool validate(EduLoan edu)
        {
            if (BusinessLogicUtil.validate(edu.CustomerID) == false)
            {
                throw new InvalidStringException("Invalid Customer ID");
            }

            if (edu.AmountApplied >= 2000001)
            {
                throw new InvalidAmountException("Maximum Education loan amount is Rs.20 lakh");
            }

            if (edu.RepaymentPeriod >= 11)
            {
                throw new InvalidRangeException("Repayment period can be maximum of 10 years");
            }

            if (Regex.IsMatch(edu.InstituteName, "[a-zA-Z,]$") == false)
            {
                throw new InvalidStringException("Institute name can contains alphabets and comma(,) only");
            }

            if (Regex.IsMatch(edu.StudentID, "[a-zA-Z0-9]$") == false)
            {
                throw new InvalidStringException("Student can consists of alphabets and digits only");
            }


            return(true);
        }
Example #2
0
        public bool validate(HomeLoan home)
        {
            if (BusinessLogicUtil.validate(home.CustomerID) == false)
            {
                throw new InvalidStringException("Invalid Customer ID");
            }

            if (home.AmountApplied >= 2000001)
            {
                throw new InvalidAmountException("Maximum loan amount is Rs.20 lakh");
            }

            if (home.RepaymentPeriod >= 16)
            {
                throw new InvalidRangeException("Repayment period can be maximum of 15 years");
            }

            if (home.SalaryDeductions >= home.GrossIncome)
            {
                throw new InvalidAmountException("Salary deduction can't be greater than or equal to Gross salary");
            }

            if (home.ServiceYears < 5)
            {
                throw new InvalidRangeException("Service experience must be minimum of 5 years");
            }

            return(true);
        }
Example #3
0
        public EduLoan GetLoanByLoanID_BL(string loanID)
        {
            if (BusinessLogicUtil.validate(loanID) == false)
            {
                throw new InvalidStringException("Invalid loan ID");
            }

            EduLoanDAL EduLoanDALobj = new EduLoanDAL();

            return(EduLoanDALobj.GetLoanByLoanID_DAL(loanID));
        }
Example #4
0
        public EduLoan ApproveLoanBL(string loanID, LoanStatus updatedStatus)
        {
            if (BusinessLogicUtil.validate(loanID) == false)
            {
                throw new InvalidStringException("Invalid loan ID");
            }

            EduLoanDAL EduLoanDALobj = new EduLoanDAL();

            return(EduLoanDALobj.ApproveLoanDAL(loanID, updatedStatus));
        }
Example #5
0
        public HomeLoan GetLoanByCustomerID_BL(string customerID)
        {
            if (BusinessLogicUtil.validate(customerID) == false)
            {
                throw new InvalidStringException("Invalid Customer ID");
            }

            HomeLoanDAL homeloanDALobj = new HomeLoanDAL();

            return(homeloanDALobj.GetLoanByCustomerID_DAL(customerID));
        }
Example #6
0
        public LoanStatus GetLoanStatusBL(string loanID)
        {
            if (BusinessLogicUtil.validate(loanID) == false)
            {
                throw new InvalidStringException("Invalid Loan ID");
            }

            HomeLoanDAL homeloanDALobj = new HomeLoanDAL();

            return(homeloanDALobj.GetLoanStatusDAL(loanID));
        }
Example #7
0
        public LoanStatus GetLoanStatusBL(string loanID)
        {
            if (BusinessLogicUtil.validate(loanID) == false)
            {
                throw new InvalidStringException("Invalid loan ID");
            }

            CarLoanDAL carDAL = new CarLoanDAL();

            return(carDAL.GetLoanStatusDAL(loanID));
        }
Example #8
0
        public CarLoan GetLoanByLoanID_BL(string loanID)
        {
            if (BusinessLogicUtil.validate(loanID) == false)
            {
                throw new InvalidStringException("Invalid loan ID");
            }

            CarLoanDAL CarDAL = new CarLoanDAL();

            return(CarDAL.GetLoanByLoanID_DAL(loanID));
        }
Example #9
0
        public CarLoan GetLoanByCustomerID_BL(string customerID)
        {
            if (BusinessLogicUtil.validate(customerID) == false)
            {
                throw new InvalidStringException("Invalid customer ID");
            }

            CarLoanDAL carDAL = new CarLoanDAL();

            return(carDAL.GetLoanByCustomerID_DAL(customerID));
        }
Example #10
0
        public CarLoan ApproveLoanBL(string loanID, LoanStatus updatedStatus)
        {
            if (BusinessLogicUtil.validate(loanID) == false)
            {
                throw new InvalidStringException("Invalid loan ID");
            }

            CarLoanDAL carDAL = new CarLoanDAL();

            return(carDAL.ApproveLoanDAL(loanID, updatedStatus));
        }
Example #11
0
        public bool ApplyLoanBL(HomeLoan home)
        {
            //HomeLoan home = (HomeLoan)(Object)obj;
            if (validate(home) == true)
            {
                home.LoanID            = "HOME" + BusinessLogicUtil.SystemDateToString();
                home.InterestRate      = 8.50;
                home.EMI_Amount        = BusinessLogicUtil.ComputeEMI(home.AmountApplied, home.RepaymentPeriod, home.InterestRate);
                home.DateOfApplication = DateTime.Now;
                home.Status            = (LoanStatus)0; // APPLIED

                HomeLoanDAL homeDAL = new HomeLoanDAL();
                return(homeDAL.ApplyLoanDAL(home));
            }
            return(false);
        }
Example #12
0
        public bool ApplyLoanBL(CarLoan car)
        {
            //CarLoan car = (CarLoan)(Object)obj;
            if (validate(car) == true)
            {
                car.LoanID            = "CAR" + BusinessLogicUtil.SystemDateToString();
                car.InterestRate      = 10.65;
                car.EMI_Amount        = BusinessLogicUtil.ComputeEMI(car.AmountApplied, car.RepaymentPeriod, car.InterestRate);
                car.DateOfApplication = DateTime.Now;
                car.Status            = (LoanStatus)0;

                CarLoanDAL carDAL = new CarLoanDAL();
                return(carDAL.ApplyLoanDAL(car));
            }
            return(false);
        }
Example #13
0
        public bool ApplyLoanBL(EduLoan edu)
        {
            //EduLoan edu = (EduLoan)(Object)obj;
            if (validate(edu) == true)
            {
                edu.LoanID            = "EDU" + BusinessLogicUtil.SystemDateToString();
                edu.InterestRate      = 10.65;
                edu.EMI_Amount        = BusinessLogicUtil.ComputeEMI(edu.AmountApplied, edu.RepaymentPeriod, edu.InterestRate);
                edu.DateOfApplication = DateTime.Now;
                edu.Status            = (LoanStatus)0;
                edu.RepaymentHoliday  = 1;

                EduLoanDAL eduDAL = new EduLoanDAL();
                return(eduDAL.ApplyLoanDAL(edu));
            }
            return(false);
        }
Example #14
0
        public bool validate(CarLoan car)
        {
            if (BusinessLogicUtil.validate(car.CustomerID) == false)
            {
                throw new InvalidStringException("Invalid Customer ID");
            }

            if (car.AmountApplied >= 2000001)
            {
                throw new InvalidAmountException("Maximum loan amount is Rs.20 lakh");
            }

            if (car.RepaymentPeriod >= 11)
            {
                throw new InvalidRangeException("Repayment period can be maximum of 10 years");
            }

            if (car.SalaryDeductions >= car.GrossIncome)
            {
                throw new InvalidAmountException("Salary deduction can't be greater than or equal to Gross salary");
            }

            return(true);
        }