コード例 #1
0
        public override PartialViewResult ListView()
        {
            string name      = Request["name"];
            string desc      = Request["desc"];
            string pageindex = Request["pageindex"];
            CustomPermissionsService   ps = new CustomPermissionsService();
            CustomPermissionsCondition pc = new CustomPermissionsCondition();

            pc.Name = name;
            pc.Desc = desc;

            pc.PageIndex = int.Parse(pageindex);
            pc.PageSize  = 8;
            Paging page = new Paging(pc);

            List <CustomPermissions> list = ps.GetListByMenuId(pc, ref page).ToList();

            BasePermissionListModel model = new BasePermissionListModel(list);

            model.Paging = page;

            model.condition = pc;

            return(PartialView("_ListView", model));
        }
コード例 #2
0
        public IPagedList <CustomPermissions> GetCustomPermissionsByMenu(CustomPermissionsCondition condition)
        {
            var query = new Repository <CustomPermissions>().Table;

            if (!string.IsNullOrEmpty(condition.Name))
            {
                query = query.Where(t => t.Name.Contains(condition.Name));
            }
            query = query.Where(t => t.MenuId == condition.NodeId);
            query = query.Where(t => t.IsDelete == false);
            query = query.OrderByDescending(t => t.CreateDate);

            return(new PagedList <CustomPermissions>(query, condition.PageIndex, condition.PageSize));
        }
コード例 #3
0
        public List <CustomPermissions> GetListByMenuId(CustomPermissionsCondition condition, ref Paging paging)
        {
            using (var repository = new Repository <CustomPermissions>())
            {
                Expression <Func <CustomPermissions, bool> > where = PredicateExtensions.True <CustomPermissions>();
                if (condition.NodeId != null)
                {
                    where = where.And(p => p.MenuId == condition.NodeId).Or(p => p.MenuId == null);
                }

                if (!string.IsNullOrEmpty(condition.Name))
                {
                    where = where.And(p => p.Name.Contains(condition.Name));
                }

                if (!string.IsNullOrEmpty(condition.Desc))
                {
                    where = where.And(p => p.Desc.Contains(condition.Desc));
                }

                return(repository.GetPaged(ref paging, where, m => m.MenuId, true).ToList());
            }
        }