Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                string header  = textBox2.Text;
                int    area    = Convert.ToInt32(textBox1.Text);
                int    region  = activeComboBox.SelectedIndex + 1;
                int    town    = SQLConnectionDelete.townID(comboBoxTown.SelectedValue.ToString());
                string address = textBoxAddress.Text;
                string whoBuy  = textBoxWho.Text;
                int    number  = Convert.ToInt32(textBoxNumb.Text);
                string comment = textBoxComment.Text;
                int    price   = Convert.ToInt32(textBoxPrice.Text);
                int    active  = 2;
                int    choose  = comboBox1.SelectedIndex + 1;

                SQLclassInsert.InsertOther(header, area, region, town, address, whoBuy, number, comment, price, active, choose);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Заполняйте данные правильно!\n" + ex.ToString(), "Error!AddOther!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                textBox2.Text       = null;
                textBox1.Text       = null;
                textBoxPrice.Text   = null;
                textBoxAddress.Text = null;
                textBoxWho.Text     = null;
                textBoxNumb.Text    = null;
                textBoxComment.Text = null;

                MessageBox.Show("Добавлено!!!", "Добавить", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 2
0
 private void button3_Click(object sender, EventArgs e)
 {
     SQLConnectionDelete.DeleteRegion(_idRegion);
     SQLConnectionDelete.RefreshRegion(this.dataGridView1);
     comboBox1.DataSource = SQLConnectionDelete.ComboRegion();
     comboBox3.DataSource = SQLConnectionDelete.ComboRegion();
 }
Ejemplo n.º 3
0
        private void button4_Click(object sender, EventArgs e)
        {
            SQLConnectionDelete.DeleteTown(_id);
            SQLConnectionDelete.RefreshTown(this.dataGridView2);

            comboBox2.DataSource = SQLConnectionDelete.ComboTown();
            comboBox4.DataSource = SQLConnectionDelete.ComboTown();
        }
Ejemplo n.º 4
0
        private void SettingsForms_Load(object sender, EventArgs e)
        {
            SQLConnectionDelete.RefreshTown(this.dataGridView2);
            SQLConnectionDelete.RefreshRegion(this.dataGridView1);

            comboBox1.DataSource = SQLConnectionDelete.ComboRegion();
            comboBox2.DataSource = SQLConnectionDelete.ComboTown();


            comboBox3.DataSource = SQLConnectionDelete.ComboRegion();
            comboBox4.DataSource = SQLConnectionDelete.ComboTown();

            SQLConnectionDelete.SelectTownRegion(this.dataGridView3);

            SQLclassUpdateR.Registration(this.dataGridView4);
        }
Ejemplo n.º 5
0
 private void button8_Click(object sender, EventArgs e)
 {
     try
     {
         SQLConnectionDelete.UpdateTownRegion(_idTownRegion, comboBox4.Text, comboBox3.Text);
         SQLConnectionDelete.RefreshRegion(this.dataGridView3);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "Заполняйте данные правильно!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         MessageBox.Show("Отредактированно!", "Редактировать", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 6
0
 private void button7_Click(object sender, EventArgs e)
 {
     try
     {
         SQLConnectionDelete.DeleteTownRegion(_idTownRegion);
         SQLConnectionDelete.SelectTownRegion(this.dataGridView3);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "Ошибка TOWN REGION!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         MessageBox.Show("Удалено!", "Удалить", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 7
0
        private void button9_Click(object sender, EventArgs e)
        {
            try
            {
                SQLConnectionDelete.InsertTownRegion(comboBox2.Text, comboBox1.Text);

                SQLConnectionDelete.SelectTownRegion(this.dataGridView3);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Ошибка TOWN REGION!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                MessageBox.Show("Добавлено!", "Добавить", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 8
0
        private void button5_Click(object sender, EventArgs e)
        {
            try
            {
                string _text = textBox5.Text;

                SQLConnectionDelete.UpdateTown(_id, _text);
                SQLConnectionDelete.RefreshTown(this.dataGridView2);
                comboBox2.DataSource = SQLConnectionDelete.ComboTown();

                comboBox4.DataSource = SQLConnectionDelete.ComboTown();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Заполняйте данные правильно!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                MessageBox.Show("Отредактировано!", "Отредактировать", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 9
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                SQLConnectionDelete.InsertRegion(textBox1.Text);
                SQLConnectionDelete.RefreshRegion(this.dataGridView1);

                comboBox1.DataSource = SQLConnectionDelete.ComboRegion();
                comboBox3.DataSource = SQLConnectionDelete.ComboRegion();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Заполняйте данные правильно!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                MessageBox.Show("Добавлено!", "Добавить", MessageBoxButtons.OK, MessageBoxIcon.Information);

                textBox1.Text = null;
            }
        }
Ejemplo n.º 10
0
        private void button6_Click(object sender, EventArgs e)
        {
            try
            {
                int    i     = dataGridView2.RowCount + 100;
                string _town = textBox6.Text;

                SQLConnectionDelete.InsertTown(i, _town);
                SQLConnectionDelete.RefreshTown(this.dataGridView2);

                comboBox2.DataSource = SQLConnectionDelete.ComboTown();

                comboBox4.DataSource = SQLConnectionDelete.ComboTown();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Заполняйте данные правильно!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                MessageBox.Show("Добавлено!", "Добавить", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox6.Text = null;
            }
        }
Ejemplo n.º 11
0
 private void activeComboBox_SelectedValueChanged(object sender, EventArgs e)
 {
     comboBoxTown.DataSource = SQLConnectionDelete.ComboTown(SQLConnectionDelete.RegionID(activeComboBox.SelectedValue.ToString()));
 }
Ejemplo n.º 12
0
 private void AddOther_Load(object sender, EventArgs e)
 {
     activeComboBox.DataSource = SQLConnectionDelete.ComboRegion();
 }