public void DisplayOptions() { Console.WriteLine("1: Search orders by location\n2: Search orders by customer\n3: Get order details\n4: Print all orders\n5: Display order stats"); Console.WriteLine("Enter the number for your option:"); while (true) { int choice = Wrappers.ReadInt(); switch (choice) { case 1: PrintOrders(1); return; case 2: PrintOrders(2); return; case 3: PrintOrders(3); return; case 5: DisplayOrderStats(); return; default: PrintOrders(0); return; } } }
public void Login() { bool loggingIn = true; while (loggingIn) { Console.WriteLine("1: Login\n2: Add user"); int input = Wrappers.ReadInt(); if (input == 1) { while (true) { try { VerifyUser(); return; } catch (NullReferenceException) { Console.WriteLine("Username/email not found"); } } } else { if (AddCust()) { return; } } } }
public void DisplayOptions() { Console.WriteLine("\n\n"); while (true) { Console.WriteLine("1: Place Order\n2: Add New Customer\n3: Search Customers"); Console.WriteLine("Enter the number for your option"); int choice = Wrappers.ReadInt(); switch (choice) { case 1: AddOrder(); return; case 2: AddCust(); return; case 3: SearchCust(); return; default: Console.WriteLine("Please enter a valid option"); break; } } }
static void EnterControlLoop() { custMgr.Login(); while (true) { Console.WriteLine("\n\n"); Console.WriteLine("1:Order Options\n2:Customer Options\n3:Location Options"); Console.Write("Enter the number for your choice:"); int choice = Wrappers.ReadInt(); Console.WriteLine($"{choice}\n\n"); switch (choice) { case 1: ordMgr.DisplayOptions(); break; case 2: custMgr.DisplayOptions(); break; case 3: locMgr.DisplayOptions(); break; default: Console.WriteLine("Please enter a valid option"); continue; } } }
public void DisplayOptions() { Console.WriteLine("\n\n"); while (true) { Console.WriteLine("1: Add item"); Console.Write("Enter the number for your option: "); int choice = Wrappers.ReadInt(); switch (choice) { case 1: return; default: Console.WriteLine("Please enter a valid option."); break; } } }
//Prompts for order item, returns false if order is complete, breaking containing while loop static bool GetOrderItem(int store_id, int oid) { //Determine which product and qty Console.WriteLine("Enter the name or ID of the product you would like to purchase or 'q' to quit:"); string input = Console.ReadLine().Trim().ToLower(); if (input == "q") { return(false); } Console.WriteLine("Enter the quantity or 'q' to quit:"); int quantity = Wrappers.ReadInt(); if (quantity == -1) { return(false); } Decimal p_price = 0; //Validate product quantity, update and place order int prod_id = _locManager.ValidateProd(store_id, input, quantity, out p_price); if (prod_id >= 0) { _locManager.Update(prod_id, quantity); _ordManager.AddOrderItem(oid, prod_id, quantity); } else { Console.WriteLine("Invalid Product or Quantity"); } //Prompt for continue Console.WriteLine("Would you like to add another item (y/n)?"); string cont = Console.ReadLine().Trim().ToLower(); if (cont == "y") { return(true); } return(false); }