예제 #1
0
        private void btnCreateProduct_Click_1(object sender, EventArgs e)
        {
            Product           p = null;
            frmProductDetails frmProductDetails = new frmProductDetails(p);

            p = frmProductDetails.GetUpdateProduct();
            if (p != null) //need to check if product is null or exception occurs
            {
                productList.Add(p);
            }
            RefreshProductList(productList);
        }
예제 #2
0
        private void lsvProductList_DoubleClick_1(object sender, EventArgs e)
        {
            //get the id of selected product
            int productID = Convert.ToInt32(lsvProductList.SelectedItems[0].SubItems[0].Text);

            //search for id in product list and call update function
            Product updatedProduct = null;

            foreach (Product p in productList)
            {
                if (p.productID == productID)
                {
                    frmProductDetails frmProductDetails = new frmProductDetails(p);
                    updatedProduct = frmProductDetails.GetUpdateProduct();
                    p.Update(updatedProduct);
                }
            }
            RefreshProductList(productList);
        }