Beispiel #1
0
        public Journey()
        {
            InitializeComponent();
            DataBinder binder = new DataBinder();
            DatabaseController controller = new DatabaseController();

            binder.bindComboBox<Class>(cmbClass, controller.get<Class>("SELECT * FROM class"), "id", "name");
            binder.bindComboBox<Airport>(cmbTo, controller.get<Airport>("SELECT id, CONCAT(name, ' (', id, ')') as name FROM airport"), "id", "name");
            binder.bindComboBox<Airport>(cmbFrom, controller.get<Airport>("SELECT id, CONCAT(name, ' (', id, ')') as name FROM airport"), "id", "name");
            binder.bindComboBox<Airline>(cmbAirline, controller.get<Airline>("SELECT id, name FROM airline"), "id", "name");
        }
Beispiel #2
0
        public AddFlights()
        {
            InitializeComponent();

            controller = new DatabaseController();
            DataBinder binder = new DataBinder();

            flightCollection = new ObservableCollection<Flight>();
            gridFlights.ItemsSource = flightCollection;

            string queryJourney =
                "SELECT J.id, A1.name as 'from_airport_id', A2.name as 'to_airport_id' FROM journey J LEFT JOIN airport A1 ON J.from_airport_id = A1.id LEFT JOIN airport A2 ON J.to_airport_id = A2.id";
            journey = controller.get<Journey_>(queryJourney);

            journeyList = controller.get<Journey_>("SELECT * FROM journey");
            binder.bindComboBox<Journey_>(cmbJourney, journeyList, "id");
            flightList = controller.get<Flight>("SELECT * FROM flight");
            binder.bindComboBox<Flight>(cmbFlight, flightList, "id");
        }