Esempio n. 1
0
        public static RoleManagerByTab GetByRoleIdAndTabId(string Guid, int moduleId)
        {
            RoleManagerByTab manager = new RoleManagerByTab();

            manager.RoleId   = Guid;
            manager.ModuleId = moduleId;

            ApplicationDbContext db        = new ApplicationDbContext();
            List <int>           tabIdList = db.ASPNETROLESHTML
                                             .Where(s => s.MODULEID == moduleId &&
                                                    s.ROLEID == Guid &&
                                                    s.TABID != null)
                                             .Select(s => s.TABID.Value).Distinct().ToList();

            foreach (int tid in tabIdList)
            {
                HtmlRoleWithTab tab1      = new HtmlRoleWithTab();
                HtmlRole        tabHeader = HtmlRole.GetTabHeader(Guid, moduleId, tid);
                List <HtmlRole> roles     = HtmlRole.GetHtmlRolesWithSort(Guid, moduleId, tid);
                tab1.TabHeader = tabHeader;
                tab1.HtmlRoles = roles;
                manager.HtmlRolesWithTabs.Add(tab1);
            }

            List <HtmlRoleWithTab> sorted = manager
                                            .HtmlRolesWithTabs.OrderBy(s => s.TabHeader.TabId).ToList();

            manager.HtmlRolesWithTabs = sorted;
            return(manager);
        }
Esempio n. 2
0
        public static RoleManager GetByRoleIdWithSort(string Guid, int moduleId, int tabId)
        {
            RoleManager manager = new RoleManager
            {
                RoleId   = Guid,
                ModuleId = moduleId
            };

            List <HtmlRole> roles = HtmlRole.GetHtmlRolesWithSort(Guid, moduleId, tabId);

            manager.HtmlRoles.AddRange(roles);

            return(manager);
        }