static void Main(string[] args) { #region 正常模式 //Bank bank = new Bank(); //Loan loan = new Loan(); //Credit credit = new Credit(); //Customer customer = new Customer("Ann McKinsey"); //bool eligible = true; //if (!bank.HasSufficientSavings(customer, _amount)) //{ // eligible = false; //} //else if (!loan.HasNoBadLoans(customer)) //{ // eligible = false; //} //else if (!credit.HasGoodCredit(customer)) //{ // eligible = false; //} //Console.WriteLine("\n" + customer.Name + " has been " + (eligible ? "Approved" : "Rejected")); //Console.ReadLine(); #endregion #region 外观者模式 Mortgage mortgage = new Mortgage(); Customer customer = new Customer("Ann McKinsey"); bool eligable = mortgage.IsEligible(customer, 125000); Console.WriteLine("\n" + customer.Name + " has been " + (eligable ? "Approved" : "Rejected")); Console.ReadLine(); #endregion }
static void Main(string[] args) { IAcelerador acelerador = new Acelerador(); IEmbrague embrague = new Embrague(); IPalancaCambios palancaCambios = new PalancaCambios(); Centralita centralita = new Centralita(embrague, acelerador, palancaCambios); centralita.AumentarMarcha(); Console.WriteLine("\n ----- ------ -------"); // 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")); Console.ReadKey(); }
static void Main(string[] args) { Mortgage mortgage = new Mortgage(); Customer customer = new Customer("Duyen"); bool eligible = mortgage.IsEligible(customer, 125000); Console.WriteLine("Customer {0} has been {1}", customer.Name, (eligible ? "Approved" : "Denied")); }
private static void Main(string[] args) { var customer = new Customer("John", 12341, false, true, 4500); var isEligible = Mortgage.IsEligible(customer); Console.WriteLine($"{customer.Name} is {(isEligible ? "Eligible" : "Not Eligible")}"); }
static void Main(string[] args) { Customer cust = new Customer("NotMe"); Mortgage mortgage = new Mortgage(); bool eligible = mortgage.IsEligible(cust, 1000); Console.WriteLine("\n" + cust.Name + "has been " + (eligible? "Approved" : "Rejected")); }
static void Main(string[] args) { var customer = new Customer("Roman"); var mortgage = new Mortgage(new Bank(), new Loan()); Console.WriteLine(mortgage.IsEligible(customer, 1000) ? $"Mortgage approved for {customer}" : $"Mortgage rejected {customer}"); }
public static void Run() { Console.WriteLine("Facade Real World Practice"); Mortgage mortgage = new Mortgage(); Customer customer = new Customer("Ann McKinsey"); bool eligible = mortgage.IsEligible(customer, 125000); Console.WriteLine("\n" + customer.Name + " has been " + (eligible ? "Approved" : "Rejected")); }
static void Main(string[] args) { Mortgage mortgage = new Mortgage(); Customer customer = new Customer("Ann McKinsey"); bool eligible = mortgage.IsEligible(customer, 125000); Console.WriteLine("\n" + customer.Name + " has been " + (eligible ? "Approved" : "Rejected")); Console.ReadKey(); }
static void Main(string[] args) { var user = new User("Ivan"); var mortgage = new Mortgage(); var result = mortgage.IsEligible(user); Console.WriteLine(result ? "Ok" : "Nooo"); Console.ReadKey(); }
public static void Main() { var customer = new Customer("John"); var mortgage = new Mortgage(); bool eligible = mortgage.IsEligible(customer, 125000); Console.WriteLine($"\n {customer.Name} has been {(eligible ? "Approved" : "Rejected")}"); Console.ReadKey(); }
public 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(customer.Name + " has been " + (eligible ? "Approved" : "Rejected")); }
static void Main(string[] args) { //Facade Mortgage mortgage = new Mortgage(); Customer customer = new Customer("George Tobias"); bool eligible = mortgage.IsEligible(customer, 125000); Console.WriteLine("\n {0} has been {1}", customer.Name, eligible ? "Approved" : "Rejected"); Console.ReadKey(); }
static void Main(string[] args) { Mortgage mortgage = new Mortgage(); // Evalua eligibilidad del cliente Customer customer = new Customer("Anna Montenegro"); bool eligible = mortgage.IsEligible(customer, 125000); Console.WriteLine("\nPréstamo para: " + customer.Name + ", ha sido " + (eligible ? "Aprobado" : "Rechazado")); Console.ReadKey(); }
static void Main(string[] args) { //instansiate facade class Mortgage mortgage = new Mortgage(); Customer customer = new Customer("hesam darbandi"); bool eligible = mortgage.IsEligible(customer, 125000); Console.WriteLine("\n" + customer.Name + " has been " + (eligible ? "Approved" : "Rejected")); // Wait for user Console.ReadKey(); }
static void Main(string[] args) { // 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(); }
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(); }
static void Main(string[] args) { //Separate the construction of a complex object from its representation so that the same //construction process can create different representations. 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(); }
/// <resumen> /// Punto de entrada en la aplicación de consola. /// </resumen> static void Main(string[] args) { // Fachada Mortgage mortgage = new Mortgage(); // Evaluar la elegibilidad de la hipoteca para el cliente Customer customer = new Customer("Ann McKinsey"); bool eligible = mortgage.IsEligible(customer, 125000); Console.WriteLine("\n" + customer.Name + " ha sido " + (eligible ? "Aprobado" : "Rechazado")); // Espera al usuario Console.ReadKey(); }
public static void Run() { Console.WriteLine("\nThis real-world code demonstrates the Facade pattern as a MortgageApplication object which provides a simplified interface to a large subsystem of classes measuring the creditworthyness of an applicant."); Mortgage mortgage = new Mortgage(); Customer customer = new Customer("Ann McKinsey"); bool eligible = mortgage.IsEligible(customer, 125000); Console.WriteLine("\n" + customer.Name + " has been " + (eligible ? "Approved" : "Rejected")); /* * Ann McKinsey applies for $125,000.00 loan * * Check bank for Ann McKinsey * Check loans for Ann McKinsey * Check credit for Ann McKinsey * * Ann McKinsey has been Approved */ }