static void SearchByNumber(Flight[] Plane) { Console.Write("Input number flight: "); for (int i = 0; i < Plane.Length; i++) { Console.Write(Plane[i].NumberFlight + " ; "); } Console.WriteLine(); string numbFlight = Console.ReadLine(); bool flag = false; Console.WriteLine(" N_flight____Air line________City________Date_______Time____Gate____Terminal____Status___"); for (int i = 0; i < Plane.Length; i++) { NFlight j = Plane[i].NumberFlight; if ((j).ToString() == numbFlight) { flag = true; Console.WriteLine("|{0,6} | {1,10} | {2,10} | {3,15} | {4,5} | {5,7} | {6,8} |", Plane[i].NumberFlight, Plane[i].AirLine, Plane[i].City, Plane[i].TimeDate, Plane[i].Gate, Plane[i].Terminal, Plane[i].FlightStatus); } } if (!flag) { Console.ForegroundColor = System.ConsoleColor.Yellow; Console.WriteLine(" This flight is not"); Console.ForegroundColor = System.ConsoleColor.White; } }
static Flight[] EditStruct(Flight[] Plane) { bool temp; Console.WriteLine(); Console.ForegroundColor = System.ConsoleColor.Yellow; Console.Write("Input number flight: "); Console.ForegroundColor = System.ConsoleColor.White; for (int i = 0; i < Plane.Length; i++) { Console.Write(Plane[i].NumberFlight + " ; "); } Console.WriteLine(); string numbFlight = Console.ReadLine(); for (int i = 0; i < Plane.Length; i++) { NFlight j = Plane[i].NumberFlight; if ((j).ToString() == numbFlight) { Console.ForegroundColor = System.ConsoleColor.Yellow; Console.Write("Input new city:"); Console.ForegroundColor = System.ConsoleColor.White; Console.WriteLine(); Plane[i].City = Console.ReadLine(); Console.WriteLine(); Console.ForegroundColor = System.ConsoleColor.Yellow; Console.Write("Input new Air Line : "); Console.ForegroundColor = System.ConsoleColor.White; foreach (var value in Enum.GetValues(typeof(AirLane))) // List of AirLane { Console.Write((AirLane)value + " ;"); } AirLane airlane = Plane[i].AirLine; temp = Enum.TryParse(Console.ReadLine(), out airlane); Plane[i].AirLine = airlane; Console.ForegroundColor = System.ConsoleColor.Yellow; Console.Write("Input new terminal : "); Console.ForegroundColor = System.ConsoleColor.White; foreach (var value in Enum.GetValues(typeof(TerminalE))) // List of Terminal { Console.Write((TerminalE)value + " ;"); } Console.WriteLine(); TerminalE terminal = Plane[i].Terminal; temp = Enum.TryParse(Console.ReadLine(), out terminal); Plane[i].Terminal = terminal; } } return(Plane); }
static Flight[] SetStatusCanceled(Flight[] Plane) { Console.Write("Numbers flights :"); for (int i = 0; i < Plane.Length; i++) { Console.Write(Plane[i].NumberFlight + " ; "); } Console.WriteLine(); Console.ForegroundColor = System.ConsoleColor.Yellow; Console.WriteLine("Input number flight for canceled: "); Console.ForegroundColor = System.ConsoleColor.White; string numbFlight = Console.ReadLine(); for (int i = 0; i < Plane.Length; i++) { NFlight j = Plane[i].NumberFlight; if ((j).ToString() == numbFlight) { Plane[i].FlightStatus = StatusE.Canceled; } } return(Plane); }