Example #1
0
 public Order BuildBurgerOrder(Order order, int choice, Burger burger)
 {
     Console.WriteLine("\nChoose your Burger Toppings");
     MenuItems.CreateMenu(MenuItems.BurgerToppingsMenuItems.burgerToppingsMenuItemsList);
     burger = MenuItems.BurgerToppingsMenuItems.ChooseBurgerToppings(choice, burger);
     order.AddToBurgerOrder(burger);
     return(order);
 }
Example #2
0
 public Order BuildPizzaOrder(Order order, int choice, Pizza pizza)
 {
     Console.WriteLine("\nChoose your Pizza Toppings");
     MenuItems.CreateMenu(MenuItems.PizzaToppingsMenuItems.pizzaToppingsMenuItemsList);
     pizza = MenuItems.PizzaToppingsMenuItems.ChoosePizzaToppings(choice, pizza);
     order.AddToPizzaOrder(pizza);
     return(order);
 }
Example #3
0
        public Order BuildExtraOrder(int choiceItem, int choiceSize, Order order, Extra extra)
        {
            while (choiceItem != 0)
            {
                MenuItems.ChooseExtraItemsMenu();
                while (!int.TryParse(Console.ReadLine(), out choiceItem))
                {
                    Console.Clear();
                    MenuItems.ChooseExtraItemsMenu();
                }
                if (choiceItem > 0 && choiceItem <= MenuItems.ExtraMenuItems.extraMenuItemsList.Count)
                {
                    Console.WriteLine($"Choice of Extra: {MenuItems.ExtraMenuItems.extraMenuItemsList[choiceItem - 1].itemName}\n");
                    Console.WriteLine("Item Size: ");
                    MenuItems.CreateMenu(MenuItems.ItemSizes.itemSizesList);
                    while (!int.TryParse(Console.ReadLine(), out choiceSize))
                    {
                        Console.Clear();
                        Console.WriteLine($"Choice of Extra: {MenuItems.ExtraMenuItems.extraMenuItemsList[choiceItem - 1].itemName}\n");
                        Console.WriteLine("Item Size: ");
                        MenuItems.CreateMenu(MenuItems.ItemSizes.itemSizesList);

                        while (choiceSize > MenuItems.ItemSizes.itemSizesList.Count)
                        {
                            Console.WriteLine("\tNot a valid Size, please choose a valid option: ");
                            while (!int.TryParse(Console.ReadLine(), out choiceSize))
                            {
                            }
                        }
                    }

                    if (choiceSize > 0 && choiceSize <= MenuItems.ItemSizes.itemSizesList.Count)
                    {
                        Console.WriteLine($"Chosen Size: {MenuItems.ItemSizes.itemSizesList[choiceSize - 1].itemName}\n");
                        order = Extra.AddExtrasToExtrasListandExtrasOrder(extra, order, choiceItem, choiceSize);
                    }
                }
                if (choiceItem > MenuItems.ExtraMenuItems.extraMenuItemsList.Count || choiceSize > MenuItems.ItemSizes.itemSizesList.Count)
                {
                    Console.WriteLine("Not a valid option, Please Choose Again");
                }
            }
            return(order);
        }
        static void Main(string[] args)
        {
            Console.Clear();
            Order   order       = new Order();
            decimal personMoney = 100m;
            bool    payed       = false;

            int input = 1;

            while (input != 0)
            {
                Console.WriteLine("Choose Menu Option");
                MenuItems.CreateMenu(MenuItems.MainMenuItems.mainMenuItemsList);
                Console.WriteLine("[0] Exit Restaurant");
                Console.WriteLine("Your pick: ");

                while (!int.TryParse(Console.ReadLine(), out input))
                {
                    Console.Clear();
                    Console.WriteLine("Choose Menu Option");
                    MenuItems.CreateMenu(MenuItems.MainMenuItems.mainMenuItemsList);
                    Console.WriteLine("[0] Exit Restaurant");
                    Console.WriteLine("You entered an invalid choice");
                    Console.Write("Pick Again ");
                }

                Console.WriteLine("");

                switch (input)
                {
                case 1:
                    //build burger
                    Burger burger = new Burger();
                    int    choice = 1;
                    order.BuildBurgerOrder(order, choice, burger);
                    break;

                case 2:
                    //build pizza
                    Pizza pizza = new Pizza();
                    choice = 1;
                    order.BuildPizzaOrder(order, choice, pizza);
                    break;

                case 3:
                    //Extra Items
                    Extra extra      = new Extra();
                    int   choiceItem = 1;
                    int   choiceSize = 1;
                    order.BuildExtraOrder(choiceItem, choiceSize, order, extra);
                    break;

                case 4:
                    //Checkout
                    Console.WriteLine("\nThank you for eating with us!!\n**** Here is your receipt ****\n");
                    order.ShowBurgerOrder();
                    order.ShowPizzaOrder();
                    order.ShowExtraOrder();
                    order.CheckOut(personMoney);
                    Console.WriteLine("\nCome again!!\n Press 0 to exit....\n");
                    Console.ReadLine();
                    Console.Clear();
                    order.ClearAllOrdersAndList();
                    payed = true;
                    break;

                default:
                    char oops;
                    if (input == 0 && payed == false && (order.MyBurgers.Count + order.MyExtras.Count + order.MyPizzas.Count) > 0)
                    {
                        Console.WriteLine($"\nOops you forgot to pay, did you mean to Checkout and pay instead? Press Y for yes.");
                        while (!char.TryParse(Console.ReadLine(), out oops))
                        {
                            Console.WriteLine($"\nOops you forgot to pay, did you mean to Checkout and pay instead? Press Y for yes.");
                        }
                        if (oops == 'y' || oops == 'Y')
                        {
                            Console.WriteLine("\nThank you for eating with us!!\n**** Here is your receipt ****\n");
                            order.ShowBurgerOrder();
                            order.ShowPizzaOrder();
                            order.ShowExtraOrder();
                            order.CheckOut(personMoney);
                            Console.WriteLine("\nCome again!!\n Press 0 to exit....\n");
                            Console.ReadLine();
                            Console.Clear();
                            order.ClearAllOrdersAndList();
                            payed = true;
                        }
                        else
                        {
                            input = 0;
                            payed = false;
                            Console.WriteLine($"YOU LEFT WITHOUT PAYING " + order.CheckOut(personMoney).ToString("C") + "\nSHAME ON YOU!!!!!");
                            Console.WriteLine("\n\nPress Enter to Exit Program....");
                            Console.ReadLine();
                            //continue;
                        }
                    }
                    else
                    {
                        Console.WriteLine("\n\nPress Enter to Exit Program....");
                        Console.ReadLine();
                    }
                    break;
                }
            }
        }