protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            HyperLink oHplInfo = (HyperLink)e.Item.FindControl("hplMensajeEdit");

            if (oHplInfo != null)
            {
                string s_idMensaje = oHplInfo.NavigateUrl;
                oHplInfo.NavigateUrl = "MensajeEdit.aspx?idMensaje=" + s_idMensaje + "&Operacion=Eliminar";

                MensajeInterno oMensaje = new MensajeInterno();
                oMensaje = (MensajeInterno)oMensaje.Get(typeof(MensajeInterno), int.Parse(s_idMensaje));
                if (oMensaje.IdUsuarioRegistro.ToString() == Session["idUsuario"].ToString())
                {
                    oHplInfo.Visible = true;
                }
                else
                {
                    oHplInfo.Visible = false;
                }
            }
        }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["idUsuario"] != null)
     {
         if (Request["Operacion"].ToString() == "Alta")
         {
             Usuario oUser = new Usuario();
             oUser      = (Usuario)oUser.Get(typeof(Usuario), int.Parse(Session["idUsuario"].ToString()));//Session["idUsuario"].ToString());
             txtDe.Text = oUser.Nombre + " " + oUser.Apellido;
         }
         if (Request["Operacion"].ToString() == "Eliminar")
         {
             MensajeInterno oRegistro = new MensajeInterno();
             oRegistro = (MensajeInterno)oRegistro.Get(typeof(MensajeInterno), int.Parse(Request["idMensaje"].ToString()));//Session["idUsuario"].ToString());
             oRegistro.Delete();
             Response.Redirect("Principal.aspx", false);
         }
     }
     else
     {
         Response.Redirect("FinSesion.aspx", false);
     }
 }