protected void Button1_Click(object sender, EventArgs e)
        {
            string fileName="";
            if (FileUpload1.HasFile)
            {
                //string filename = Path.GetFileName(FileUpload1.FileName);
                //FileUpload1.SaveAs(Server.MapPath("~/ProductImage") + filename);
                fileName = Path.Combine(Server.MapPath("~/ProductImage"), FileUpload1.FileName);
                //save the file to our local path
                FileUpload1.SaveAs(fileName);
            }

            Lrbd.Business.Product objpro = new Lrbd.Business.Product();
            Lrbd.BusinessEntity.ProductBase objp = new Lrbd.BusinessEntity.ProductBase();
            objp.PImage = (fileName != string.Empty) ? "~/ProductImage" + FileUpload1.FileName : "";
            objp.ProductName = ProductName.Text;
            objp.SKU = SKU.Text;
            objp.Price = Int32.Parse(Price.Text);
            objp.Quantity = Int32.Parse(Quantity.Text);
            objp.PDescription = PDescription.Text;

            objpro.InsertProduct(objp);           
           
            Response.Redirect("Productlisting.aspx");
        }
        public void InsertProduct(ProductBase objp)
        {
            List<SqlParameter> paramColl = new List<SqlParameter>();
            paramColl.Add(new SqlParameter() { DbType = System.Data.DbType.Int64, Value = objp.ProductName, ParameterName = "@Name" });
            paramColl.Add(new SqlParameter() { DbType = System.Data.DbType.Int64, Value = objp.SKU, ParameterName = "@Sku" });
            paramColl.Add(new SqlParameter() { DbType = System.Data.DbType.Int64, Value = objp.Price, ParameterName = "@Price" });
            paramColl.Add(new SqlParameter() { DbType = System.Data.DbType.Int64, Value = objp.Quantity, ParameterName = "@Quantity" });
            paramColl.Add(new SqlParameter() { DbType = System.Data.DbType.Int64, Value = objp.PDescription, ParameterName = "@Desc" });
            paramColl.Add(new SqlParameter() { DbType = System.Data.DbType.Int64, Value = objp.PImage, ParameterName = "@Imag" });

            LrbdDAL.ExecuteInsertStatement("Productadd", paramColl);
            
           
        }
        public List<ProductBase> GetAllProducts()
        {
            List<ProductBase> productColl = new List<ProductBase>();

            DataTable dtproductlist = LrbdDAL.ExecuteQueryStatement("ProductAll");
            foreach (DataRow row in dtproductlist.Rows)
            {
                ProductBase Obj_products = new ProductBase();
                Obj_products.ProductID = Int32.Parse(row["ProductID"].ToString());
                Obj_products.SKU = row["SKU"].ToString();
                Obj_products.ProductName = row["ProductName"].ToString();
                Obj_products.Price = Int32.Parse(row["Price"].ToString());
                Obj_products.PImage = row["PImage"].ToString();
                productColl.Add(Obj_products);
            }
            return productColl;
        }
 public List<ProductBase> GetProductbyID(int id)
 {
     List<ProductBase> productColl = new List<ProductBase>();
     List<SqlParameter> paramColl = new List<SqlParameter>();
     paramColl.Add(new SqlParameter() { DbType = System.Data.DbType.Int64, Value = id, ParameterName = "@id" });
     DataTable dtproductlist = LrbdDAL.ExecuteQueryStatement("ProductById", paramColl);
     foreach (DataRow row in dtproductlist.Rows)
     {
         ProductBase Obj_products = new ProductBase();
         Obj_products.ProductID = Int32.Parse(row["ProductID"].ToString());
         Obj_products.SKU = row["SKU"].ToString();
         Obj_products.ProductName = row["ProductName"].ToString();
         Obj_products.Price = Int32.Parse(row["Price"].ToString());
         Obj_products.PImage = row["PImage"].ToString();
         Obj_products.PDescription = row["PDescription"].ToString();
         productColl.Add(Obj_products);
     }
     return productColl;
 }
 public void InsertProduct(ProductBase objp)
 {
     objpro.InsertProduct(objp);
 }