getRolID() public method

public getRolID ( string descripcion ) : long
descripcion string
return long
    protected void acceptButton_Click(object sender, EventArgs e)
    {
        try
        {
            List<string> revokes = new List<string>();
            //bool flag = false;

            foreach (ListItem it in permisos_CBList.Items)
            {
                if (it.Selected == false)
                {
                    revokes.Add(it.Text);
                    //flag = true;
                }
            }

            List<string> grants = new List<string>();

            foreach (ListItem it in otrosPermisos_CBList.Items)
            {
                if (it.Selected == true)
                {
                    grants.Add(it.Text);
                    //flag = true;
                }
            }

            /*if (flag)
            {*/
                BL.Rol rl = new Rol();
                long rolId = rl.getRolID(descripciones_DDList.SelectedItem.Text);
                AdministradordeSistema admin = new AdministradordeSistema();

                Security sec = new Security();
                long centro = sec.getCentroId(centros.Text);
                admin.editarRol(rolId, descripciones_DDList.SelectedItem.Text, grants, revokes, centro);

                Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol Editado')", true);
                setCheckBoxes();
            /*}
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol No Editado')", true);
            }*/
        }
        catch (Exception ex)
        {
            Session["Error_Msg"] = ex.Message;
            Response.Redirect("~/Error.aspx", true);
        }
    }
Beispiel #2
0
    protected void acceptButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.IsValid)
            {
                AdministradordeSistema admin = new AdministradordeSistema();//tmp
                int count = 0;
                BL.Rol rl = new Rol();

                foreach (ListItem it in roles_CBList.Items)
                {
                    if (it.Selected)
                    {
                        long rolId = rl.getRolID((it.Text));
                        admin.eliminarRol(rolId);
                        count++;
                    }
                }

                if (count > 1)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Roles Eliminados')", true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol Eliminado')", true);
                }
                setCheckBoxes();
            }
        }
        catch (Exception ex)
        {
            Session["Error_Msg"] = ex.Message;
            Response.Redirect("~/Error.aspx", true);
        }
    }
    protected void acceptButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.IsValid)
            {
                AdministradordeSistema admin = new AdministradordeSistema();//tmp
                int count = 0;
                BL.Rol rl = new Rol();

                foreach (ListItem it in roles_CBList.Items)
                {
                    if (it.Selected)
                    {
                        long rolId = rl.getRolID((it.Text));
                        admin.eliminarRol(rolId);
                        count++;
                    }
                }

                if (count > 1)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Roles Eliminados')", true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol Eliminado')", true);
                }
                setCheckBoxes();
            }
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert(" + ex.ToString() + " --Eliminar Roles.aspx.cs / acceptButton_Click()" + ")</script>");
        }
    }