Example #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();
            }
        }
Example #2
0
        private void OKbutton_Click(object sender, EventArgs e)
        {
            if (NameComboBox.Text.Length != 0 && NameTextBox.TextLength != 0)
            {
                autoregistrwin.setNameTextBox1(NameComboBox);
                autoregistrwin.setNameTextBox2(NameTextBox);
                autoregistrwin.setCheckAutoModelWin(this);
                autoregistrwin.Show();
                this.Hide();
            }
            //else if (NameComboBox.Text.Length == 1 && NameTextBox.TextLength == 1)
            //{
            //    MessageBox.Show("Такая модель уже зарегестрирована", "Ошибка!");
            //    this.Close();
            //}

            if (NameComboBox.Text.Length == 0)
            {
                NameComboBox.BackColor = Color.IndianRed;
            }
            if (NameTextBox.TextLength == 0)
            {
                NameTextBox.BackColor = Color.IndianRed;
            }
        }