private void btnSave_Click(object sender, EventArgs e) { //Add Suppliers if (AddSuppliers) { if (IsValidData()) { Supplier newSupp = new Supplier(); newSupp.SupName = txtSuppName.Text; saveStatus = true; try { SupplierDB.AddSupplier(newSupp); DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } } } else //Update Suppliers { if (IsValidData()) { supplier.SupName = txtSuppName.Text; saveStatus = true; try { supplier.UpdateSupp(); DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } } } }
public void DeleteSupp()//method to delete products { SupplierDB.DeleteSupplier(this); }
public void UpdateSupp()//method to update products { SupplierDB.UpdateSupplier(this); }