コード例 #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();
        }
コード例 #2
0
        private int[] GetIngredients()
        {
            bool       thatsAll    = false;
            List <int> ingredients = new List <int>();

            while (!thatsAll)
            {
                UserIO.PrintYellow("Add new ingredient? y/n");
                bool answer = UserIO.AskYesNoQ();

                if (answer)
                {
                    Console.Clear();
                    IngredientManager ingredientManager = new IngredientManager();
                    ingredientManager.ShowAllIngredients();
                    Console.WriteLine();
                    Console.WriteLine("Enter id of ingredient you want to add to your pizza");
                    int ingredientId = UserIO.GetUserInt(0, ingredientManager.GlobalIngredients.Count - 1);
                    ingredients.Add(ingredientId);
                    UserIO.PrintGreen($"{ingredientManager.GetOneIngredient(ingredientId)} was added as an ingredient");
                }
                else
                {
                    thatsAll = true;
                }
            }

            return(ingredients.ToArray());
        }
コード例 #3
0
        private void ShowInvoice(Order order)
        {
            Console.Clear();
            UserIO.PrintRed($"Order nr:{order.Id}  -  placed on: {order.Date}");
            Console.WriteLine();

            string name      = "";
            string size      = "";
            string crust     = "";
            string quantity  = "";
            string itemPrice = "";

            Console.ForegroundColor = ConsoleColor.Yellow;
            UserIO.PrintPretty("Name", 15, "Size", 30, "Crust", 45, "Quantity", 60, "ItemPrice", true);
            Console.ResetColor();
            Console.WriteLine();

            for (int i = 0; i < order.ItemsArray.Length; i++)
            {
                int pizzaId = order.ItemsArray[i][0];
                name      = Convert.ToString(Pizza_Manager.GlobalPizzas[pizzaId].Name);
                size      = Convert.ToString((PizzaSize)order.ItemsArray[i][1]);
                crust     = Convert.ToString((PizzaCrust)order.ItemsArray[i][2]);
                quantity  = Convert.ToString(order.ItemsArray[i][3]);
                itemPrice = Convert.ToString(order.ItemPriceArray[i]);

                UserIO.PrintPretty(name, 15, size, 30, crust, 45, quantity, 60, itemPrice, true);
            }

            Console.WriteLine();
            UserIO.PrintYellow($"Total items: {order.ItemCount}");
            UserIO.PrintGreen($"Total price: {order.TotalPrice}");
            Console.WriteLine();
            UserIO.PrintDarkRed("Press enter to go back");
        }
コード例 #4
0
        public void ShowOnePizza(int id)
        {
            IngredientManager ingredientManager = new IngredientManager();

            UserIO.PrintRed($"{GlobalPizzas[id].Name}");
            Console.WriteLine();
            Console.WriteLine("Ingredients:");
            Console.WriteLine();
            for (int i = 0; i < GlobalPizzas[id].Ingredients.Length; i++)
            {
                int ingredientId = GlobalPizzas[id].Ingredients[i];
                Console.WriteLine($"  -{ingredientManager.GetOneIngredient(ingredientId)}");
            }

            Console.WriteLine();
            if (Convert.ToBoolean(GlobalPizzas[id].Veggy))
            {
                UserIO.PrintGreen("This is a vegetarian pizza");
            }
            UserIO.PrintYellow($"\nPriceSmall = {GlobalPizzas[id].PriceSmall} - PriceMedium = {GlobalPizzas[id].PriceMedium} - PriceLarge = {GlobalPizzas[id].PriceLarge}");
        }