コード例 #1
0
        /// <summary>
        /// Prints all products fetched from the database in a tablelike fashion
        /// </summary>
        internal static void PrintProductsFormated(int categoryIndex)
        {
            Console.SetCursorPosition(0, ObjectSelections.TopOffset);
            switch (categoryIndex)
            {
            case SupplementIndex:    //Supplement
                for (int i = 0; i < SupplementList.Count; i++)
                {
                    ObjectSelections.PrintProductByIndex(i, categoryIndex);
                    Console.WriteLine();
                }
                break;

            case drinksIndex:    //drinks
                for (int i = 0; i < DrinksList.Count; i++)
                {
                    ObjectSelections.PrintProductByIndex(i, categoryIndex);
                    Console.WriteLine();
                }
                break;

            case equipmentsIndex:    //equipments
                for (int i = 0; i < EquipmentsList.Count; i++)
                {
                    ObjectSelections.PrintProductByIndex(i, categoryIndex);
                    Console.WriteLine();
                }
                break;

            default:
                break;
            }
        }
コード例 #2
0
        internal static void ShowCartInTableForm(List <Cart> cartList, decimal shoppingCartTotal)
        {
            Console.Clear();
            Console.WriteLine($"\nShopping cart: {shoppingCartTotal:f2}bgn");
            Console.WriteLine(HorizontalLine('-', '+', 100));
            Console.CursorLeft += Console.WindowLeft / 2;
            Console.WriteLine("All products in your cart");
            Console.WriteLine(HorizontalLine('-', '+', 100));
            foreach (var productInCart in cartList)
            {
                ObjectSelections.PrintProductInCart(productInCart);
            }
            var key = Console.ReadKey(true);

            while (key.Key != ConsoleKey.Spacebar && key.Key != ConsoleKey.Escape)
            {
                key = Console.ReadKey(true);
            }
        }
コード例 #3
0
        /// <summary>
        /// Prints the cart in raw form
        /// </summary>
        internal static void ShowCart()
        {
            Console.Clear();
            Console.WriteLine("Shopping cart:");
            if (GInterface.ShoppingCartList.Count > 0)
            {
                int index = 0;
                foreach (object productInCart in ShoppingCartList)
                {
                    Console.CursorLeft = 92;
                    Console.Write($"x{ShoppingCartProductCounter[index++]}");
                    Console.CursorLeft = 0;
                    Console.Write($" {index}.");
                    switch (productInCart.GetType().Name.ToString())
                    {
                    case "Supplement":

                        ObjectSelections.PrintProduct(productInCart, SupplementIndex, true);
                        break;

                    case "Drink":
                        ObjectSelections.PrintProduct(productInCart, drinksIndex, true);
                        break;

                    case "Equipment":
                        ObjectSelections.PrintProduct(productInCart, equipmentsIndex, true);
                        break;
                    }
                    Console.WriteLine();
                }
            }
            else
            {
                Console.WriteLine("Your shopping cart is empty :/");
            }
        }