Example #1
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            FrmAddModifyProducts addproducts = new FrmAddModifyProducts
            {
                addproducts = true
            };
            DialogResult result = addproducts.ShowDialog();

            if (result == DialogResult.OK)
            {
                product = addproducts.products;
                dataGridView1.DataSource = ProductDB.GetAllProducts();
            }
        }
Example #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            var    cells  = dataGridView1.CurrentRow.Cells;
            string rowId  = cells[0].Value.ToString();
            string rowId1 = cells[1].Value.ToString();

            var selectedProductID = ProductDB.GetAllProducts(rowId);
            FrmAddModifyProducts modifyCustomerForm = new FrmAddModifyProducts
            {
                addproducts   = false,
                modifyProduct = selectedProductID
            };
            DialogResult result = modifyCustomerForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                product = modifyCustomerForm.products;
                //refresh the grid view
                dataGridView1.DataSource = ProductDB.GetAllProducts();
            }
        }