예제 #1
0
        //Buttons (add/edit or delete)
        private void btnAddProduct_Click(object sender, EventArgs e)
        {
            disableButtons();
            Product     product    = new Product();
            ProductForm addProduct = new ProductForm(product);

            addProduct.Show();
        }
예제 #2
0
 private void btnEditProduct_Click(object sender, EventArgs e)
 {
     if (LV_products.SelectedItems.Count > 0)
     {
         //uses selected value to find in the DB and passes it through in the next form
         var         ProductID       = LV_products.SelectedItems[0].Tag;
         Product     selectedProduct = Program.db.Products.Find(ProductID);
         ProductForm editProduct     = new ProductForm(selectedProduct);
         disableButtons();
         editProduct.Show();
     }
 }