private void btnFlightLeg_Click_1(object sender, RoutedEventArgs e) { var selectedRoute = cmbRoute.SelectedItem as FlightRoute; var selectedPlane = cmbFlight.SelectedItem as Airplane; var flightDate = dateFlightDate.SelectedDate.Value; var departureTime = dteDepartureTime.Text.Split(':'); var arrivalTime = dteArrivalTime.Text.Split(':'); FlightLeg flightLeg = new FlightLeg() { FlightNumber = Convert.ToInt32(txtFlightNumber.Text), TravelDate = flightDate, SelectedRoute = selectedRoute, SelectedPlane = selectedPlane }; flightLeg.ScheduledDepartureTime = DateTime.Now.Date.Add(new TimeSpan(Convert.ToInt32(departureTime[0]),Convert.ToInt32(departureTime[1]),0)); //flightDate.AddHours(10), //Convert.ToDateTime(arrivalTime), flightLeg.ScheduledArrivalTime = DateTime.Now.Date.Add(new TimeSpan(Convert.ToInt32(arrivalTime[0]), Convert.ToInt32(arrivalTime[1]), 0)); //flightDate.AddHours(10), //Convert.ToDateTime(arrivalTime),//flightDate.AddHours(12),// Convert.ToDateTime(departureTime), new FlightManager().AddFlightLeg(flightLeg); var flightlegs = new FlightManager().GetFlightLegs(); dgFlightRoutes.ItemsSource = flightlegs; cmbRoute.SelectedItem = null; txtFlightNumber.Text = ""; }
void FlightRoute_Loaded(object sender, RoutedEventArgs e) { GetExistingRoutes(); var airports = new FlightManager().GetAirports(); cmbSource.ItemsSource = airports; cmbDestination.ItemsSource = airports; }
private void btnSearch_Click_1(object sender, RoutedEventArgs e) { var searchDate = dtSearchDate.SelectedDate.Value; var sourceAirport = cmbFrom.SelectedItem as AirportInfo; var destAirport = cmbTo.SelectedItem as AirportInfo; var flightLegs = new FlightManager().SearchFlights(sourceAirport.Code, destAirport.Code, searchDate); lsbSearchResults.ItemsSource = flightLegs; }
void FlightLegPage_Loaded(object sender, RoutedEventArgs e) { var flightRoutes = new FlightManager().GetFlightRoutes(); cmbRoute.ItemsSource = flightRoutes; var airplanes = new FlightManager().GetAirplances(); cmbFlight.ItemsSource = airplanes; var flightlegs = new FlightManager().GetFlightLegs(); dgFlightRoutes.ItemsSource = flightlegs; }
private void GetExistingRoutes() { var allRoutes = new FlightManager().GetFlightRoutes(); lvwFlightRoutes.ItemsSource = allRoutes; }
void FlightSearchPage_Loaded(object sender, RoutedEventArgs e) { var airports = new FlightManager().GetAirports(); cmbFrom.ItemsSource = airports; cmbTo.ItemsSource = airports; }
private void SendNotification(string message) { var flightLeg = dgFlightRoutes.SelectedItem as FlightLeg; var passengers = new FlightManager().GetFlightPassengers(flightLeg); StringBuilder emailMessage = new StringBuilder(); emailMessage.Append(message); emailMessage.Append(Environment.NewLine); foreach (var passenger in passengers) { emailMessage.Append(passenger.Email); emailMessage.Append(Environment.NewLine); } MessageBox.Show(emailMessage.ToString()); }