Example #1
0
 private void ReadyButton_Click(object sender, EventArgs e)
 {
     if (NameTextBox.TextLength != 0 && CodeTextBox.TextLength != 0)
     {
         AutoCategory newCategory = new AutoCategory(NameTextBox.Text, CodeTextBox.Text);
         AutoCategoryListService.CategoryRegistration(newCategory);
         MessageBox.Show("Регистрация новой категории автомобиля успешно завершена", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
     }
     else
     {
         if (NameTextBox.TextLength == 0)
         {
             NameTextBox.BackColor = Color.IndianRed;
         }
         if (CodeTextBox.TextLength == 0)
         {
             CodeTextBox.BackColor = Color.IndianRed;
         }
     }
 }
Example #2
0
 private void OKbutton_Click(object sender, EventArgs e)
 {
     if (NameTextBox.TextLength != 0)
     {
         if (AutoCategoryListService.Check(NameTextBox.Text))
         {
             MessageBox.Show("Такая категория уже зарегестрировна", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             this.Close();
         }
         else
         {
             AutoCategoryRegistr autocategoryregistr = new AutoCategoryRegistr(this);
             autocategoryregistr.setNameTextBox(NameTextBox);
             autocategoryregistr.setflag(flagwho);
             autocategoryregistr.ShowDialog();
             this.Hide();
         }
     }
     if (NameTextBox.TextLength == 0)
     {
         NameTextBox.BackColor = Color.IndianRed;
     }
 }
Example #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;
         }
     }
 }