protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["ImageID"] != null) { using (DBManualConnection db = new DBManualConnection()) { int id = Convert.ToInt32(Request.QueryString["ImageID"]); DataSet ds = db.getImagen(id); if (ds != null) { Byte[] bytes = (Byte[])ds.Tables[0].Rows[0]["imagen"]; Response.Buffer = true; Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "image/jpeg"; Response.AddHeader("content-disposition", "attachment;filename=" + id); Response.BinaryWrite(bytes); try { Response.Flush(); } catch (Exception ex) { Response.Write(ex); } Response.End(); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int pagina = 1; if (Request.QueryString["tipo"] != null) { if (Request.QueryString["page"] != null) { pagina = int.Parse(Request.QueryString["page"].ToString()); if (pagina >= 1) { if (pagina >= 5) { hpvDes1.Enabled = false; hpvDes2.Enabled = false; hpvAnt1.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=4"; hpvAnt2.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=4"; } if (pagina <= 1) { hpvAnt1.Enabled = false; hpvAnt2.Enabled = false; hpvDes1.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=2"; hpvDes2.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=2"; } else { hpvAnt1.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=" + (pagina - 1); hpvDes1.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=" + (pagina + 1); hpvAnt2.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=" + (pagina - 1); hpvDes2.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=" + (pagina + 1); } } } else { hpvAnt1.Enabled = false; hpvAnt2.Enabled = false; hpvDes1.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=2"; hpvDes2.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=2"; } HyperLink2.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=1"; HyperLink3.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=2"; HyperLink4.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=3"; HyperLink5.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=4"; HyperLink6.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=5"; HyperLink7.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=1"; HyperLink8.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=2"; HyperLink9.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=3"; HyperLink10.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=4"; HyperLink11.NavigateUrl = HttpContext.Current.Request.Url.AbsolutePath + "?tipo=" + Request.QueryString["tipo"].ToString() + "&page=5"; } using (DBManualConnection db = new DBManualConnection()) { String datos = Request.QueryString["tipo"].ToString(); String rango = ""; DataSet ds = db.getJuguetesRecomendados(datos, rango); this.Session["DataSetJuguetes"] = ds; if (ds.Tables[0].Rows.Count > (pagina - 1) * 15) { numArticulos.InnerText = "Resultado de " + ds.Tables[0].Rows.Count + " articulos"; repJueguetesListView.DataSource = ds; repJueguetesListView.DataBind(); repJueguetesBlockView.DataSource = ds.Tables[0].Rows.Cast <System.Data.DataRow>().Skip((pagina - 1) * 15).Take(15).CopyToDataTable(); repJueguetesBlockView.DataBind(); } else { numArticulos.InnerText = "Resultado de " + ds.Tables[0].Rows.Count + " articulos"; Hr1.Visible = true; lblNoContent.Visible = true; Hr2.Visible = true; } } actualizarCarrito(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int pagina = 1; if (Request.QueryString["page"] != null) { pagina = int.Parse(Request.QueryString["page"].ToString()); if (pagina >= 1) { if (pagina >= 5) { hpvDes1.Enabled = false; hpvDes2.Enabled = false; hpvAnt1.NavigateUrl = "~/JuguetesRecomendados.aspx?page=4"; hpvAnt2.NavigateUrl = "~/JuguetesRecomendados.aspx?page=4"; } if (pagina <= 1) { hpvAnt1.Enabled = false; hpvAnt2.Enabled = false; hpvDes1.NavigateUrl = "~/JuguetesRecomendados.aspx?page=2"; hpvDes2.NavigateUrl = "~/JuguetesRecomendados.aspx?page=2"; } else { hpvAnt1.NavigateUrl = "~/JuguetesRecomendados.aspx?page=" + (pagina - 1); hpvDes1.NavigateUrl = "~/JuguetesRecomendados.aspx?page=" + (pagina + 1); hpvAnt2.NavigateUrl = "~/JuguetesRecomendados.aspx?page=" + (pagina - 1); hpvDes2.NavigateUrl = "~/JuguetesRecomendados.aspx?page=" + (pagina + 1); } } } else { hpvAnt1.Enabled = false; hpvAnt2.Enabled = false; hpvDes1.NavigateUrl = "~/JuguetesRecomendados.aspx?page=2"; hpvDes2.NavigateUrl = "~/JuguetesRecomendados.aspx?page=2"; } using (DBManualConnection db = new DBManualConnection()) { if (Session["datosEncuesta"] != null || Session["rangoPrecios"] != null) { String datos = Session["datosEncuesta"].ToString(); String rango = Session["rangoPrecios"].ToString(); DataSet ds = db.getJuguetesRecomendados(datos, rango); this.Session["DataSetJuguetes"] = ds; if (ds.Tables[0].Rows.Count > (pagina - 1) * 15) { numArticulos.InnerText = "Resultado de " + ds.Tables[0].Rows.Count + " articulos"; repJueguetesListView.DataSource = ds; repJueguetesListView.DataBind(); repJueguetesBlockView.DataSource = ds.Tables[0].Rows.Cast <System.Data.DataRow>().Skip((pagina - 1) * 15).Take(15).CopyToDataTable(); repJueguetesBlockView.DataBind(); } else { numArticulos.InnerText = "Resultado de " + ds.Tables[0].Rows.Count + " articulos"; Hr1.Visible = true; lblNoContent.Visible = true; Hr2.Visible = true; } } else { numArticulos.InnerText = "Resultado de 0 articulos"; Hr1.Visible = true; lblNoContent.Text = "Conteste la encuesta antes de entrar aqui..."; lblNoContent.Visible = true; Hr2.Visible = true; } } actualizarCarrito(); } }