private void btnCreate_Click(object sender, EventArgs e) { if (txtCreate.Text != null) { Product_DB.AddProduct(txtCreate.Text); txtCreate.Text = ""; } product = Product_DB.GetAllProducts(); productDataGridView.DataSource = product; this.Refresh(); }
private void btnUpdate_Click(object sender, EventArgs e) { if (txtUpdate.Text != null) { Product_DB.UpdateProduct(txtUpdate.Text, oldprodname); txtUpdate.Text = ""; } product = Product_DB.GetAllProducts(); productDataGridView.DataSource = product; this.Refresh(); }
private void btnDeactivate_Click(object sender, EventArgs e) { if (txtUpdate.Text != null) { string deactivate = ("inactive" + txtUpdate.Text); Product_DB.UpdateProduct(deactivate, oldprodname); txtUpdate.Text = ""; } product = Product_DB.GetAllProducts(); productDataGridView.DataSource = product; this.Refresh(); }
private void ProductForm_Load(object sender, EventArgs e) { try { product = Product_DB.GetAllProducts(); productDataGridView.DataSource = product; } catch (Exception ex) { MessageBox.Show("Error while loading customers data: " + ex.Message, ex.GetType().ToString()); } }