Esempio n. 1
0
 private void SetProperties()
 {
     try
     {
         LoanGatewayFactory factory = new LoanGatewayFactory();
         gateway          = factory.CreateLoanGateway(SelectedLoanTypes);
         MaxAmount        = gateway.MaxAmount;
         MaxNumberOfYears = gateway.MaxNumberOfYears;
         if (NumberOfYears > MaxNumberOfYears)
         {
             NumberOfYears = MaxNumberOfYears;
         }
     }
     catch (Exception ex) { log.Error(ex); throw ex; }
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 private void ApplyProposal()
 {
     try
     {
         if (Amount <= 0)
         {
             Plan = null;
             return;
         }
         Proposal proposal = new Proposal()
         {
             Amount        = this.Amount,
             NumberOfYears = this.NumberOfYears,
             TypeOfLoan    = SelectedLoanTypes
         };
         LoanGatewayFactory factory = new LoanGatewayFactory();
         gateway = factory.CreateLoanGateway(proposal.TypeOfLoan);
         Plan    = gateway.GetPlan(proposal);
     }
     catch (Exception ex) { log.Error(ex); throw ex; }
 }