private void btnUpdate_Click(object sender, EventArgs e) { if (txtUpdate.Text != null) { ProductDB.UpdateProduct(txtUpdate.Text, oldprodname); txtUpdate.Text = ""; } product = ProductDB.GetAllProducts(); dataGridView1.DataSource = product; this.Refresh(); }
private void btnCreate_Click(object sender, EventArgs e) { if (txtCreate.Text != null) { ProductDB.AddProduct(txtCreate.Text); txtCreate.Text = ""; } product = ProductDB.GetAllProducts(); dataGridView1.DataSource = product; this.Refresh(); }
private void btnDeactivate_Click(object sender, EventArgs e) { if (txtUpdate.Text != null) { string deactivate = ("inactive" + txtUpdate.Text); ProductDB.UpdateProduct(deactivate, oldprodname); txtUpdate.Text = ""; } product = ProductDB.GetAllProducts(); dataGridView1.DataSource = product; this.Refresh(); }
private void frmProduct_Load(object sender, EventArgs e) { try { product = ProductDB.GetAllProducts(); dataGridView1.DataSource = product; } catch (Exception ex) { MessageBox.Show("Error while loading customers data: " + ex.Message, ex.GetType().ToString()); } }
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(); } }
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(); } }
private void frmProduct_Load(object sender, EventArgs e) { dataGridView1.DataSource = ProductDB.GetAllProducts(); dataGridView1.Rows[0].Selected = true; }