Beispiel #1
0
        public void Pay()
        {
            CalculateTotal();
            TotalOrder = Math.Round(TotalOrder, 2);

            var header = new HeaderBar(64);

            header.DrawCheckout(this);

            // Console.WriteLine($"Your grand total is: {TotalOrder}");
            while (true)
            {
                Console.WriteLine($"How would you like to pay for your order? Please select options 1-3: \n1 - Cash, 2 - Credit/Debit, 3 - Check");
                //*** Maybe no need for Enum Payment Type, just ask for an int and switch  should follow?***

                var paymentType = int.TryParse(Console.ReadLine(), out int result);



                //while (!int.TryParse(Console.ReadLine(), out int PaymentType))
                //{
                //    Console.WriteLine("Invalid Option, try again.");
                //    paymentType = Console.ReadLine();
                //}
                PaymentType = result;
                switch (result)
                {
                case 1:
                    PayCash();
                    return;

                case 2:
                    PayCredit();
                    return;

                case 3:
                    PayCheck();
                    return;

                default:
                    Console.WriteLine("Unknown Payment Type.");
                    break;
                }
                Console.Write("Input error: Please try again: ");
            }
        }
Beispiel #2
0
        public void Pay()
        {
            if (OrderList.Count == 0)
            {
                Console.WriteLine("Nothing in cart! Returning to main menu: ");
                Console.ReadKey();
                return;
            }

            CalculateTotal();
            TotalOrder = Math.Round(TotalOrder, 2);

            var header = new HeaderBar(64);

            header.DrawCheckout(this);
            header.DrawPaymentOptions();

            while (true)
            {
                var paymentType = Common.GetInt(1, 3);

                PaymentType = paymentType;
                switch (paymentType)
                {
                case 1:
                    PayCash();
                    return;

                case 2:
                    PayCredit();
                    return;

                case 3:
                    PayCheck();
                    return;

                default:
                    Console.WriteLine("Unknown Payment Type.");
                    break;
                }
                Console.Write("Input error: Please try again: ");
            }
        }
        public void Run()
        {
            var header = new HeaderBar(64);

            header.DrawHeader();

            var productList = CreateProductList();

            if (productList == null)
            {
                return;
            }

            Console.WriteLine("press any key to continue to the Main Menu:");
            Console.ReadKey();

            var mainMenu = new MainMenu(productList);

            mainMenu.RunMainMenu();
        }
Beispiel #4
0
 public MainMenu(List <Product> productList)
 {
     ListOfProducts = productList;
     Header         = new HeaderBar(64);
 }
Beispiel #5
0
        public void PrintReceipt()
        {
            var receiptPrinter = new HeaderBar(64);

            receiptPrinter.PrintReceipt(this);
        }
Beispiel #6
0
        //public int RemoveItem { get; set; }   this will be applied

        public OrderMenu(List <Product> productList)
        {
            ListOfProducts = productList;
            Header         = new HeaderBar(64);
            NewOrder       = new Order();
        }