コード例 #1
0
 public void UpdateFlight(LoginToken <AirlineCompany> token, Flight flight)
 {
     if (token != null)
     {
         _flightDAO = new FlightDAOMSSQL();
         _flightDAO.Update(flight);
     }
 }
コード例 #2
0
        public Tickets PurchaseTicket(LoginToken <Customer> token, Flight flight)
        {
            Tickets ticket    = new Tickets();
            Flight  newFlight = new Flight(flight.AIRLINECOMPANY_ID, flight.ORIGIN_COUNTRY_CODE, flight.DESTINATION_COUNTRY_CODE, flight.DEPARTURE_TIME, flight.LANDING_TIME, flight.REMAINING_TICKETS, flight.AIRLINECOMPANY_NAME, flight.FLIGHT_NAME);

            if (token != null)
            {
                _flightDAO = new FlightDAOMSSQL();
                if (newFlight.REMAINING_TICKETS > 0)
                {
                    newFlight.REMAINING_TICKETS--;
                    _flightDAO.Update(newFlight);
                }
                long flightID = _flightDAO.GetFlightId(flight.FLIGHT_NAME);
                ticket.FLIGHT_ID = flightID;
            }
            return(ticket);
        }