private FlightsManager() { Password = "******"; Customers = CustomersBase.GetSource(); Flights = Deserialize <FlightsBase>("FlightsBase.dat"); if (Flights == default(FlightsBase)) { Flights = new FlightsBase(); } }
public void FlightMenu( ) { Flight CurFlight = null; char mode = ' '; Console.Clear(); OutputFlightMenu(); do { mode = Program.EnterMode(); switch (mode) { case 'o': case 'O': OutputFlightMenu(); break; case 'p': case 'P': CurFlight = Flights.FindByPoints(); Program.WriteColorLine(" < Current flight was updated > \n", ConsoleColor.Green); OutputFlightMenu(); break; case 'a': case 'A': Flights.OutputFlights(); break; case 'd': case 'D': Flights.DelCurrentFlight(CurFlight); break; case 'i': case 'I': FlightsBase.OutputCurrentFlight(CurFlight); break; case 'r': case 'R': CurFlight = Flights.RegistrateFlight(); Program.WriteColorLine(" < Current flight was updated > \n", ConsoleColor.Green); break; case 'k': case 'K': CurFlight = Flights.FindByDate(FlightsTime.arrival); Program.WriteColorLine(" < Current flight was updated > \n", ConsoleColor.Green); break; case 'l': case 'L': CurFlight = Flights.FindByDate(FlightsTime.departure); Program.WriteColorLine(" < Current flight was updated > \n", ConsoleColor.Green); break; case 'q': case 'Q': break; default: Program.WriteColorLine(" < Wrong mode > ", ConsoleColor.Red); break; } } while (mode != 'q' && mode != 'Q'); Console.Clear(); }
public void BookingMenu() { Booking CurBooking = null; FlightsManager Manager = FlightsManager.GetSource(); FlightsBase Flights = Manager.Flights; char mode = ' '; Console.Clear(); OutputBookingMenu(); do { mode = Program.EnterMode(); switch (mode) { case 'o': case 'O': OutputBookingMenu(); break; case 'a': case 'A': BookedFlights.OutputBookings(); break; case 'i': case 'I': BookingsBase.OutputCurrentBooking(CurBooking); break; case 'b': case 'B': Booking.BuyTicket(CurBooking); break; case 'k': case 'K': CurBooking = BookedFlights.FindByDate(FlightsTime.arrival); Program.WriteColorLine(" < Current booking was updated > \n", ConsoleColor.Green); break; case 'l': case 'L': CurBooking = BookedFlights.FindByDate(FlightsTime.departure); Program.WriteColorLine(" < Current booking was updated > \n", ConsoleColor.Green); break; case 'p': case 'P': CurBooking = BookedFlights.FindByPoints(); Program.WriteColorLine(" < Current booking was updated > \n", ConsoleColor.Green); break; case 'd': case 'D': BookedFlights.DelCurrentBooking(CurBooking); break; case 'q': case 'Q': break; default: Program.WriteColorLine(" < Wrong mode > ", ConsoleColor.Red); break; } } while (mode != 'q' && mode != 'Q'); Console.Clear(); }