Esempio n. 1
0
        private void comboBoxLeaseCarCategory_SelectedValueChanged(object sender, EventArgs e)
        {
            if (!loaded) // костыль, отвратительный
            {
                loaded = true;
                return;
            }

            comboBoxLeaseCarCar.Items.Clear();
            comboBoxLeaseCarCar.Text = "";

            string categoryId = comboBoxLeaseCarCategory.Text.Split(' ')[0];

            if (categoryId == "All")
            {
                foreach (Car car in MainForm.cars)
                {
                    comboBoxLeaseCarCar.Items.Add($"{car.ID} {car.brand} {car.model} {car.yearOfProduction}");
                }
                comboBoxLeaseCarCar.SelectedIndex = 0;
                return;
            }

            List <Car> cars = carsPresenter.getCars(categoryId);

            foreach (Car car in cars)
            {
                comboBoxLeaseCarCar.Items.Add($"{car.ID} {car.brand} {car.model} {car.yearOfProduction}");
            }
            if (comboBoxLeaseCarCar.Items.Count != 0)
            {
                comboBoxLeaseCarCar.SelectedIndex = 0;
            }
            //обновляется список comboBoxLeaseCarCar в соответствии с выбранной категорией
        }
Esempio n. 2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            categories = categoriesPresenter.getCategories();
            clients    = clientPresenter.getClients();
            cars       = carsPresenter.getCars();
            foreach (Category cat in categories)
            {
                //listBoxCategories.Items.Add(cat.getName());
            }

            carsNotOccupied = carsPresenter.getCarsOccupied(false);
            carsOccupied    = carsPresenter.getCarsOccupied(true);

            activeContracts = contractPresenter.getActiveContracts();
        }
Esempio n. 3
0
        /*public void showCategoriesToDelete()
         * {
         *  foreach (Category cat in MainForm.categories)
         *  {
         *      listBoxDeleteCategories.Items.Add(cat.getName());
         *  }
         * }*/

        private void AdminForm_Load(object sender, EventArgs e)
        {
            // TODO: данная строка кода позволяет загрузить данные в таблицу "carRentalDBDataSet.Cars". При необходимости она может быть перемещена или удалена.
            toolStripLabelAdminName.Text = $"Welcome, {AuthPresenter.activeUser.name} {AuthPresenter.activeUser.surname}";
            MainForm.categories          = categoryPresenter.getCategories();
            //showCategoriesToDelete();
            foreach (Category cat in MainForm.categories)
            {
                listBoxDeleteCategories.Items.Add(cat.getName());
                comboBoxAddCarcategory.Items.Add(cat.getName());
            }
            comboBoxAddCarcategory.SelectedIndex = 0;

            MainForm.cars = carsPresenter.getCars();
            foreach (Car car in MainForm.cars)
            {
                comboBoxDeleteCar.Items.Add($"{car.ID} {car.brand} {car.model} {car.yearOfProduction}");
            }
            comboBoxDeleteCar.SelectedIndex = 0;

            comboBoxAddCarFuelType.DataSource   = Enum.GetNames(typeof(FuelType));
            comboBoxAddCarFuelType.SelectedItem = FuelType.Petrol;
        }