private void btnProductSuppliers_Click(object sender, EventArgs e) { frmProduct newForm = new frmProduct(); DialogResult result = newForm.ShowDialog(); SearchFor(); }
// view item button based on which radio button and item is selected private void btnView_Click(object sender, EventArgs e) { if (radPackages.Checked == false && radProducts.Checked == false && radSuppliers.Checked == false) { MessageBox.Show("Please select a database to view.", "Select a Database"); } else if (radPackages.Checked) { try { string i = lstView.SelectedItem.ToString(); string[] s = i.Split('|'); int packId = Int32.Parse(s[0].Trim()); frmPackage viewPackage = new frmPackage("View", packId); viewPackage.Show(); } catch { MessageBox.Show("Please select an item from the list before viewing.", "Select an Item"); } } else if (radProducts.Checked) { try { string i = lstView.SelectedItem.ToString(); string[] s = i.Split('|'); int proId = Int32.Parse(s[0].Trim()); frmProduct viewProduct = new frmProduct("View", proId); viewProduct.Show(); } catch { MessageBox.Show("Please select an item from the list before viewing.", "Select an Item"); } } else if (radSuppliers.Checked) { try { string i = lstView.SelectedItem.ToString(); string[] s = i.Split('|'); int supId = Int32.Parse(s[0].Trim()); frmSupplier viewSupplier = new frmSupplier("View", supId); viewSupplier.Show(); } catch { MessageBox.Show("Please select an item from the list before viewing.", "Select an Item"); } } }
// add item button based on which radio button is selected private void btnAdd_Click(object sender, EventArgs e) { if (radPackages.Checked == false && radProducts.Checked == false && radSuppliers.Checked == false) { MessageBox.Show("Please select a database to add to.", "Select a Database"); } else if (radPackages.Checked) { frmPackage viewPackage = new frmPackage("Add", null); viewPackage.Show(); } else if (radProducts.Checked) { frmProduct viewProduct = new frmProduct("Add", null); viewProduct.Show(); } else if (radSuppliers.Checked) { frmSupplier viewSupplier = new frmSupplier("Add", null); viewSupplier.Show(); } this.lstView.Refresh(); }
//product table private void btnProduct_Click(object sender, EventArgs e) { frmProduct f2 = new frmProduct(); f2.Show(); }