コード例 #1
0
        static void Main(string[] args)
        {
            Facade facade = new Facade();

            Customer customer = new Customer("Nelson Rodrigues");

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

            Console.WriteLine("\n" + customer.Name + " has been " + (eligible ? " Approved" : " Rejected"));
        }
コード例 #2
0
        public bool IsEligible(Customer cust, int amout)
        {
            Console.WriteLine(" {0} applies for {1:C} loan\n", cust.Name, amout );

            bool eligible = true;

            if (!_bank.HasSufficientSavings(cust, amout))
            {
                eligible = false;
            }
            else if (!_Loan.HasNoBadLoans(cust))
            {
                eligible = false;
            }
            else if (!_credit.HasGoodCredit(cust))
            {
                eligible = false;
            }

            return eligible;
        }
コード例 #3
0
 public bool HasGoodCredit(Customer c)
 {
     Console.WriteLine("Check credit for " + c.Name);
     return true;
 }
コード例 #4
0
ファイル: Loan.cs プロジェクト: NelsonBilber/Design-Patterns
 public bool HasNoBadLoans(Customer c)
 {
     Console.WriteLine("Check loans for " + c.Name);
     return true;
 }
コード例 #5
0
ファイル: Bank.cs プロジェクト: NelsonBilber/Design-Patterns
 public bool HasSufficientSavings(Customer c, int amount)
 {
     Console.WriteLine("Check bank for " + c.Name);
     return true;
 }