public bool ApplyLoanDAL(CarLoan car) { //CarLoan car = (CarLoan)(object)obj; List <CarLoan> loanList = DeserializeFromJSON("CarLoans.txt"); loanList.Add(car); return(SerializeIntoJSON(loanList, "CarLoans.txt")); }
public double CalculateCarLoanRate(CarLoan carLoan) { double rate = 12.5F; bool isEligible = eligibilityChecker.IsApplicantEligible(carLoan); if (isEligible) { rate = rate - carLoan.DiscountFactor; } return(rate); }
public static void Main(string[] args) { CarLoan carLoan = new CarLoan(); bool isEligibleCarLoan = carLoan.IsEligible(false, false, true); Console.WriteLine("Car Loan Application Status = {0}", isEligibleCarLoan); MortgageLoan mortgageLoan = new MortgageLoan(); bool isEligibleMortgageLoan = mortgageLoan.IsEligible(false, false, true); Console.WriteLine("Mortgage Loan Application Status = {0}", isEligibleMortgageLoan); }
static void Main() { Loan aLoan = new Loan(333, "Hanson", 7000.00); CarLoan aCarLoan = new CarLoan(444, "Carlisle", 30000.00, 2011, "BMW"); Console.WriteLine("Loan #{0} for {1} is for {2}", aLoan.LoanNumber, aLoan.LastName, aLoan.LoanAmount.ToString("C2")); Console.WriteLine("Loan #{0} for {1} is for {2}", aCarLoan.LoanNumber, aCarLoan.LastName, aCarLoan.LoanAmount.ToString("C2")); Console.WriteLine("Loan #{0} is for a {1} {2}", aCarLoan.LoanNumber, aCarLoan.Year, aCarLoan.Make); Console.Read(); }
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); }
public CarLoan ApproveLoanDAL(string loanID, LoanStatus updatedStatus) { List <CarLoan> carLoans = DeserializeFromJSON("CarLoans.txt"); CarLoan objToReturn = new CarLoan(); foreach (var Loan in carLoans) { if (Loan.LoanID == loanID) { Loan.Status = updatedStatus; objToReturn = Loan; break; } } SerializeIntoJSON(carLoans, "CarLoans.txt"); return(objToReturn); }
public virtual ILoanGateway CreateLoanGateway(LoanType type) { ILoanGateway gateway = null; switch (type) { case LoanType.Car: gateway = new CarLoan(); break; case LoanType.House: gateway = new HousingLoan(); break; default: break; } return(gateway); }
static void Main() { Loan aLoan = new Loan(); aLoan.LoanNumber = 2239; aLoan.LastName = "Mitchell"; aLoan.LoanAmount = 1_000.00; WriteLine(aLoan); CarLoan aCarLoan = new CarLoan(); aCarLoan.LoanNumber = 3358; aCarLoan.LastName = "Jansen"; aCarLoan.LoanAmount = 20_000.00; aCarLoan.Year = 2007; aCarLoan.Make = "Ford"; WriteLine(aCarLoan); }
public ILoan Create(LoanType loanType) { ILoan loan = null; switch (loanType) { case LoanType.HomeLoan: loan = new HomeLoan(); break; case LoanType.CarLoan: loan = new CarLoan(); break; case LoanType.PersonalLoan: loan = new PersonalLoan(); break; default: break; } return(loan); }
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); }