public override void Menu() { MiscUtility.WriteLineFormatted("Location Database Menu", ConsoleColor.DarkMagenta); Console.WriteLine("\tA. Load Locations from CSV"); Console.WriteLine("\tB. Insert data into database"); Console.WriteLine("\tQ. Go back"); base.Menu(); }
public void MainLoop() { Menu(); string selection = "m"; bool loop = true; do { selection = Console.ReadLine(); switch (selection) { case "a": case "A": Managers = (List <Manager>)LoadTableFromCsv <Manager>("Manager"); MiscUtility.WriteLineFormatted($"Added {Managers.Count()} managers onto the stack.\n", ConsoleColor.Green); break; case "b": case "B": try { MiscUtility.WriteLineFormatted($"Inserted {InsertManagers()} records into the database.", ConsoleColor.Green); } catch (SqlException e) { MiscUtility.WriteLineFormatted(e.Message, ConsoleColor.Red); } break; case "c": case "C": Orders = (List <Order>)LoadTableFromCsv <Order>("Order"); MiscUtility.WriteLineFormatted($"Added {Orders.Count()} orders onto the stack.\n", ConsoleColor.Green); break; case "d": case "D": try { MiscUtility.WriteLineFormatted($"Inserted {InsertOrders()} records into the database.", ConsoleColor.Green); } catch (SqlException e) { MiscUtility.WriteLineFormatted(e.Message, ConsoleColor.Red); } break; case "e": case "E": Returns = (List <Return>)LoadTableFromCsv <Return>("Return"); MiscUtility.WriteLineFormatted($"Added {Returns.Count()} orders onto the stack.\n", ConsoleColor.Green); break; case "f": case "F": try { MiscUtility.WriteLineFormatted($"Inserted {InsertReturns()} records into the database.", ConsoleColor.Green); } catch (SqlException e) { MiscUtility.WriteLineFormatted(e.Message, ConsoleColor.Red); } break; case "m": case "M": Menu(); break; case "q": case "Q": loop = false; break; default: Console.WriteLine("Invalid selection.\n"); Menu(); break; } Console.WriteLine(); } while (loop); }