Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            // Without Facade
            InventorySubSystem inv       = new InventorySubSystem();
            MarketingSubSystem mkting    = new MarketingSubSystem();
            List <item>        inventory = new List <item> {
            };
            string result = "Results:\n";

            inventory.AddRange(inv.GetInventoryForLocation("Dallas"));
            inventory.AddRange(inv.GetInventoryForLocation("New York"));
            foreach (item item in inventory)
            {
                if (!inv.ItemIsAvailable(item))
                {
                    continue;
                }
                item.ModelNumber = inv.GetModelNumberForSerialNumber(item.Serial);
                item.Photo       = mkting.GetPhotoForModelNumber(item.ModelNumber);
                item.Price       = mkting.GetPriceForModelNumber(item.ModelNumber);
                result          += item.ModelNumber + ", " + item.Photo + ", $" + item.Price + "\n";
            }
            Console.WriteLine(result);

            // With Facade
            Facade facade = new Facade();

            facade.printAvailableProducts();
        }
Ejemplo n.º 2
0
 public Facade()
 {
     inv    = new InventorySubSystem();
     mkting = new MarketingSubSystem();
 }