Esempio n. 1
0
        public VNavActionDetails GetNavsByRolesNavId(string roleIds, int navId)
        {
            var list = new List <VNavActionDetails>();

            var roles = new List <int>();

            foreach (var roleid in roleIds.Split(','))
            {
                roles.Add(Convert.ToInt32(roleid));
            }

            var roleNavs = wmsauth.TPermRoleNavs.Where(x => roles.Contains(x.RoleId) && x.NavId == navId).ToList();

            var nav = wmsauth.TPermNavs.Where(x => x.Id == navId).FirstOrDefault();

            var roleActionIds = roleNavs.Select(x => x.ActionId).ToList();

            var actions = wmsauth.TPermNavActions
                          .Where(x => roleActionIds.Contains(x.Id)).ToList();


            var v = new VNavActionDetails();

            v.Nav        = nav;
            v.DetailList = actions.Where(x => x.NavId == nav.Id).ToList();

            return(v);
        }
Esempio n. 2
0
        public ICollection <VNavActionDetails> GetNavsByRoleId(int roleId)
        {
            var list          = new List <VNavActionDetails>();
            var roleNavIds    = wmsauth.TPermRoleNavs.Where(x => x.RoleId == roleId).Select(x => x.NavId).ToList();
            var roleActionIds = wmsauth.TPermRoleNavs.Where(x => x.RoleId == roleId).Select(x => x.ActionId).ToList();

            var navs    = wmsauth.TPermNavs.Where(x => roleNavIds.Contains(x.Id)).ToList();
            var actions = wmsauth.TPermNavActions
                          .Where(x => roleNavIds.Contains(x.NavId) && roleActionIds.Contains(x.Id)).ToList();

            foreach (var nav in navs)
            {
                var v = new VNavActionDetails();
                v.Nav        = nav;
                v.DetailList = actions.Where(x => x.NavId == nav.Id).ToList();
                list.Add(v);
            }

            return(list);
        }
Esempio n. 3
0
        public VNavActionDetails GetNavsByRoleNavId(int roleId, int navId)
        {
            var list = new List <VNavActionDetails>();

            var roleNavs = wmsauth.TPermRoleNavs.Where(x => x.RoleId == roleId && x.NavId == navId).ToList();

            var nav = wmsauth.TPermNavs.Where(x => x.Id == navId).FirstOrDefault();

            var roleActionIds = roleNavs.Select(x => x.ActionId).ToList();

            var actions = wmsauth.TPermNavActions
                          .Where(x => roleActionIds.Contains(x.Id)).ToList();


            var v = new VNavActionDetails();

            v.Nav        = nav;
            v.DetailList = actions.Where(x => x.NavId == nav.Id).ToList();

            return(v);
        }