Example #1
0
 private void CreateFlight()
 {
     ConsoleManager.PrepareConsoleForInput();
     Console.WriteLine("Please Enter data to create a flight:");
     Console.WriteLine("Arrival Country;Arrival City");
     string[] arrivalLocation = Console.ReadLine().Split(';');
     Console.WriteLine("Departure Country;Depature City");
     string[] depatureLocation = Console.ReadLine().Split(';');
     Console.WriteLine("Flight number;Terminal;Gate");
     string[] flightInfo = Console.ReadLine().Split(';');
     Console.WriteLine("Economy Ticket Price;Buissness ticket Price");
     string[] priceInfo = Console.ReadLine().Split(';');
     if (arrivalLocation.Length == 2 && depatureLocation.Length == 2 && flightInfo.Length == 3 && priceInfo.Length == 2)
     {
         Flight newFlight = Flight.CreateFlight(new Location(arrivalLocation[0], arrivalLocation[1]), new Location(depatureLocation[0], depatureLocation[1]), flightInfo[0], flightInfo[1], flightInfo[2], Status.Unknow, TicketPrice.CreateTicketPrice(priceInfo[0], priceInfo[1]));
         if (newFlight != null)
         {
             _flights.Add(newFlight);
             ConsoleManager.ViewFlightInfo(newFlight);
             Console.WriteLine("Flight was added");
         }
         else
         {
             Console.WriteLine(StringLiterals.IncorrectData);
         }
     }
     else
     {
         Console.WriteLine(StringLiterals.IncorrectData);
     }
     ConsoleManager.ViewPressEnter();
 }
Example #2
0
 public BaseData()
 {
     _menuItems = new List <string>()
     {
         StringLiterals.PrintAllFlights,
         StringLiterals.PrintAllFlightsPassengers,
         StringLiterals.SearchFlightByNameLstName,
         StringLiterals.SearchPassengerByPassport,
         StringLiterals.SearchFlightByEconomyPrice,
         StringLiterals.CreateFlight,
         StringLiterals.DeleteFlight,
         StringLiterals.EditFlight,
         StringLiterals.EditPassenger,
         StringLiterals.Exit
     };
     _flights = new List <Flight>()
     {
         Flight.CreateFlight(new Location("Ukraine", "Kharkiv"), new Location("Ukraine", "Kiev"), "1223", "2", "7", Status.Arrived, TicketPrice.CreateTicketPrice("10", "20")),
         Flight.CreateFlight(new Location("Netherlands", "Amsterdam"), new Location("Ukraine", "Odessa"), "963", "6", "5", Status.Unknow, TicketPrice.CreateTicketPrice("3300", "12322")),
         Flight.CreateFlight(new Location("Ukraine", "Lviv"), new Location("Russia", "Moscow"), "555", "1", "6", Status.Delayed, TicketPrice.CreateTicketPrice("156", "243")),
         Flight.CreateFlight(new Location("Egypt", "Sharm-el-Sheih"), new Location("Ukraine", "Kiev"), "174", "90", "11", Status.Canceled, TicketPrice.CreateTicketPrice("10", "1230")),
         Flight.CreateFlight(new Location("Belorus", "Minsk"), new Location("USA", "La"), "188", "6", "2", Status.Departed_At, TicketPrice.CreateTicketPrice("1123", "563967")),
         Flight.CreateFlight(new Location("UAR", "Dubai"), new Location("Canada", "Vankuver"), "53", "1", "45", Status.Departed_At, TicketPrice.CreateTicketPrice("222", "7654")),
         Flight.CreateFlight(new Location("Russia", "STP"), new Location("USA", "Chicago"), "87", "23", "32", Status.Departed_At, TicketPrice.CreateTicketPrice("888", "12345"))
     };
     _passengers = new List <Passenger>()
     {
         Passenger.CreatePassenger("Edic", "Turist", "Rus", Passport.CreatePassport("MT", "12455"), new DateTime(1997, 02, 12), "MALE"),
         Passenger.CreatePassenger("Alla", "Gromova", "UA", Passport.CreatePassport("TD", "10983"), new DateTime(1996, 08, 12), "FEMALE"),
         Passenger.CreatePassenger("Anton", "Kostev", "UA", Passport.CreatePassport("LS", "13485"), new DateTime(1997, 09, 30), "MALE"),
         Passenger.CreatePassenger("Antonio", "Banderes", "Spain", Passport.CreatePassport("LO", "99845"), new DateTime(1992, 03, 19), "MALE"),
         Passenger.CreatePassenger("Jane", "Munch", "German", Passport.CreatePassport("XX", "88555"), new DateTime(1990, 02, 12), "FEMALE"),
         Passenger.CreatePassenger("Jason", "Romer", "USA", Passport.CreatePassport("SS", "99875"), new DateTime(2000, 12, 10), "MALE"),
         Passenger.CreatePassenger("Robbert", "Vilx", "Danmark", Passport.CreatePassport("WE", "78531"), new DateTime(1978, 12, 01), "MALE"),
         Passenger.CreatePassenger("Robbie", "Viliam", "Sapin", Passport.CreatePassport("PO", "98455"), new DateTime(1985, 04, 15), "MALE"),
         Passenger.CreatePassenger("Leo", "Messi", "Argentina", Passport.CreatePassport("NA", "652174"), new DateTime(1997, 07, 11), "MALE"),
         Passenger.CreatePassenger("Leonid", "Gaida", "UA", Passport.CreatePassport("PO", "10911"), new DateTime(1993, 09, 28), "MALE"),
         Passenger.CreatePassenger("Viktoria", "Secret", "Latvia", Passport.CreatePassport("RF", "96134"), new DateTime(1990, 02, 21), "FEMALE"),
         Passenger.CreatePassenger("Kirill", "Krasnikov", "FRance", Passport.CreatePassport("FR", "652896"), new DateTime(1993, 11, 11), "MALE"),
         Passenger.CreatePassenger("Jan", "Belenuk", "UA", Passport.CreatePassport("UA", "124555"), new DateTime(1991, 02, 03), "MALE")
     };
     RandomizeData();
 }