Exemplo n.º 1
0
        private void ShowCart(Order newOrder)
        {
            UserIO.PrintBlue("----------------------------------------------------------------------");
            UserIO.PrintBlue("Currently in cart:");
            Console.WriteLine();

            if (newOrder.ItemCount == 0)
            {
                Console.WriteLine("Nothing in cart");
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                UserIO.PrintPretty("Quantity", 15, "Name", 30, "Size", 45, "Crust", 60, "Price", true);
                Console.ResetColor();
                Console.WriteLine();
            }
            for (int i = 0; i < newOrder.Items.Count; i++)
            {
                int    itemId       = newOrder.Items[i][0];
                string itemSize     = ((PizzaSize)newOrder.Items[i][1]).ToString();
                string itemCrust    = ((PizzaCrust)newOrder.Items[i][2]).ToString();
                int    itemQuantity = newOrder.Items[i][3];

                UserIO.PrintPretty($"{itemQuantity} stuks", 15, $"{Pizza_Manager.GlobalPizzas[itemId].Name}", 30, $"{itemSize}", 45, $"{itemCrust}", 60, $"{newOrder.ItemPrice[i]}", true);
            }
            Console.WriteLine();
            UserIO.PrintYellow($"Total price: {newOrder.TotalPrice} - Items in cart: {newOrder.ItemCount}");
            UserIO.PrintBlue("----------------------------------------------------------------------");
            Console.WriteLine();
        }
Exemplo n.º 2
0
        private void GetUserInput(Order newOrder)
        {
            int[] item = new int[4];

            Pizza_Manager.ShowPizzaList();

            Console.WriteLine();
            Console.WriteLine("Select id to add to order");
            int id = UserIO.GetUserInt(0, Pizza_Manager.GlobalPizzas.Count - 1);

            item[0] = id;

            Console.Clear();
            ShowCart(newOrder);
            Pizza_Manager.ShowOnePizza(id);
            Console.WriteLine();
            UserIO.PrintBlue("---------------------------------------------------------------------");
            Console.WriteLine();

            Console.WriteLine("Select the size: Small = 1 | Medium = 2 | Large = 3");
            int size = UserIO.GetUserInt(1, 3);

            item[1] = size;

            Console.WriteLine("Select Crust: PanCrust = 1 | DeepCrust = 2 | CheeseCrust = 3");
            int crust = UserIO.GetUserInt(1, 3);

            item[2] = crust;

            Console.WriteLine("How many of these?");
            int quantity = UserIO.GetUserInt(1, 50);

            item[3] = quantity;

            newOrder.Items.Add(item);
            newOrder.ItemsArray = newOrder.Items.ToArray();
        }