Esempio n. 1
0
        public bool IsEligible(Customer cust, int amount)
        {
            Console.WriteLine("{0} applies for {1:C} loan\n",

              cust.Name, amount);

            bool eligible = true;

            // Check creditworthyness of applicant
            if (!_bank.HasSufficientSavings(cust, amount))
            {
                eligible = false;
            }

            else if (!_loan.HasNoBadLoans(cust))
            {
                eligible = false;
            }

            else if (!_credit.HasGoodCredit(cust))
            {
                eligible = false;
            }

            return eligible;
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var loanFacade = new LoanFacade();
            var customer = new Customer();

            Console.WriteLine("Load is approved: " + loanFacade.IsLoanForCustomerApproved(customer));
        }
Esempio n. 3
0
        static void Main()
        {
            // Facade
            Mortgage mortgage = new Mortgage();

            // Evaluate mortgage eligibility for customer
            Customer customer = new Customer("Ann McKinsey");

            bool eligible = mortgage.IsEligible(customer, 125000);

            Console.WriteLine("\n" + customer.Name +
                " has been " + (eligible ? "Approved" : "Rejected"));

            // Wait for user
            Console.ReadKey();
        }
Esempio n. 4
0
        public bool HasGoodCredit(Customer customer)
        {
            Console.WriteLine("Check credit for " + customer.Name);

            return true;
        }
Esempio n. 5
0
        public bool HasSufficientSavings(Customer customer, int amount)
        {
            Console.WriteLine("Check bank for " + customer.Name);

            return true;
        }
Esempio n. 6
0
 public bool HasNoBadLoans(Customer c)
 {
     Console.WriteLine("Check loans for " + c.Name);
     return true;
 }