public GridEditCustomer(FlightService.Person person) { InitializeComponent(); _fService = new FlightServiceClient(); this._person = person; InsertCustomerData(); }
public GridSaveBooking(FlightService.Person customer, FlightService.Airport @from, FlightService.Airport to, string date, int noOfPass, List <FlightService.Flight> flights) { InitializeComponent(); _fService = new FlightServiceClient(); _passengerList = new List <FlightService.Person> { customer }; _from = @from; _to = to; _date = date; _noOfPass = noOfPass; _flights = flights; InitializeTxtboxes(); InitializeGridData(); btnNewBooking.Visibility = Visibility.Hidden; if (_passengerList.Count < noOfPass) { contentControl.Content = new GridAddPassenger(this); } else { contentControl.Content = null; btnCreate.Visibility = Visibility.Visible; } }
public GridFlightRoutes(FlightService.Person customer, FlightService.Airport @from, FlightService.Airport to, string date, int noOfPass) { InitializeComponent(); _fService = new FlightServiceClient(); _customer = customer; _from = @from; _to = to; _date = date; _noOfPass = noOfPass; InitializeGridData(); }
private void bFindFlights_Click(object sender, RoutedEventArgs e) { try { FlightService.Person customer = _fService.GetPersonByID(Int32.Parse(((ComboBoxItem)cbCustomer.SelectedItem).Tag.ToString())); FlightService.Airport @from = _fService.GetAirportByID(Int32.Parse(((ComboBoxItem)cbFrom.SelectedItem).Tag.ToString())); FlightService.Airport to = _fService.GetAirportByID(Int32.Parse(((ComboBoxItem)cbTo.SelectedItem).Tag.ToString())); int noOfPass = Int32.Parse(txtNoOfPass.Text); if (txtNoOfPass.Text != "" && dpDate.SelectedDate != null) { if (noOfPass >= 1) { if (@from.airportID != to.airportID) { contentControl.Content = new GridFlightRoutes(customer, @from, to, dpDate.SelectedDate.ToString().Substring(0, 10), noOfPass); } else { MainWindow.ErrorMsg("Fra og til skal være forskellige lufthavne"); } } else { MainWindow.ErrorMsg("Der skal mindst være 1 passager"); } } else { MainWindow.ErrorMsg("Alle felter skal være udfyldt før du kan søge"); } } catch (NullReferenceException err) { MainWindow.ErrorMsg("Alle felter skal være udfyldt før du kan søge"); } catch (FormatException err) { MainWindow.ErrorMsg("Antal passagerer skal være et tal"); } }
public void AddPassengerToList(FlightService.Person passenger) { _passengerList.Add(passenger); var passengers = from p in _passengerList select new { Fornavn = p.fname, Efternavn = p.lname }; dgPassengers.ItemsSource = passengers; if (_passengerList.Count < _noOfPass) { contentControl.Content = new GridAddPassenger(this); } else { contentControl.Content = null; ContentControlSuccess.Content = null; } }