Пример #1
0
        public AdminWindow()
        {
            InitializeComponent();

            db = new FlightManagmentContext();

            Refreshh();

            var routesid = (
                from pass in db.RoutePass
                select pass).ToList();

            foreach (var elem in routesid)
            {
                fk.Items.Add(elem.PK_Route);
                depPoint.Items.Add(elem.DeparturePoint);
                depDate.Items.Add(elem.DepartureDate);
                arrPoint.Items.Add(elem.ArrivalPoint);
                arrDate.Items.Add(elem.ArrivalDate);
                fk_edit.Items.Add(elem.PK_Route);
            }

            var lastindex =
                from index in db.Flights
                select index;

            pk.Text = (lastindex.ToList().Last().PK_Flight + 1).ToString();
        }
Пример #2
0
        public MainWindow()
        {
            InitializeComponent();

            db = new FlightManagmentContext();

            _listBoxItemFlight = new ObservableCollection <FlightTable>(
                (from flights in db.Flights
                 join Routes in db.RoutePass on flights.FK_Route equals Routes.PK_Route
                 select new FlightTable
            {
                PK_Flight = flights.PK_Flight,
                FK_Route = flights.FK_Route,
                SeatCount = flights.SeatCount,
                DeparturePoint = Routes.DeparturePoint,
                ArrivalPoint = Routes.ArrivalPoint,
                DepartureDate = Routes.DepartureDate,
                ArrivalDate = Routes.ArrivalDate
            }));

            DB.ItemsSource = _listBoxItemFlight;
            DB.Items.Refresh();
        }