public ActionResult GetAllActionInfos()
        {
            //jquery easyUI:table:{total:32,rows:[{},{}]}//需要json数据格式
            //jquery easyUI:table:在初始化时自动发送以下两个参数值
            int pageSize  = int.Parse(Request["rows"] ?? "10");
            int pageIndex = int.Parse(Request["page"] ?? "1");
            int total     = 0;
            //short delFlagNormal = (short)XDZ.RolePermission.Model.Enum.DelFlagEnum.Normal;
            //拿到过滤条件用户名和备注的值
            string schName    = Request["schName"];
            string schRemark  = Request["schRemark"];
            var    queryParam = new ActionQueryParam()
            {
                PageSize  = pageSize,
                PageIndex = pageIndex,
                Total     = total,
                SchName   = schName,
                SchRemark = schRemark
            };
            var pageData = ActionInfoBll.LoadPageData(queryParam);

            //获取部分列
            var temp = pageData.Select(u => new { ID = u.Id, u.ModifyOn, u.ActionName, u.Remark, u.HttpMethod, u.SubTime, u.IsMenu, u.Url, u.Sort, u.MenuIcon });
            var data = new { total = queryParam.Total, rows = temp.ToList() };

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public ActionResult GetAllActionInfos()
        {
            // jQuery easyui: table format: {total:32, rows:[{}{}]}

            // those data are passing through the Request from client, when the table is initialized.
            int pageSize  = int.Parse(Request["rows"] ?? "10");
            int pageIndex = int.Parse(Request["page"] ?? "1");
            int totalData = 0;

            string srchName   = Request["srchName"];
            string srchRemark = Request["srchRemark"];

            #region Old Pagination
            //// Get the current page data
            //// 如果有导航属性时,使用微软的默认序列化方式的时候会出现问题: 循环引用的问题
            //// 解决方案: 直接选要显示的属性(非导航属性)
            //var pageData = ActionInfoService.GetPageEntities(
            //    pageSize,
            //    pageIndex,
            //    out totalData,
            //    u => u.DelFlag == DelFlagEnum.Normal,
            //    u => u.Id,
            //    true).Select(u => new { u.Id, u.ActionName, u.Url, u.HttpMethod, u.IsMenu, u.MenuIcon, u.Sort, u.SubTime, u.ModifiedOn, u.Remark });
            #endregion

            var actionQueryParam = new ActionQueryParam()
            {
                PageIndex  = pageIndex,
                PageSize   = pageSize,
                Total      = 0,
                SrchName   = srchName,
                SrchRemark = srchRemark
            };

            var pageData = ActionInfoService.LoadPageData(actionQueryParam)
                           .Select(u => new { u.Id, u.ActionName, u.Url, u.HttpMethod, u.IsMenu, u.MenuIcon, u.Sort, u.SubTime, u.ModifiedOn, u.Remark });


            var data = new { total = actionQueryParam.Total, rows = pageData.ToList() };

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        public IQueryable <ActionInfo> LoadPageData(ActionQueryParam actionQueryParam)
        {
            short normalFlag = (short)gs.RolePermission.Model.Enum.DelFlagEnum.Normal;
            //拿到未删除的数据
            var temp = DbSession.ActionInfoDal.GetEntities(u => u.DelFlag == normalFlag);

            //过滤
            if (!string.IsNullOrEmpty(actionQueryParam.SchName))
            {
                temp = temp.Where(u => u.ActionName.Contains(actionQueryParam.SchName)).AsQueryable();
            }
            if (!string.IsNullOrEmpty(actionQueryParam.SchRemark))
            {
                temp = temp.Where(u => u.Remark.Contains(actionQueryParam.SchRemark)).AsQueryable();
            }
            actionQueryParam.Total = temp.Count();
            //分页
            return(temp.OrderBy(u => u.Id)
                   .Skip(actionQueryParam.PageSize * (actionQueryParam.PageIndex - 1))
                   .Take(actionQueryParam.PageSize).AsQueryable());
        }
Esempio n. 4
0
        //获取数据
        public ActionResult GetAllActionInfos()
        {
            int pageSize  = int.Parse(Request["rows"] ?? "10");
            int pageIndex = int.Parse(Request["page"] ?? "1");
            int total     = 0;

            string schName   = Request["schName"];
            string schRemark = Request["schRemark"];


            var queryParam = new ActionQueryParam()
            {
                PageIndex = pageIndex,
                PageSize  = pageSize,
                Total     = 0,
                SchName   = schName,
                SchRemark = schRemark
            };

            var pageData = ActionInfoService.LoagPageData(queryParam);
            var temp     = pageData.Select(
                a => new
            {
                ID = a.ID,
                a.IsMenu,
                a.Url,
                a.Remark,
                a.Sort,
                a.SubTime,
                a.ModfiedOn,
                a.HttpMethd,
                a.MenuIcon,
                a.ActionName
            });

            var data = new { total = queryParam.Total, rows = temp.ToList() };

            return(Json(data, JsonRequestBehavior.AllowGet));
        }