Ejemplo n.º 1
0
        public MainWindow_CloseSession(SqlConnection conn, SessionQh session)
        {
            connection = conn;
            _session   = session;
            InitializeComponent();
            finesList = qm.QueryFines(connection);
            var descs = new List <string>();

            foreach (var fine in finesList)
            {
                descs.Add(fine.Fine_description);
            }
            FinesComboBox.ItemsSource = descs;
        }
Ejemplo n.º 2
0
        private void ShowSessionButton_OnClick(object sender, RoutedEventArgs e)
        {
            SessionQh selectedSession = (SessionQh)CurrentSessionsDataGrid.SelectedItem;

            if (selectedSession == null)
            {
                MessageBox.Show("Choose session to show");
                return;
            }
            var show = new MainWindow_Session(conn, selectedSession);

            show.ShowDialog();
            UpdateAll();
        }
Ejemplo n.º 3
0
        public MainWindow_Session(SqlConnection conn, SessionQh session)
        {
            InitializeComponent();
            connection      = conn;
            selectedSession = session;

            if (selectedSession != null)
            {
                var title = "Show session";
                Title = title;
                TitleTextBlock.Text = title;

                ClientButton.IsEnabled     = false;
                ClientComboBox.ItemsSource = null;
                var client = new List <ClientQh>()
                {
                    qm.QueryClients(connection).Find(x => x.Client_ID == selectedSession.Client_ID)
                };
                ClientComboBox.ItemsSource   = client;
                ClientComboBox.SelectedIndex = 0;
                ClientComboBox.IsEnabled     = false;

                CarButton.IsEnabled     = false;
                CarComboBox.ItemsSource = null;
                var car = new List <CarQh>()
                {
                    qm.QueryCars(connection).Find(x => x.Car_ID == selectedSession.Car_ID)
                };
                CarComboBox.ItemsSource   = car;
                CarComboBox.SelectedIndex = 0;
                CarComboBox.IsEnabled     = false;

                StartButton.IsEnabled     = false;
                StartComboBox.ItemsSource = null;
                var strt = new List <RentalQh>()
                {
                    qm.QueryRentals(connection).Find(x => x.Rental_ID == selectedSession.Start_location_ID)
                };
                StartComboBox.ItemsSource   = strt;
                StartComboBox.SelectedIndex = 0;
                StartComboBox.IsEnabled     = false;

                EndButton.IsEnabled     = false;
                EndComboBox.ItemsSource = null;
                var end_rental = new List <RentalQh>()
                {
                    qm.QueryRentals(connection).Find(x => x.Rental_ID == selectedSession.End_location_ID)
                };
                EndComboBox.ItemsSource   = end_rental;
                EndComboBox.SelectedIndex = 0;
                EndComboBox.IsEnabled     = false;

                ManagerButton.IsEnabled     = false;
                ManagerComboBox.ItemsSource = null;
                var manager = new List <ManagerQh>()
                {
                    qm.QueryManagers(connection).Find(x => x.Manager_ID == selectedSession.Manager_ID)
                };
                ManagerComboBox.ItemsSource   = manager;
                ManagerComboBox.SelectedIndex = 0;
                ManagerComboBox.IsEnabled     = false;
            }
            else
            {
                var title = "Add session";
                Title = title;
                TitleTextBlock.Text        = title;
                clients                    = qm.QueryClients(connection);
                ClientComboBox.ItemsSource = null;
                ClientComboBox.ItemsSource = clients;
            }
        }