Exemple #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         try
         {
             int intIdRol = int.Parse(Request.QueryString["IdRol"]);
             rol = new Rol();
             rol.Cargar(intIdRol);
             lblNombreRol.Text = rol.Nombre;
             Session["Rol"]    = rol;
             CargarRol();
             ViewState["From"] = Request.QueryString["From"];
         }
         catch
         {
             Response.Redirect("ListaRoles.aspx");
         }
         CargarFunciones();
     }
     else
     {
         rol = (Rol)Session["Rol"];
     }
 }
Exemple #2
0
        protected void btnAceptar_Click(object sender, EventArgs e)
        {
            Rol rol = new Rol();

            if (intIdRol != -1)
            {
                rol.Cargar(intIdRol);
                rol.Nombre      = txtNombre.Text;
                rol.Descripcion = txtDescripcion.Text;
                rol.Automatico  = chkAutomatico.Checked;
                rol.Extranet    = chkExtranet.Checked;
                rol.Modificar();
            }
            else
            {
                rol.Nombre      = txtNombre.Text;
                rol.Descripcion = txtDescripcion.Text;
                rol.Automatico  = chkAutomatico.Checked;
                rol.Extranet    = chkExtranet.Checked;
                rol.Crear();
            }
            if (((Button)sender).Text == "Aceptar")
            {
                Response.Redirect("ListaRoles.aspx");
            }
            else
            {
                Response.Redirect("FuncionAddRol.aspx?IdRol=" + rol.Id.ToString() + "&From=abm");
            }
        }
Exemple #3
0
        private void CargarRol(int lIdRol)
        {
            Rol rol = new Rol();

            rol.Cargar(lIdRol);
            txtNombre.Text        = rol.Nombre;
            txtDescripcion.Text   = rol.Descripcion;
            chkAutomatico.Checked = rol.Automatico;
            chkExtranet.Checked   = rol.Extranet;
        }
Exemple #4
0
 protected void btnAddRol_Click(object sender, EventArgs e)
 {
     if (lstRoles.SelectedItem != null && user.Roles[Convert.ToInt32(lstRoles.SelectedValue)] == null)
     {
         Rol rol = new Rol();
         rol.Cargar(Convert.ToInt32(lstRoles.SelectedValue));
         user.Roles.Add(rol.Id, rol);
         Session["Usuario"] = user;
         CargarUsuario();
         CargarRoles();
     }
 }