private void displayInfoEntity(dynamic one, string header) { if (header != "") { HelperIO.welcomeMessage(header); } System.Console.WriteLine(one.ToString()); }
public void addCity() { displayInfoEntities(cityList, "Список міст"); cityList.Add(new City()); cityList.Last().Name = HelperIO.stringInput("Введіть назву міста"); cityMenu(); }
public void addCrew() { displayInfoEntities(crewList, "Список екіпажів"); crewList.Add(new Crew()); crewList.Last().CarNumber = HelperIO.stringInput("Введіть номер авто"); crewList.Last().DriverName = HelperIO.stringInput("Введіть ПІБ водія"); crewList.Last().LoadCapacity = HelperIO.intAbsInput("Введіть вантажопідйомність авто"); addRoute(crewList.Last().Id); menu(); }
private void addRoute(int routeId) { displayInfoRoutes(routeId, "Список маршрутів"); RouteList.Add(new Route(routeId)); displayInfoEntities(cityList, "Список міст"); RouteList.Last().CityFrom = cityList[HelperIO.intAbsInput("Введіть номер міста початку маршруту", cityList.Count)]; displayInfoEntities(cityList, "Список міст"); RouteList.Last().CityTo = cityList[HelperIO.intAbsInput("Введіть номер міста кінця маршруту", cityList.Count)]; RouteList.Last().ArrivalTime = HelperIO.intAbsInput("Введіть тривалість поїздки, хв"); }
private void displayInfoEntities(dynamic one, string header) { if (one.Count > 0) { HelperIO.welcomeMessage(header); } int i = 0; foreach (Entity element in one) { System.Console.WriteLine((i++) + " -> " + element.ToString()); } }
private void displayInfoRoutes(int routeId, string header) { if (RouteList.Count > 0) { HelperIO.welcomeMessage(header); foreach (Route element in RouteList) { if (element.RouteId == routeId) { System.Console.WriteLine(element.ToString()); } } } }
private string display(string header, IDictionary <string, string> menu, IDictionary <string, string> methtods, string active) { HelperIO.welcomeMessage(header); Console.WriteLine("Будь ласка виберіть один з пунктів:"); foreach (KeyValuePair <string, string> item in menu) { Console.WriteLine("{0} - {1}", item.Key, item.Value); } string choice = Console.ReadLine(); if (methtods.ContainsKey(choice)) { Console.Clear(); string value; methtods.TryGetValue(choice, out value); return(value); } else { HelperIO.displayError(); return(active); } }
public void display() { displayInfoEntities(crewList, "Список екіпажів"); HelperIO.successMessage("-------------------------------------------------------------------------------"); menu(); }
public void addRoute() { displayInfoEntities(crewList, "Список екіпажів"); addRoute(crewList[HelperIO.intAbsInput("Введіть номер екіпажу", crewList.Count)].Id); routeMenu(); }