protected void Page_Load(object sender, EventArgs e) { Lrbd.Business.Product objprod = new Lrbd.Business.Product(); GridView1.DataSource = objprod.getAllProducts(); GridView1.DataBind(); }
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"); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string Id = HttpUtility.ParseQueryString(this.ClientQueryString).Get("id"); Lrbd.Business.Product objp = new Lrbd.Business.Product(); List<ProductBase> returnItems = objp.getProductbyID(Id); foreach (ProductBase row in returnItems) { pId.Value = row.ProductID.ToString(); ProductName.Text = row.ProductName.ToString(); SKU.Text = row.SKU.ToString(); PDescription.Text = row.PDescription.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { Lrbd.Business.Product productobj = new Lrbd.Business.Product(); lstproducts = productobj.getAllProducts(); }