public static void EditAirline(Airline company) { string valuestring; DateTime valuedDatetime; Console.WriteLine("Enter the new name of Airline:(#) - remain one"); valuestring = Console.ReadLine(); company.AirlineName = ((valuestring == "#") ? company.AirlineName : valuestring); Console.WriteLine("Enter the new LicenseNumber of Airline:(#) - remain one"); valuestring = Console.ReadLine(); company.LicenseNumber = ((valuestring == "#") ? company.LicenseNumber : valuestring); Console.WriteLine("Enter the new expiration date of Airline: (#) - remain one"); valuestring = Console.ReadLine(); valuedDatetime = ((valuestring == "#") ? company.DateExpired : InputUtil.TimeEnter()); company.DateExpired = valuedDatetime; }
public static Airline CheckAirline(Airline[] AirlineArray) { string licensenumber; string airlinename; int incrementAirlineArray = 4; FindAnAirline fn = new FindAnAirline ( () => { Console.WriteLine("Enter an Airline to work with:"); string readAirline = Console.ReadLine(); for (int i = 0; i < AirlineArray.Length; i++) { if (AirlineArray[i]?.AirlineName != null) { if (AirlineArray[i].AirlineName == readAirline) { return(AirlineArray[i]); } } } return(null); } ); Airline chosenLine = fn(); if (chosenLine == null) { Console.WriteLine("The airline you have selected doesn't exist." + "Do you wish to fill a new one (Y/N)"); bool yn = ("Y" == Console.ReadLine() ? true : false); if (yn) { Console.WriteLine("Enter a name of AirLine"); incrementAirlineArray++; try { Console.WriteLine("Enter a license nimber of an airlinecompany"); licensenumber = Console.ReadLine(); airlinename = Console.ReadLine(); AirlineArray[incrementAirlineArray] = new Airline(airlinename, licensenumber, true, InputUtil.TimeEnter()); while (true) { Console.WriteLine("To continue filling an information of a current airline press /Y/ or N to stop"); string choice = Console.ReadLine(); if (choice.ToUpper() != "Y") { break; } AirlineArray[incrementAirlineArray].AddItem(); } chosenLine = AirlineArray[incrementAirlineArray]; } catch (IndexOutOfRangeException excep) { Console.WriteLine(excep.Message); return(null); } } } return(chosenLine); }
public override void GetLicense() { this.DateExpired = InputUtil.TimeEnter(); this.IsLicenseValid = true; }