Beispiel #1
0
        private void AddNewButton_Click(object sender, EventArgs e)
        {
            NewAutoOfModel newauto = new NewAutoOfModel(startMenu, Model);

            newauto.ShowDialog();
        }
Beispiel #2
0
        private void AddNewButton_Click(object sender, EventArgs e)
        {
            NewAutoOfModel newauto = new NewAutoOfModel();

            newauto.Show();
        }
Beispiel #3
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;
         }
     }
 }