public void Start() { Boolean runMenu = true; string managerPassword; Log.Logger = new LoggerConfiguration().WriteTo.File("../SystemLog.json").CreateLogger(); do { Console.Clear(); Console.WriteLine("Welcome to the Pie Shop!"); Console.WriteLine("Please make a selection below:"); Console.WriteLine("[1] Customer Oprions"); Console.WriteLine("[2] Manager options"); Console.WriteLine("[3] Exit Application"); string userInput = Console.ReadLine(); switch (userInput) { case "1": StartCustomer newSearch = new StartCustomer(_repo); newSearch.Start(); break; case "2": Console.WriteLine("Please enter the Password (Psss its Passw0rd!)"); managerPassword = Console.ReadLine(); if (managerPassword.Equals("Passw0rd!")) { ManagerMenu newManager = new ManagerMenu(_repo); newManager.Start(); } else { Log.Error("Invalid password was entered"); Console.WriteLine("ERROR WRONG PASSWORD!!! Press Enter to Continue"); Console.ReadLine(); } break; case "3": Console.WriteLine($"We are sad to see you leave :(\nplease come again soon!!"); runMenu = false; break; default: Log.Error("Invalid option was chosen(Client did not choose 'Customer Oprions', 'Manager options', or 'Exit Application' )"); Console.WriteLine("\nThat was not an option try again\nPlease press enter to continue"); Console.ReadLine(); break; } } while (runMenu); }
public void Start() { bool menuRun = true; do { Console.WriteLine(); Console.WriteLine("Welcome to the Ski Store!"); Console.WriteLine("-------------------------"); Console.WriteLine("Please Select an Option:"); Console.WriteLine("[0] - Customer Menu"); Console.WriteLine("[1] - Manager Menu"); Console.WriteLine("[2] - Exit Program"); Console.WriteLine("Select Option: "); string option = Console.ReadLine(); switch (option) { case "0": CustMenu customerMenu = new CustMenu(_customerBL, _locationBL, _productBL, _itemBL, _orderBL, _productOrderBL); menuRun = false; customerMenu.Start(); break; case "1": ManagerMenu managerMenu = new ManagerMenu(_customerBL, _locationBL, _productBL, _itemBL, _orderBL, _productOrderBL); Log.Information("Manager Menu Accessed"); menuRun = false; managerMenu.Start(); break; case "2": menuRun = false; Exit(); break; default: Console.WriteLine("Invalid menu option. Please try again!"); break; } } while (menuRun); }
public void Start() { Boolean stay = true; do { Console.Clear(); Console.WriteLine(MenuPrint); Console.WriteLine("Enter a #, 'Back' or 'Exit': "); string userInput = Console.ReadLine(); IMenu menu; switch (userInput) { case "0": try { if (Login()) { menu = new ManagerMenu(_manager, _managerBL, _customerBL, _locationBL, _productBL, _inventoryLineItemsBL); menu.Start(); } else { _manager = null; } } catch (Exception e) { Console.WriteLine("\nThe provided email is not associated with a manager!"); Console.ReadLine(); continue; } finally { _manager = null; } break; case "1": try { CreateManager(); } catch (Exception e) { Console.WriteLine("\ninvalid input. "); Console.ReadLine(); continue; } break; case "2": Console.Clear(); GetManagers(); break; case "Back": stay = false; break; case "Exit": System.Environment.Exit(1); break; default: Console.Clear(); Console.WriteLine("Invalid input! Please select a menu item"); Console.WriteLine("Press Enter to view menu"); Console.ReadLine(); break; } } while (stay); }