예제 #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 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");
        }
예제 #3
0
        public void ShowAllIngredients()
        {
            SetGlobalIngredients();

            for (int i = 0; i < GlobalIngredients.Count; i++)
            {
                UserIO.PrintPretty($"{GlobalIngredients[i].Id}", 10, $"{ GlobalIngredients[i].Name}", 30, $"{ GlobalIngredients[i].Quantity}");
            }
        }
예제 #4
0
        private void ShowBalanceForDay(int day)
        {
            //Loop true all orders and add the prices. fill 2 lists: one with all used ingredients (id),
            //the other with times they where used (quantity * size) 1=small 2=med 3=large
            double     earningsDay     = 0;
            int        itemsDay        = 0;
            List <int> ingredientId    = new List <int>();
            List <int> ingredientCount = new List <int>();

            foreach (var order in SortedByDay[day])
            {
                earningsDay += order.TotalPrice;
                itemsDay    += order.ItemCount;

                for (int i = 0; i < order.ItemsArray.Length; i++)
                {
                    int pizzaId       = order.ItemsArray[i][0];
                    int pizzaSize     = order.ItemsArray[i][1];
                    int pizzaQuantity = order.ItemsArray[i][3];
                    //Console.WriteLine(pizzaId);

                    int[] pizzaIngr = Pizza_Manager.GlobalPizzas[pizzaId].Ingredients;

                    //loop over pizza ingredients
                    for (int j = 0; j < pizzaIngr.Length; j++)
                    {
                        //if id is not in list, ad to list, else add count to existing
                        if (!ingredientId.Contains(pizzaIngr[j]))
                        {
                            ingredientId.Add(pizzaIngr[j]);
                            ingredientCount.Add(pizzaSize * pizzaQuantity);
                        }
                        else
                        {
                            int index = ingredientId.IndexOf(pizzaIngr[j]);
                            ingredientCount[index] += pizzaSize * pizzaQuantity;
                        }
                    }
                }
            }
            IngredientManager ingredientManager = new IngredientManager();

            Ingredient_Manager = ingredientManager;

            //Display obtained info

            Console.Clear();
            UserIO.PrintRed($"Balance for Day {SortedByDay[day][0].Date.ToString("d")}");
            Console.WriteLine();
            Console.ForegroundColor = ConsoleColor.Yellow;
            UserIO.PrintPretty("Ingredient used", 20, "Times used");
            Console.WriteLine();
            Console.ResetColor();

            for (int i = 0; i < ingredientId.Count; i++)
            {
                UserIO.PrintPretty($"{ Ingredient_Manager.GetOneIngredient(ingredientId[i]) }", 20, $"{ ingredientCount[i] }");
            }
            Console.WriteLine();
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine($"Total Items sold: {itemsDay}");
            UserIO.PrintGreen($"Total income: {earningsDay} EUR");
            Console.WriteLine();

            UserIO.PrintDarkRed("Press enter to go back");

            Console.ReadLine();
        }