Ejemplo n.º 1
0
 public Flights_cs FindFlightByID(int flightNumber)
 {
     lock (myLock)
     {
         Populate();
         Flights_cs a = new Flights_cs();
         a = null;
         foreach (Flights_cs m in list)
         {
             if (m.FlightNumber == flightNumber)
             {
                 a = m;
             }
         }
         return(a);
     }
 }
Ejemplo n.º 2
0
 public string ChangeFlight(int flightNumber, string type, string locationFrom, string locationTo, DateTime departureTime, DateTime arrivalTime)
 {
     lock (myLock)
     {
         Flights_cs flight  = FindFlightByID(flightNumber);
         string     message = "";
         if (flight != null)
         {
             flight.Type          = type;
             flight.LocationFrom  = locationFrom;
             flight.LocationTo    = locationTo;
             flight.DepartureDate = departureTime;
             flight.ArrivalDate   = arrivalTime;
             message = "You changed the flight";
         }
         else
         {
             message = "Flight not found";
         }
         return(message);
     }
 }
Ejemplo n.º 3
0
 public void Add(Flights_cs flight)
 {
     list.Add(flight);
 }