private void btnSave_Click(object sender, EventArgs e) { if (Validator.IsNotEmpty(txtSupplierName, "Supplier Name")) { int supId = Convert.ToInt32(txtSupplierID.Text); string supName = txtSupplierName.Text; try { TravelSupplierDB updateSuppliers = new TravelSupplierDB(); //updateSuppliers.EditSupplier(supId, supName, prodId, prodName); updateSuppliers.EditSupplier(supId, supName); this.Close(); SupplierForm refreshSupplier = new SupplierForm(); refreshSupplier.Show(); refreshSupplier.Refresh(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().ToString()); } } }
private void btnDelete_Click(object sender, EventArgs e) { int supplierID = Convert.ToInt32(lblSupID.Text); TravelSupplierDB deleteSupplier = new TravelSupplierDB(); deleteSupplier.DeleteSupplier(lstViewSupplier, supplierID); this.Close(); SupplierForm refreshFrom = new SupplierForm(); refreshFrom.Refresh(); refreshFrom.Show(); }
private void lstViewSupplier_SelectedIndexChanged(object sender, EventArgs e) { TravelSupplierDB supplierDetails = new TravelSupplierDB(); supplierDetails.SelectedSupplier(lstViewSupplier, lblSupID, lblSupName); int suppId = Convert.ToInt32(lblSupID.Text); List <Supplier> prod = TravelSupplierDB.GetProducts(lstBoxProducts, suppId); //SupplierForm refreshFrom = new SupplierForm(); //refreshFrom.Refresh(); //if (listViewProducts.Items != null) //{ // int suppId = Convert.ToInt32(lblSupID.Text); // List<Supplier> prod = TravelSupplierDB.GetProduct(listViewProducts, suppId); //} }
public SupplierForm() { InitializeComponent(); List <Supplier> item = TravelSupplierDB.GetSupplier(lstViewSupplier); }