Exemple #1
0
        public bool HasSufficentSavings(Customer customer,double amount)
        {
            Console.WriteLine("# Checking {0} {1}s bank funds.",
            customer.FirstName,
            customer.LastName);

            return true;
        }
Exemple #2
0
        public bool HasGoodCredit(Customer customer)
        {
            Console.WriteLine("# Checking the credit for {0} {1}.", 
                customer.FirstName, 
                customer.LastName);

            return true;
        }
Exemple #3
0
        public bool HasNoBadLoans(Customer customer)
        {
            Console.WriteLine("# Checking if {0} {1} has any bad loans.",
                customer.FirstName,
                customer.LastName);

            return true;
        }
Exemple #4
0
        static void Main(string[] args)
        {
            //Testar uppkopplingen mot GitHub
            // MorgageEligibility
            // Facade
            var mortgage = new Mortgage();

            var customer = new Customer("BO", "LEANDERSON");
            var amount = 125000.0;

            //Invoke the facade and the facade invokes all of it's subsystem.
            var isEligible = mortgage.IsEligible(customer, amount);

            System.Console.WriteLine(
                "=> {0} {1}s application for a loan of {2} has been {3}.",
                customer.FirstName,
                customer.LastName,
                amount,
                (isEligible ? "approved" : "rejected"));

            System.Console.ReadLine();

        }
Exemple #5
0
        static void Main(string[] args)
        {
            // MortgageEligibility
            // Facade

            var mortgage = new Mortgage();

            var customer = new Customer("Harry", "Hederlig");
            var amount = 125000.0;

            // Invoke the facade and the facade invokes all of it´s subsystems.
            var isEligible = mortgage.IsEligible(customer, amount);

            System.Console.WriteLine(
                "=> {0}{1}s application for loan of {2} has been {3}.",
                customer.FirstName,
                customer.LastName,
                amount,
                (isEligible ? "approved" : "rejected"));

            System.Console.ReadLine();


        }
Exemple #6
0
        public bool IsEligible(Customer customer, double amount)
        {
            Console.WriteLine(
                "{0} {1} is applying for a {2:C} loan.",
                customer.FirstName,
                customer.LastName, amount);

            var isEigible = true;
 
            if (!bank.HasSufficientSavings(customer, amount))
            {
                isEigible = false;
            }
            else if (!loan.HasNoBadLoans(customer))
            {
                isEigible = false;
            }
            else if (!credit.HasGoodCredit(customer))
            {
                isEigible = false;
            }

            return isEigible;
        }