public static void addNewFlight(string flightNumber) { Console.WriteLine(String.Format("Thread {0} will create flight number {1}", Thread.CurrentThread.Name, flightNumber)); DateTime arrivalTime = new DateTime(2008, 1, 1, 12, 0, 0); DateTime departureTime = new DateTime(2008, 1, 1, 10, 0, 0); AdministratorServiceReference.AdministratorClient adminClient = new AdministratorServiceReference.AdministratorClient(); Console.WriteLine(adminClient.createNewFlight(flightNumber, 5, 100, 50, "asd", "xyz", arrivalTime, departureTime)); Thread.Sleep(5000); adminClient.Close(); }
static void Main(string[] args) { AdministratorServiceReference.AdministratorClient adminClient = new AdministratorServiceReference.AdministratorClient(); Console.WriteLine("Welcome to Airline Reservation Service : Administrator Portal"); int choice = -1; while (choice != 5) { Console.WriteLine("\nSupported Operations:\n"); Console.WriteLine("1. Show all flights\n2. Add new flight\n3. Show seating chart\n4. Run Admininistrator Test Suite\n5. Exit\n"); Console.WriteLine("Enter desired operation: "); string strChoice = Console.ReadLine(); bool isNumeric = int.TryParse(strChoice, out choice); if (!isNumeric) { Console.WriteLine("Invalid input.\n"); continue; } switch (choice) { case 1: Console.WriteLine("\n1. Show all flights\n"); Console.WriteLine("_______________________\n"); Console.WriteLine(adminClient.showAllFlights()); Console.WriteLine("_______________________"); break; case 2: Console.WriteLine("\n2. Add new flight\n"); addNewFlight(adminClient); break; case 3: Console.WriteLine("\n3. Show seating chart\n"); Console.WriteLine("Enter flight number: "); string flightNo = Console.ReadLine(); Console.WriteLine("_______________________\n"); Console.WriteLine(adminClient.showSeatingChart(flightNo)); Console.WriteLine("_______________________\n"); break; case 4: Console.WriteLine("4. Run Admininistrator Test Suite\n"); TestAdministratorThread.testAdminRole(); break; case 5: Console.WriteLine("\n5. Exit\n"); Console.WriteLine("Exiting Administrator Portal....\n"); break; default: Console.WriteLine(String.Format("\nEntered choice {0} was not recognized", choice)); break; } } adminClient.Close(); }