Пример #1
0
        public static void EShopDemo(decimal amount)
        {
            var basket = new EShopBasket();

            basket.SetDueAmount(amount);

            Console.WriteLine("How would you like to pay? \n1) Credit/Debit card, \n2) Bank Transfer, \n3) Cash \nDefault: Cash ");
            var paymentType = 10;

            paymentType = ValidatingNumberTypeInput();
            ValidPaymentTypeCheck(paymentType);


            Console.WriteLine("Please select the shipment method : 1) PostOffice, 2) Courier, 3) Own, 4) Pickup:");
            var carrierType = (CarrierType)10;

            carrierType = (CarrierType)ValidatingNumberTypeInput();
            ValidCarrierTypeCheck(carrierType);

            Console.WriteLine();

            Console.WriteLine("Please give your address:");
            var address = Console.ReadLine().Trim();

            Console.WriteLine();

            ConfirmingAddress(basket, paymentType, carrierType, address);
        }
Пример #2
0
        //Messages to user

        private static void ConfirmingAddress(EShopBasket basket, int paymentType, CarrierType carrierType, string address)
        {
            var simpleEshop = new SimpleEshop();
            var success     = simpleEshop.PayAndSendOrder(basket, paymentType, address, carrierType);

            Console.Write("Checking the address...");
            Console.Write("Checking with the system...  ");
            Console.WriteLine("Loading...  ");
            Thread.Sleep(2000);



            Console.WriteLine("Is the address correct?  ");
            Console.WriteLine(success);
            Console.WriteLine("Your order is complete!");
            Console.WriteLine();
            Console.WriteLine("Note that our future features you will be able to receive a comfirmation email with your order! \nThank you for shopping with us!");
            Console.WriteLine();
        }
Пример #3
0
        public bool PayAndSendOrder(EShopBasket basket, int paymentMethod, string address, CarrierType carrierType)
        {
            var  payments = new Payments();
            bool success  = payments.PayBasket(basket, paymentMethod);

            if (success)
            {
                if (carrierType != CarrierType.Pickup)
                {
                    var shipment = new Shipment();
                    if (shipment.CanShipTo(address, carrierType))
                    {
                        shipment.DeliverOrder(address, basket);
                    }
                    else
                    {
                        success = false;
                    }
                }
            }

            return(success);
        }
Пример #4
0
 public void DeliverOrder(string address, EShopBasket basket)
 {
     Console.WriteLine("Deliver order to address: " + address);
 }