BL.Rol.getRolPermisos C# (CSharp) Method

getRolPermisos() public method

public getRolPermisos ( long identity ) : List
identity long
return List
        public List<string> getRolPermisos(long identity)
        {
            try
            {
                List<string> pers = new List<string>();

                var rolsPers = from r in entidad.roles
                               where r.id == identity
                               select r;

                DataAccess.role rl = rolsPers.First();

                foreach (DataAccess.permiso p in rl.permisos)
                {
                    pers.Add(p.id);
                }

                return pers;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString() + " --Rol.cs / getRolPermisos()");
            }
        }

Same methods

Rol::getRolPermisos ( string description ) : List

Usage Example

    private void setCheckBoxes()
    {
        try
        {
            BL.Rol rl = new Rol();
            List<string> pers = rl.getRolPermisos(descripciones_DDList.SelectedItem.Text);
            permisos_CBList.DataSource = pers;
            permisos_CBList.DataBind();

            foreach (ListItem it in permisos_CBList.Items)
                it.Selected = true;

            BL.Permiso per = new Permiso();
            List<string> otherPers = new List<string>();
            List<string> allPers = per.getPermisosID();

            foreach (string pr in allPers)
            {
                bool flag = false;
                foreach (string myper in pers)
                {
                    if (pr == myper)
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                    otherPers.Add(pr);
            }
            otrosPermisos_CBList.DataSource = otherPers;
            otrosPermisos_CBList.DataBind();

            long c_id = rl.getCentroID(descripciones_DDList.SelectedItem.Text);
            BL.Centro c = new BL.Centro();
            string c_lugar = c.getLugar(c_id);
            centros.SelectedValue = c_lugar;

            /*for (int i = 0; i < centros.Items.Count; i++)
            {
                if (centros.Items[i].Text == c_lugar)
                {
                    centros.Items[i].Selected = true;

                    break;
                }
            }*/
        }
        catch (Exception ex)
        {
            Session["Error_Msg"] = ex.Message;
            Response.Redirect("~/Error.aspx", true);
        }
    }
All Usage Examples Of BL.Rol::getRolPermisos