Esempio n. 1
0
        private void OKbutton_Click(object sender, EventArgs e)
        {
            if (NameComboBox.Text.Length == 0)
            {
                NameComboBox.BackColor = Color.IndianRed;
            }
            if (NameTextBox.TextLength == 0)
            {
                NameTextBox.BackColor = Color.IndianRed;
            }

            else if (NameComboBox.Text.Length != 0 && NameTextBox.TextLength != 0 &&
                     !AutoModelsListService.CheckCar(NameComboBox.Text + " " + NameTextBox.Text))
            {
                AutoRegistr autoregistrwin = new AutoRegistr(this);
                autoregistrwin.setNameTextBox1(NameComboBox);
                autoregistrwin.setNameTextBox2(NameTextBox);
                autoregistrwin.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Такая модель уже зарегестрирована", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.Close();
            }
        }
Esempio n. 2
0
 private void OKbutton_Click(object sender, EventArgs e)
 {
     if (CountryTextBox.TextLength == 0)
     {
         CountryTextBox.BackColor = Color.IndianRed;
     }
     else if (AutoModelsListService.CheckCountry(CountryTextBox.Text))
     {
         MessageBox.Show("Такая страна уже есть в списке", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         AutoListStorage.countryList.Add(CountryTextBox.Text);
         this.Close();
     }
 }
Esempio n. 3
0
        private void OpenInfoButton_Click(object sender, EventArgs e)
        {
            Control btn = (Control)sender;

            AutoForStorage openCar = new AutoForStorage();

            openCar = AutoModelsListService.CarSearch(btn.Name.Remove(0, 4));

            if (openCar != null)
            {
                AutoCard autocard = new AutoCard(openCar.ThisAutoModel.Mark, openCar.ThisAutoModel.Model, openCar.ThisAutoModel.Country, openCar.ThisAutoModel.Category.Name,
                                                 openCar.ThisAutoModel.Fuel, openCar.ThisAutoModel.FuelPerHour.ToString(), openCar.ThisAutoModel.SumLease.ToString(), openCar.CarsAmount.ToString(), openCar.ThisAutoModel.AutoPhoto);
                autocard.Show();
            }
            else
            {
                AutoCard autocard = new AutoCard();
                autocard.Show();
            }
        }
Esempio n. 4
0
        private void OpenAllButton_Click(object sender, EventArgs e)
        {
            Control btn = (Control)sender;

            AutoForStorage openCar = new AutoForStorage();

            openCar = AutoModelsListService.CarSearch(btn.Name);

            if (openCar != null)
            {
                AutoList automobilelist = new AutoList(flagCanAdd, openCar);
                automobilelist.Show();
            }
            else
            {
                AutoList automobilelist = new AutoList(flagCanAdd);
                automobilelist.Show();
            }
            //this.Refresh();
        }
Esempio n. 5
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            if (SearchTextBox.TextLength == 0)
            {
                MessageBox.Show("Введите данные для поиска", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                List <AutoForStorage> searchedCars = new List <AutoForStorage>(0);
                if (ModelRadioButton.Checked)
                {
                    searchedCars = AutoModelsListService.CarSearch(1, SearchTextBox.Text).ToList();
                }
                else if (CategoryRadioButton.Checked)
                {
                    searchedCars = AutoModelsListService.CarSearch(2, SearchTextBox.Text).ToList();
                }
                else if (MarkRadioButton.Checked)
                {
                    searchedCars = AutoModelsListService.CarSearch(3, SearchTextBox.Text).ToList();
                }

                autoListTable.Hide();
                repaint();

                if (searchedCars.Count == 0)
                {
                    MessageBox.Show("Такие автомобили не найдены.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ShowList(AutoListStorage.Cars);
                }
                else
                {
                    ShowList(searchedCars);
                }
                autoListTable.Show();
            }
        }
Esempio n. 6
0
 private void ReadyButton_Click(object sender, EventArgs e)
 {
     if (NameTextBox2.TextLength != 0 && NameTextBox1.Text.Length != 0 &&
         CountryComboBox.Text.Length != 0 && CategoryComboBox.Text.Length != 0 &&
         SumLeaseMaskedTextBox.MaskFull && PhotoPictureBox.Image != null)
     {
         AutoModel car = new AutoModel(NameTextBox1.Text, NameTextBox2.Text, CountryComboBox.Text, AutoCategoryListService.Search(CategoryComboBox.Text),
                                       FuelTextBox.Text, Double.Parse(FuelInHourTextBox.Text), Double.Parse(SumLeaseMaskedTextBox.Text.Remove(5, 2)), PhotoPictureBox.Image, AutoListStorage.Cars.Count + 1);
         AutoForStorage autoForStorage = new AutoForStorage(car, Convert.ToInt32(CountAutoDomainUpDown.Text));
         AutoModelsListService.CarRegistration(autoForStorage);
         DialogResult result;
         if (Convert.ToInt32(CountAutoDomainUpDown.Text) != 0)
         {
             result = MessageBox.Show("Регистрация новой модели автомобиля успешно завершена. Желаете зарегестрировать автомобили данной модели?", "",
                                      MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (result == DialogResult.Yes)
             {
                 for (int i = 1; i <= Convert.ToInt32(CountAutoDomainUpDown.Text); i++)
                 {
                     NewAutoOfModel newauto = new NewAutoOfModel(autoForStorage);
                     newauto.FlagFrom = false;
                     newauto.ShowDialog();
                 }
             }
         }
         else
         {
             result = MessageBox.Show("Регистрация новой модели автомобиля успешно завершена", "",
                                      MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         this.Close();
     }
     else
     {
         if (NameTextBox2.TextLength == 0)
         {
             NameTextBox2.BackColor = Color.IndianRed;
         }
         if (NameTextBox1.TextLength == 0)
         {
             NameTextBox1.BackColor = Color.IndianRed;
         }
         if (FuelInHourTextBox.TextLength == 0)
         {
             FuelInHourTextBox.BackColor = Color.IndianRed;
         }
         if (FuelTextBox.TextLength == 0)
         {
             FuelTextBox.BackColor = Color.IndianRed;
         }
         if (CountryComboBox.Text.Length == 0)
         {
             CountryComboBox.BackColor = Color.IndianRed;
         }
         if (CategoryComboBox.Text.Length == 0)
         {
             CategoryComboBox.BackColor = Color.IndianRed;
         }
         if (!SumLeaseMaskedTextBox.MaskFull)
         {
             SumLeaseMaskedTextBox.BackColor = Color.IndianRed;
         }
         if (PhotoPictureBox.Image == null)
         {
             PhotoPictureBox.BackColor = Color.IndianRed;
         }
     }
 }