Example #1
0
 public static string SearchFlight(Flight flight, int id)
 {
     int found = 0;
     for (int i = 0; i < 1; i++)
     {
         if (flight[i].id.Equals(id))
         {
             found = 1;
             return flight[i].ToString();
         }
     }
     if (found.Equals(0) || found == 0)
         return "No Flights Found";
     return "";
 }
Example #2
0
 public static void ShowLimitedFlightInfo(Flight f)
 {
     Console.WriteLine("Origin and Destination Only:");
     string msg = f.getOriginDestination();
     Console.WriteLine("{0}", msg);
 }
Example #3
0
 public static void ShowFullFlightInfo(Flight f)
 {
     Console.WriteLine("Full Info:");
     string msg = f.ToString();
     Console.WriteLine("{0}", msg);
 }
Example #4
0
        static void Main(string[] args)
        {
            Flight flight = new Flight();
            flight[0] = new Flight();
            flight[1] = new Flight();

            flight[0].id = 1000;
            flight[0].origin = "Honduras";
            flight[0].dest = "Siberia";
            flight[0].date = "2015-01-01";
            flight[0].price = 100;
            flight[1].id = 2000;
            flight[1].origin = "Siberia";
            flight[1].dest = "Honduras";
            flight[1].date = "2016-01-01";
            flight[1].price = 200;

            Console.WriteLine(Flight.SearchFlight(flight, 1000));

            CheckFlightDelegate cfdFull = new CheckFlightDelegate(Flight.ShowFullFlightInfo);
            CheckFlightDelegate cfdLimited = new CheckFlightDelegate(Flight.ShowLimitedFlightInfo);
            CheckFlightDelegate cfd = cfdFull + cfdLimited;
            flight[0].CheckPrice(cfd, 50);

            Console.WriteLine("Press enter to close...");
            Console.ReadLine();
        }