public List<SysException> GetList(ref GridPager pager, string queryStr)
        {
            List<SysException> query = null;
            IQueryable<SysException> list = ExceptionRepository.GetList(dbContainer);
            if (!string.IsNullOrWhiteSpace(queryStr))
            {
                list = list.Where(a => a.Message.Contains(queryStr));
                pager.totalRows = list.Count();
            }
            else
            {
                pager.totalRows = list.Count();
            }

            if (pager.order == "desc")
            {
                query = list.OrderByDescending(c => c.CreateTime).Skip((pager.page - 1) * pager.rows).Take(pager.rows).ToList();
            }
            else
            {
                query = list.OrderBy(c => c.CreateTime).Skip((pager.page - 1) * pager.rows).Take(pager.rows).ToList();
            }

            return query;
        }
Beispiel #2
0
        public JsonResult GetList(GridPager pager)
        {
            #if DEBUG
            using (StackExchange.Profiling.MiniProfiler.StepStatic("查询数据SysSample的数据"))
            {
            #endif
                List<App.Models.SysSample> list = bal.GetListPager("", ref pager);
                var json = new
                {
                    total = pager.totalRows,
                    rows = (from r in list
                            select new App.Models.SysSample()
                            {

                                Id = r.Id,
                                Name = r.Name,
                                Age = r.Age,
                                Bir = r.Bir,
                                Photo = r.Photo,
                                Note = r.Note,
                                CreateTime = r.CreateTime,

                            }).ToArray()
                };
                return Json(json, JsonRequestBehavior.AllowGet);
            #if DEBUG
            }
            #endif
        }
Beispiel #3
0
 public List<SysLogModel> GetList(IList<QueryParameter> list, ref GridPager pager)
 {
     var queryData = logRepository.GetList(db);
     var condition = QueryHelp.ToExpression<App.Entity.SysLog>(list);
     queryData = queryData.Where(condition);
     queryData = queryData.OrderBy(pager.sort, pager.order.Equals("desc", StringComparison.CurrentCultureIgnoreCase));
     pager.totalRows = queryData.Count();
     if (pager.totalRows > 0)
     {
         if (pager.page <= 1)
         {
             queryData = queryData.Take(pager.rows);
         }
         else
         {
             queryData = queryData.Skip((pager.page - 1) * pager.rows).Take(pager.rows);
         }
     }
     return ToSysLogModelList(ref queryData);
 }
        public JsonResult GetRightByRoleAndModule(GridPager pager, string roleId, string moduleId)
        {
            pager.rows = 100000;
            var right = sysRightBLL.GetRightByRoleAndModule(roleId, moduleId);
            var json = new
            {
                total = pager.totalRows,
                rows = (from r in right
                        select new SysRightModelByRoleAndModuleModel()
                        {
                            Ids = r.RightId + r.KeyCode,
                            Name = r.Name,
                            KeyCode = r.KeyCode,
                            IsValid = r.isvalid,
                            RightId = r.RightId
                        }).ToArray()

            };

            return Json(json);
        }
        public JsonResult GetList(GridPager pager, string queryStr)
        {
            List<SysException> list = exceptionBLL.GetList(ref pager, queryStr);
            var json = new
            {
                total = pager.totalRows,
                rows = (from r in list
                        select new SysException()
                        {
                            Id = r.Id,
                            HelpLink = r.HelpLink,
                            Message = r.Message,
                            Source = r.Source,
                            StackTrace = r.StackTrace,
                            TargetSite = r.TargetSite,
                            Data = r.Data,
                            CreateTime = r.CreateTime
                        }).ToArray()

            };
            return Json(json);
        }
        public JsonResult GetList(GridPager pager, string queryStr)
        {
            List<SysLog> list = logBLL.GetList(ref pager, queryStr);
            var json = new
            {
                total = pager.totalRows,
                rows = (from r in list
                        select new SysLogModel()
                        {

                            Id = r.Id,
                            Operator = r.Operator,
                            Message = r.Message,
                            Result = r.Result,
                            Type = r.Type,
                            Module = r.Module,
                            CreateTime = r.CreateTime

                        }).ToArray()

            };

            return Json(json);
        }
        public JsonResult GetList(GridPager pager, string queryStr)
        {
            List<SysUserModel> list = m_BLL.GetList(ref pager, queryStr);
            var json = new
            {
                total = pager.totalRows,
                rows = (from r in list
                        select new SysUserModel()
                        {

                            Id = r.Id,
                            UserName = r.UserName,
                            Password = r.Password,
                            TrueName = r.TrueName,
                            Card = r.Card,
                            MobileNumber = r.MobileNumber,
                            PhoneNumber = r.PhoneNumber,
                            QQ = r.QQ,
                            EmailAddress = r.EmailAddress,
                            OtherContact = r.OtherContact,
                            Province = r.Province,
                            City = r.City,
                            Village = r.Village,
                            Address = r.Address,
                            State = r.State,
                            CreateTime = r.CreateTime,
                            CreatePerson = r.CreatePerson,
                            Sex = r.Sex,
                            Birthday = r.Birthday,
                            JoinDate = r.JoinDate,
                            Marital = r.Marital,
                            Political = r.Political,
                            Nationality = r.Nationality,
                            Native = r.Native,
                            School = r.School,
                            Professional = r.Professional,
                            Degree = r.Degree,
                            DepId = r.DepId,
                            PosId = r.PosId,
                            Expertise = r.Expertise,
                            JobState = r.JobState,
                            Photo = r.Photo,
                            Attach = r.Attach

                        }).ToArray()

            };

            return Json(json);
        }
 public IQueryable<P_Sys_GetRoleByUserId_Result> GetRoleByUserId(ref GridPager pager, string userId)
 {
     IQueryable<P_Sys_GetRoleByUserId_Result> queryData = m_Rep.GetRoleByUserId(dbContainer, userId);
     pager.totalRows = queryData.Count();
     queryData = m_Rep.GetRoleByUserId(dbContainer, userId);
     return queryData.Skip((pager.page - 1) * pager.rows).Take(pager.rows);
 }
 public List<SysUserModel> GetList(ref GridPager pager, string queryStr)
 {
     IQueryable<SysUser> queryData = null;
     if (!string.IsNullOrWhiteSpace(queryStr))
     {
         queryData = m_Rep.GetList(dbContainer).Where(a => a.UserName.Contains(queryStr) || a.Id.Contains(queryStr));
     }
     else
     {
         queryData = m_Rep.GetList(dbContainer);
     }
     pager.totalRows = queryData.Count();
     queryData = LinqHelper.SortingAndPaging(queryData, pager.sort, pager.order, pager.page, pager.rows);
     return CreateModelList(ref queryData);
 }
        public JsonResult GetUserListByRole(GridPager pager, string roleId)
        {
            if (string.IsNullOrWhiteSpace(roleId))
                return Json(0);
            var userList = m_BLL.GetUserByRoleId(ref pager, roleId);

            var jsonData = new
            {
                total = pager.totalRows,
                rows = (
                    from r in userList
                    select new SysUserModel()
                    {
                        Id = r.Id,
                        UserName = r.UserName,
                        TrueName = r.TrueName,
                        Flag = r.flag == "0" ? "0" : "1",
                    }
                ).ToArray()
            };
            return Json(jsonData);
        }
        public JsonResult GetOptListByModule(GridPager pager, string mid)
        {
            pager.rows = 1000;
            pager.page = 1;
            List<SysModuleOperateModel> list = operateBLL.GetList(ref pager, mid);
            var json = new
            {
                total = pager.totalRows,
                rows = (from r in list
                        select new SysModuleOperateModel()
                        {
                            Id = r.Id,
                            Name = r.Name,
                            KeyCode = r.KeyCode,
                            ModuleId = r.ModuleId,
                            IsValid = r.IsValid,
                            Sort = r.Sort

                        }).ToArray()

            };

            return Json(json);
        }
        private List<SysSampleModel> CreateModelList(ref GridPager pager, ref IQueryable<SysSample> queryData)
        {
            pager.totalRows = queryData.Count();
            if (pager.totalRows > 0)
            {
                if (pager.page <= 1)
                {
                    queryData = queryData.Take(pager.rows);
                }
                else
                {
                    queryData = queryData.Skip((pager.page - 1) * pager.rows).Take(pager.rows);
                }
            }
            List<SysSampleModel> modelList = (from r in queryData
                                              select new SysSampleModel
                                              {
                                                  ID = r.ID,
                                                  Name = r.Name,
                                                  Age = r.Age,
                                                  Bir = r.Bir,
                                                  Photo = r.Photo,
                                                  Note = r.Note,
                                                  CreatTime = r.CreatTime,

                                              }).ToList();

            return modelList;
        }
 public List<SysSampleModel> GetList(ref GridPager pager)
 {
     IQueryable<SysSample> queryData = null;
     queryData = Rep.GetList(dbContainer);
     //排序
     queryData = LinqHelper.DataSorting(queryData, pager.sort, pager.order);
     return CreateModelList(ref pager, ref queryData);
 }
Beispiel #14
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <param name="queryStr"></param>
 /// <returns></returns>
 public List<SysSample> GetListPager(string queryStr, ref GridPager pager)
 {
     var queryData = Rep.GetList(db);
     var sort = pager.sort;
     queryData = queryData.OrderBy(sort, pager.order.Equals("desc", StringComparison.CurrentCultureIgnoreCase));
     pager.totalRows = queryData.Count();
     if (pager.totalRows > 0)
     {
         if (pager.page <= 1)
         {
             queryData = queryData.Take(pager.rows);
         }
         else
         {
             queryData = queryData.Skip((pager.page - 1) * pager.rows).Take(pager.rows);
         }
     }
     return ToSysSampleList(ref queryData);
 }
 public JsonResult GetRoleListByUser(GridPager pager, string userId)
 {
     if (string.IsNullOrWhiteSpace(userId))
         return Json(0);
     var userList = m_BLL.GetRoleByUserId(ref pager, userId);
     var jsonData = new
     {
         total = pager.totalRows,
         rows = (
             from r in userList
             select new SysRoleModel()
             {
                 Id = r.Id,
                 Name = r.Name,
                 Description = r.Description,
                 Flag = r.flag == "0" ? "0" : "1",
             }
         ).ToArray()
     };
     return Json(jsonData);
 }
        public JsonResult GetList(GridPager pager, string queryStr)
        {
            List<SysRoleModel> list = m_BLL.GetList(ref pager, queryStr);
            var json = new
            {
                total = pager.totalRows,
                rows = (from r in list
                        select new SysRoleModel()
                        {

                            Id = r.Id,
                            Name = r.Name,
                            Description = r.Description,
                            CreateTime = r.CreateTime,
                            CreatePerson = r.CreatePerson,
                            UserName = r.UserName

                        }).ToArray()

            };

            return Json(json);
        }
 public List<SysModuleOperateModel> GetList(ref GridPager pager, string mid)
 {
     IQueryable<SysModuleOperate> queryData = m_Rep.GetList(dbContainer).Where(a => a.ModuleId == mid);
     pager.totalRows = queryData.Count();
     queryData = LinqHelper.SortingAndPaging(queryData, pager.sort, pager.order, pager.page, pager.rows);
     return CreateModelList(ref queryData);
 }
        public JsonResult GetList(GridPager pager)
        {
            List<SysSampleModel> list = SysSampleBll.GetList(ref pager);
            var json = new
            {
                total = list.Count,
                rows = (from r in list
                        select new SysSampleModel()
                        {
                            ID = r.ID,
                            Name = r.Name,
                            Age = r.Age,
                            Bir = r.Bir,
                            Photo = r.Photo,
                            Note = r.Note,
                            CreatTime = r.CreatTime,

                        }).ToArray()
            };
            return Json(json, JsonRequestBehavior.AllowGet);
        }
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="pager">JQgrid分页</param>
        /// <param name="queryStr">搜索条件</param>
        /// <returns>列表</returns>
        public List<SysSampleModel> GetList(ref GridPager pager)
        {
            IQueryable<SysSample> queryData = null;

            queryData = Rep.GetList(db);

            //排序
            if (pager.order == "desc")
            {
                switch (pager.order)
                {
                    case "CreateTime":
                        queryData = queryData.OrderByDescending(c => c.CreateTime);
                        break;
                    case "Name":
                        queryData = queryData.OrderByDescending(c => c.Name);
                        break;
                    default:
                        queryData = queryData.OrderByDescending(c => c.CreateTime);
                        break;
                }
            }
            else
            {

                switch (pager.order)
                {
                    case "CreateTime":
                        queryData = queryData.OrderBy(c => c.CreateTime);
                        break;
                    case "Name":
                        queryData = queryData.OrderBy(c => c.Name);
                        break;
                    default:
                        queryData = queryData.OrderBy(c => c.CreateTime);
                        break;
                }
            }
            return CreateModelList(ref pager, ref queryData);
        }