public GridEditAirport(FlightService.Airport airport)
 {
     InitializeComponent();
     _fService = new FlightServiceClient();
     _airport  = airport;
     InsertAirportData();
 }
Esempio n. 2
0
        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();
        }
Esempio n. 4
0
        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");
            }
        }
        private IEnumerable <FlightService.Flight> RunDijkstra(FlightService.Airport @from, FlightService.Airport to, string date, bool usePrice)
        {
            var result = _fService.RunDijkstra(@from, to, date, usePrice);

            return(result);
        }