Exemplo n.º 1
0
        public void Display()
        {
            while (true)
            {
                Console.WriteLine(vm.DisplayAll());
                Console.WriteLine("Inventory Menu");        //INVENTORY MENU
                Console.WriteLine();
                Console.WriteLine("<1> Purchase Menu");     //GO TO PURCHASE MENU
                Console.WriteLine("<2> Quit to main menu"); // QUIT TO MAIN MENU


                Console.Write(">");
                string userInput = Console.ReadLine();

                if (userInput == "1")
                {
                    Console.Clear();
                    PurchaseMenu submenu = new PurchaseMenu(vm);
                    submenu.Display();
                }
                else if (userInput == "2")
                {
                    Console.Clear();

                    Console.WriteLine("Bye, Felicia");
                    break; //<-- breaks off the whileloop and because it's the end of the line for the entire method so it pops off the stack and returns to the main menu
                }
                else
                {
                    Console.WriteLine("Invalid Input");
                    Console.WriteLine("C'MON, THERE'S ONLY 2 CHOICES!");
                    Console.WriteLine();
                }
            }
        }
Exemplo n.º 2
0
        public void Display()
        {
            while (true)
            {
                //Console.Clear();

                Console.WriteLine("Main Menu");
                Console.WriteLine();
                Console.WriteLine("<1> View Inventory");          //VIEW INVENTORY
                Console.WriteLine("<2> Purchase Menu.");          //PURCHASE MENU
                Console.WriteLine("<Q> Finish Transaction/Quit"); //FINISH TRANSACTION & QUIT
                Console.WriteLine();
                Console.Write(">");
                string userInput = Console.ReadLine();

                if (userInput == "1")
                {
                    Console.Clear();
                    InventoryMenu inventoryMenu = new InventoryMenu(MainMenu.vm);

                    inventoryMenu.Display();
                }
                else if (userInput == "2")
                {
                    Console.Clear();
                    PurchaseMenu submenu = new PurchaseMenu(vm);
                    submenu.Display();
                }
                else if (userInput.ToUpper() == "Q")
                {
                    vm.FW.GenerateSalesReport(vm.TransactionLog);
                    Console.BackgroundColor = ConsoleColor.DarkMagenta;
                    Console.Clear();
                    Console.WriteLine();
                    Console.WriteLine("Change Due: $" + vm.Balance);

                    PrintChangeDue();
                    PrintPurchasedItems();
                    ResizeAndExitWindow();

                    return;
                }
                else
                {
                    Console.WriteLine("INVALID INPUT");
                }
            }
        }