Esempio n. 1
0
        private void RedaktirTransport_Click(object sender, EventArgs e)
        {
            int key = dataGridViewTransport.CurrentRow.Index;

            if (key == 0)
            {
                MessageBox.Show("Не выбрана строка для редактирования");
            }
            else
            {
                TransportDialogForm f = new TransportDialogForm();
                f.Text                 = "Редактирование";
                f.textBoxMass.Text     = dataGridViewTransport[4, key].Value.ToString();
                f.textBoxOpisanie.Text = dataGridViewTransport[5, key].Value.ToString();
                f.textBox1.Text        = dataGridViewTransport[0, key].Value.ToString();
                if (f.ShowDialog() == DialogResult.OK)
                {
                    int       id       = Convert.ToInt32(f.textBox1.Text);
                    int       id_vid   = Convert.ToInt32(f.comboBoxIDvid.SelectedValue);
                    int       id_marka = Convert.ToInt32(f.comboBoxIDmarka.SelectedValue);
                    int       id_post  = Convert.ToInt32(f.comboBoxIDpostavchik.SelectedValue);
                    int       mass     = Convert.ToInt32(f.textBoxMass.Text);
                    string    h_op     = f.textBoxOpisanie.Text;
                    Transport t        = new Transport();
                    t.Update(id_vid, id_marka, id_post, mass, h_op, id);
                    this.all_Transport2TableAdapter1.Fill(this.skladDataSet9.All_Transport2);
                }
            }
        }
Esempio n. 2
0
        private void DobavlenieTransport_Click(object sender, EventArgs e)
        {
            TransportDialogForm f = new TransportDialogForm();

            if (f.ShowDialog() == DialogResult.OK)
            {
                int       id_vid    = Convert.ToInt32(f.comboBoxIDvid.SelectedValue);
                int       id_marka  = Convert.ToInt32(f.comboBoxIDmarka.SelectedValue);
                int       id_post   = Convert.ToInt32(f.comboBoxIDpostavchik.SelectedValue);
                int       mass      = Convert.ToInt32(f.textBoxMass.Text);
                string    h_op      = f.textBoxOpisanie.Text;
                Transport transport = new Transport();
                transport.Insert(id_vid, id_marka, id_post, mass, h_op);
                this.all_Transport2TableAdapter1.Fill(this.skladDataSet9.All_Transport2);
            }
        }