static void Main(string[] args)
        {
            //Shopping basket mock.
            Dictionary <int, int> basket = new Dictionary <int, int> //[product_code, quantity]
            {
                { 2414, 5 },
                { 124, 5 },
                { 5432, 11 }
            };

            var  orderFacade = new OrderFacade();
            bool isOrderSent = orderFacade.AcceptOrder(basket, PaymentType.BankTransferWesternUnion, DeliveryType.ExpressPackage_PHL, "Rzeszów, Sportowa 14A");

            Console.WriteLine("Order accepter (in Facade)");

            Console.Read();
        }
Example #2
0
        static void Main(string[] args)
        {
            IPayment    payment     = new Payment(PaymentType.Cash);
            IDelivery   delivery    = new Delivery(DeliveryType.PostOffice, "Gagarina street, 31, Dnipro, Ukraine");
            OrderFacade orderFacade = new OrderFacade(payment, delivery);

            orderFacade.AddGood("Phone");
            orderFacade.AddGood("Speakers");
            orderFacade.RemoveGood("Speakers");
            orderFacade.AddGood("Headphones");
            string id = orderFacade.PlaceOrder();

            Console.WriteLine($"Order №{id} will be delivered by adress");
            Console.WriteLine($"{delivery.Address} using {delivery.Type} type of delivery.");
            Console.WriteLine("Order goods:");
            Console.ReadLine();
        }
Example #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("-----------------------------------Facade Pattern-------------------------------------");
            OrderFacade order       = new OrderFacade();
            string      orderId     = "radio123"; //sample order id for this example
            string      orderStatus = order.checkStockAvailability(orderId);

            if (orderStatus == "available")
            {
                Console.WriteLine(string.Format("\nstock status: {0}", orderStatus));
                Console.WriteLine(string.Format("\nadd card status: {0}", order.addToCard(orderId)));
                Console.WriteLine(string.Format("\ncheckout order from card status: {0}", order.checkoutOrderFromCard(orderId)));
                order.placeOrder(orderId);
            }
            else
            {
                Console.WriteLine(string.Format("\nstock status: {0}", orderStatus));
            }
            Console.Write("\nPress any key to exist...");
            Console.ReadKey();
        }