protected void Button1_Click(object sender, EventArgs e) { string name = UserSearch.Text; ProductRepositoy r = new ProductRepositoy(); r.Search(name); }
protected void Page_Load(object sender, EventArgs e) { Table T = new Table(); ProductRepositoy r = new ProductRepositoy(); List <Product> L = r.GetallProducts(); foreach (Product p in L) { TableRow TR = new TableRow(); T.Rows.Add(TR); TableCell TC = new TableCell(); Image im = new Image(); im.ImageUrl = "~//" + p.PURL.ToString(); im.Width = 161; im.Height = 217; HyperLink HL = new HyperLink(); HL.Text = p.PName.ToString(); HL.ID = "Hyperlink_file"; HL.NavigateUrl = "ProductDescrptionPage.aspx?id=" + p.PId; PlaceHolder1.Controls.Add(im); PlaceHolder1.Controls.Add(HL); TR.Cells.Add(TC); } }
protected void Page_Load(object sender, EventArgs e) { ProductRepositoy r = new ProductRepositoy(); int id = Convert.ToInt32(Request.QueryString["id"]); Product P = r.GetProduct(id); ProductId.Text = P.PId.ToString(); }
protected void Button1_Click(object sender, EventArgs e) { int pid = Convert.ToInt32(ProductId.Text.ToString()); ProductRepositoy PR = new ProductRepositoy(); PR.Delete(pid); Response.Redirect("ProductManagementPage.aspx"); }
protected void Button1_Click1(object sender, EventArgs e) { String Pname = ProductName.Text; int price = Convert.ToInt32(Productprice.Text.ToString()); String URL = ProductImgUrl.Text; String Dec = Description.Text; int BrandId = Convert.ToInt32(DropDownList1.SelectedValue); ProductRepositoy PR = new ProductRepositoy(); PR.Insert(Pname, price, URL, Dec, BrandId); Response.Redirect("ProductManagementPage.aspx"); }
protected void Button1_Click1(object sender, EventArgs e) { int pid = Convert.ToInt32(ProductIdtxt.Text); String Pname = ProductNametxt.Text; String URL = ProdcutImgUrltxt.Text; int price = Convert.ToInt32(ProductPricetxt.Text); String Dec = Decriptiontxt.Text; int BrandId = Convert.ToInt32(DropDownList1.SelectedValue); ProductRepositoy PR = new ProductRepositoy(); PR.Update(pid, Pname, price, URL, Dec, BrandId); Response.Redirect("ProductManagementPage.aspx"); }
protected void Page_Load(object sender, EventArgs e) { ProductRepositoy r = new ProductRepositoy(); List <Product> L = r.GetallProducts(); int id = Convert.ToInt32(Request.QueryString["id"]); foreach (Product p in L) { if (id == p.PId) { Productid.Text = p.PId.ToString(); images.ImageUrl = p.PURL.ToString(); Name.Text = p.PName.ToString(); Price.Text = p.PPrice.ToString(); Description.Text = p.PDescription.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Context.User.IsInRole("Product")) { Response.Redirect("NotAuthorized.aspx"); } Table T = new Table(); ProductRepositoy r = new ProductRepositoy(); List <Product> L = r.GetallProducts(); foreach (Product p in L) { TableRow TR = new TableRow(); T.Rows.Add(TR); TableCell TC = new TableCell(); Image im = new Image(); im.ImageUrl = "~/" + p.PURL.ToString(); im.Width = 161; im.Height = 217; HyperLink HLPreview = new HyperLink(); HLPreview.Text = "Pre-View"; HLPreview.ID = "Hyperlink_file"; HLPreview.NavigateUrl = "ProductPreview.aspx?id=" + p.PId; HyperLink HLUpdate = new HyperLink(); HLUpdate.Text = "Update"; HLUpdate.ID = "Hyperlink_file"; HLUpdate.NavigateUrl = "ProductUpdate.aspx?id=" + p.PId; HyperLink HLDelete = new HyperLink(); HLDelete.Text = "Delete"; HLDelete.ID = "Hyperlink_file"; HLDelete.NavigateUrl = "ProductDelete.aspx?id=" + p.PId; PlaceHolder1.Controls.Add(im); PlaceHolder1.Controls.Add(HLPreview); PlaceHolder1.Controls.Add(HLUpdate); PlaceHolder1.Controls.Add(HLDelete); TR.Cells.Add(TC); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ProductRepositoy r = new ProductRepositoy(); BrandRepository br = new BrandRepository(); int id = Convert.ToInt32(Request.QueryString["id"]); Product P = r.GetProduct(id); List <Brand> L = br.GetBrand(); ProductIdtxt.Text = P.PId.ToString(); ProdcutImgUrltxt.Text = P.PURL.ToString(); ProductNametxt.Text = P.PName.ToString(); ProductPricetxt.Text = P.PPrice.ToString(); Decriptiontxt.Text = P.PDescription.ToString(); foreach (Brand b in L) { DropDownList1.SelectedValue = b.BrandId.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { //if (!Context.User.IsInRole("User")) //{ // Response.Redirect("NotAuthorized.aspx"); //} ProductRepositoy r = new ProductRepositoy(); List <Product> L = r.GetallProducts(); int id = Convert.ToInt32(Request.QueryString["id"]); foreach (Product p in L) { if (id == p.PId) { Image1.ImageUrl = p.PURL.ToString(); ProductName.Text = p.PName.ToString(); ProductPrice.Text = p.PPrice.ToString(); ProductDescrption.Text = p.PDescription.ToString(); } } }