示例#1
0
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            Product product = GetProduct();
            ProductBL productBL = new ProductBL();

            try
            {
                // Delete the image.
                if (product.imageURL != "" && product.imageURL != null)
                {
                    File.Delete(Server.MapPath("~/Images/Products/") + product.imageURL);
                }
            }
            catch (Exception ex)
            {
                // TODO: Handle exception here.
            }

            // Delete the product itself.
            productBL.DeleteProduct(product);
            Response.Redirect("Products.aspx?secCategoryID=" + product.secCategoryID.ToString());

            productBL.Dispose();
        }
 public Product FindProductByID(Int32 id)
 {
     ProductBL bl = new ProductBL();
     return bl.GetProduct(id);
 }
 public Product FindProductByBarcode(String barcode)
 {
     ProductBL bl = new ProductBL();
     return bl.GetProductByBarcode(barcode);
 }