Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string parametroId = Request.QueryString["id"];
            int    id          = Convert.ToInt32(parametroId);


            Entidades.EntidadesPost elPost = postNegocio.ObtenerPost(id);
            if (elPost != null)
            {
                lblTitulo.Text  = elPost.Titulo;
                lblResumen.Text = elPost.Resumen;
                lblCuerpo.Text  = elPost.Cuerpo;
                List <CapaEntityFramework.Comentario> listado = comentarioNegocio.TodosLosComentarios(id);



                if (User.Identity.Name == "")
                {
                    txtAutor.Visible = true;
                }
                else if (User.Identity.Name != null)
                {
                    txtAutor.Visible = false;
                    lblAutor.Text    = "Autor: " + User.Identity.Name;
                }

                if (User.IsInRole("admin"))
                {
                    pnlAdmin.Visible = true;

                    lstComentarios.DataSource = listado;
                    lstComentarios.DataBind();
                }
                else if (User.IsInRole("admin") != true || User.Identity.Name == "")
                {
                    pnlUser.Visible = true;

                    ListView1.DataSource = listado;
                    ListView1.DataBind();
                }
            }
            else
            {
                Response.Redirect("~/Default.aspx");
            }
        }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack == false)
     {
         int id = Convert.ToInt32(Request.QueryString["id"]);
         Entidades.EntidadesPost post = postNegocio.ObtenerPost(id);
         if (post == null)
         {
             Response.Redirect("~/Post/ABMPost/ABMPost.aspx");
         }
         else
         {
             txtTitulo.Text  = post.Titulo;
             txtResumen.Text = post.Resumen;
             txtCuerpo.Text  = post.Cuerpo;
         }
     }
 }