Exemplo n.º 1
0
        private void btnAddSupplier_Click(object sender, EventArgs e)
        {
            Form_GridProductsSuppliers frm = new Form_GridProductsSuppliers("Suppliers");

            frm.ShowDialog();
            txtID.Text           = frm.dataGridView1.CurrentRow.Cells[0].Value.ToString();
            txtSupplierName.Text = frm.dataGridView1.CurrentRow.Cells[1].Value.ToString();
            txtTel.Text          = frm.dataGridView1.CurrentRow.Cells[2].Value.ToString();
            txtFax.Text          = frm.dataGridView1.CurrentRow.Cells[3].Value.ToString();
            txtEmail.Text        = frm.dataGridView1.CurrentRow.Cells[4].Value.ToString();
        }
Exemplo n.º 2
0
        private void btnAddProduct_Click(object sender, EventArgs e)
        {
            Form_GridProductsSuppliers frm = new Form_GridProductsSuppliers("Products");

            frm.ShowDialog();
            for (int i = 0; i < dgvProducts.Rows.Count; i++)
            {
                if (frm.dataGridView1.CurrentRow.Cells[0].Value.ToString() == dgvProducts.Rows[i].Cells[0].Value.ToString())
                {
                    MessageBox.Show("Ce produit a déjà été ajouté");
                    return;
                }
            }
            dgvProducts.Rows.Add(frm.dataGridView1.CurrentRow.Cells[0].Value,
                                 frm.dataGridView1.CurrentRow.Cells[1].Value,
                                 frm.dataGridView1.CurrentRow.Cells[2].Value,
                                 frm.dataGridView1.CurrentRow.Cells[3].Value,
                                 frm.dataGridView1.CurrentRow.Cells[7].Value);
            calcTotal();
        }