public JsonResult GetPointTxnDetailGrid(int limit, int offset, string sort, string sortOrder) { TablePageParameter gp = new TablePageParameter() { Limit = limit, Offset = offset, SortName = sort, SortOrder = sortOrder }; List <PointTxnDetail> pointTxnDetails = Service.GetPointTxnDetailGrid(gp); return(Json(new { total = gp.TotalCount, rows = pointTxnDetails }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetCompanyGrid(int limit, int offset, string sort, string sortOrder) { TablePageParameter gp = new TablePageParameter() { Limit = limit, Offset = offset, SortName = sort, SortOrder = sortOrder }; List <CompanyDto> companyDtos = Service.GetCompanyGrid(gp); return(Json(new { total = gp.TotalCount }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 列表查询 /// </summary> /// <param name="gp"></param> /// <returns></returns> public List <MenuTree> GetMenuGrid(TablePageParameter gp) { var sysMenu = sysMenuRepository.Entities; if (gp == null) { return(Mapper.Map <List <SysMenu>, List <MenuTree> >(sysMenu.ToList())); } return(Mapper.Map <List <SysMenu>, List <MenuTree> >(GetTablePagedList(sysMenu, gp))); }
public JsonResult GetStoreGrid(int limit, int offset, string sort, string sortOrder) { TablePageParameter gp = new TablePageParameter() { Limit = limit, Offset = offset, SortName = sort, SortOrder = sortOrder }; List <StoreReportDto> storeReportDtos = Service.GetStoreReportGrid(gp); return(Json(new { total = gp.TotalCount, rows = storeReportDtos }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetMenuGrid(int limit = 0, int offset = 0, string sort = "", string sortOrder = "") { TablePageParameter gp = new TablePageParameter() { Limit = limit, Offset = offset, SortName = sort, SortOrder = sortOrder }; List <Model.Dto.MenuTree> menuDtoDtos = Service.GetMenuGrid(gp); return(Json(new { total = gp.TotalCount, rows = menuDtoDtos }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 获取StoreReport列表 /// </summary> /// <param name="gp"></param> /// <returns></returns> public List <CompanyDto> GetCompanyGrid(TablePageParameter gp) { Expression <Func <Company, bool> > ex = t => true; ex = ex.And(t => !t.IsDelete); var CompanyList = CompanyRepository.GetEntities(ex); if (gp == null) { return(Mapper.Map <List <Company>, List <CompanyDto> >(CompanyList.ToList())); } else { return(Mapper.Map <List <Company>, List <CompanyDto> >(GetTablePagedList(CompanyList, gp))); } }
/// <summary> /// 获取StoreReport列表 /// </summary> /// <param name="gp"></param> /// <returns></returns> public List <StoreReportDto> GetStoreReportGrid(TablePageParameter gp) { Expression <Func <StoreReport, bool> > ex = t => true; ex = ex.And(t => !t.IsDelete); var storeReportList = storeReportRepository.GetEntities(ex); if (gp == null) { return(Mapper.Map <List <StoreReport>, List <StoreReportDto> >(storeReportList.ToList())); } else { return(Mapper.Map <List <StoreReport>, List <StoreReportDto> >(GetTablePagedList(storeReportList, gp))); } }
/// <summary> /// 分页 /// </summary> /// <param name="entitys"></param> /// <param name="gp"></param> /// <returns></returns> public List <T> GetTablePagedList <T>(IQueryable <T> entitys, TablePageParameter gp) { gp.PageParameterInit(entitys); if (!gp.NotSort) { if (string.IsNullOrEmpty(gp.SortName)) { entitys = entitys.OrderBy("Id"); } else { try { entitys = entitys.OrderBy(gp.SortName + " " + gp.SortOrder); //排序 } catch (Exception) { entitys = entitys.OrderBy("Id"); } } } entitys = entitys.Skip(gp.Offset).Take(gp.PageSize); //分页 return(entitys.ToList()); }
/// <summary> /// 获取PointTxnDetail列表 /// </summary> /// <param name="gp"></param> /// <returns></returns> public List <PointTxnDetail> GetPointTxnDetailGrid(TablePageParameter gp) { var storeReportList = pointTxnDetailtRepository.Entities; return(GetTablePagedList(storeReportList, gp)); }