コード例 #1
0
        public ActionResult DisplayPage(Pager pager)
        {
            if (pager == null || !this.ModelState.IsValid)
            {
                return this.HttpNotFound("The specified page has disappeared without a trace");
            }

            if (pager.TotalPages == 0)
            {
                pager.TotalPages = this.quizzes.GetTotalPages(pager.CategoryName, QuizzesPerPage);
            }

            var rankingPeriod = new WeeklyRange();
            var maxSolutions = this.GetMaxSolutions(rankingPeriod);

            var models = this.Ranking.GetQuizzesOrderedBySolutions(rankingPeriod)
                .Where(q => q.Category.Name == pager.CategoryName)
                .ApplyPaging(pager)
                .To<QuizRankedBySolutions>()
                .ToArray();

            var viewModel = new HomePageViewModel(maxSolutions, rankingPeriod, pager)
            {
                Quizzes = models,
                Categories = this.GetTopCategories(),
            };

            return this.View(viewModel);
        }
コード例 #2
0
        public ActionResult List(PagerRequest request,SectionSearchOption search)
        {
            int totalCount;
            var linq = _sectionRepo.Get(s => (!search.SId.HasValue || search.SId.Value == s.Id) &&
                                          (string.IsNullOrEmpty(search.Name) || s.Name.StartsWith(search.Name)) &&
                                          (!search.BrandId.HasValue || search.BrandId.Value == s.BrandId) &&
                                          (!search.StoreId.HasValue || search.StoreId.Value == s.StoreId) &&
                                          s.Status!=(int)DataStatus.Deleted
                                          , out totalCount
                                                , request.PageIndex
                                                , request.PageSize
                                                , e => e.OrderByDescending(o => o.CreateDate));
            var data = linq.Join(_storeRepo.GetAll(), o => o.StoreId, i => i.Id, (o, i) => new { S = o, Store = i })
                .Join(_brandRepo.GetAll(), o => o.S.BrandId, i => i.Id, (o, i) => new { S = o.S, Store = o.Store, B = i })
                .ToList()
                .Select(l => new SectionViewModel().FromEntity<SectionViewModel>(l.S, p=>{
                    p.Store = new StoreViewModel().FromEntity<StoreViewModel>(l.Store);
                    p.Brand = new BrandViewModel().FromEntity<BrandViewModel>(l.B);
                }));


            var v = new Pager<SectionViewModel>(request, totalCount) { Data = data.ToList() };

            return View("List", v);
        }
コード例 #3
0
 public BaseResponse GetUserList(int pageSize, int page = 1)
 {
     var pager = new Pager(page, pageSize);
     var userList = DiUserService.GetUserList(pager);
     var rep = new SuccessListResponse<List<UserDto>>(userList, pager);
     return rep;
 }
コード例 #4
0
        public JsonResult ListP(CategorySearchOption search, PagerRequest request)
        {
            int totalCount;
            var linq = Context.Set<CategoryEntity>().Where(p => (string.IsNullOrEmpty(search.Name) || p.Name.Contains(search.Name)) &&
                (!search.PId.HasValue || p.ExCatId == search.PId.Value) &&
                p.Status != (int)DataStatus.Deleted);
           
            var linq2 = linq.GroupJoin(Context.Set<CategoryMapEntity>().Where(u => u.Status != (int)DataStatus.Deleted),
                    o => o.ExCatId,
                    i => i.CatId,
                    (o, i) => new { O = o, C = i })
                 ;

            totalCount = linq2.Count();

            var skipCount = (request.PageIndex - 1) * request.PageSize;

            var linq3 = skipCount == 0 ? linq2.Take(request.PageSize) : linq2.Skip(skipCount).Take(request.PageSize);

            var vo = from l in linq3.ToList()
                     select new CategoryViewModel().FromEntity<CategoryViewModel>(l.O, p =>
                     {
                         p.ShowCategories = l.C.Select(c => new ShowCategoryViewModel() { 
                            ShowChannel = c.ShowChannel
                         }).ToList() ;
                     });

            var v = new Pager<CategoryViewModel>(request, totalCount) { Data = vo.ToList() };
            return Json(v);
        }
コード例 #5
0
        public ActionResult Index(string BizID,int? page)
        {
            var lstAss = RecycleBinMapBiz.Instance.ListAllObjectsWithAssembly();
            
            if (string.IsNullOrWhiteSpace(BizID)&&lstAss.Count>0)
            {
                BizID = lstAss.First().BizID;
                return RedirectToAction("Index", new { BizID = BizID, page = page });
            }
            int pageno = 0;
            pageno = page == null ? 1 : page.Value;

            int pageSize = UGConstants.DefaultPageSize;
            long totalCount = 0;

            ViewBag.BizID = new SelectList(lstAss, RecycleBinMap.FIELD_BizID, RecycleBinMap.FIELD_BizName, BizID);
            ViewBag.TypeName = BizID;

            if (BizID == typeof(CompaniesBiz).FullName)
            {
                var lst = CompaniesBiz.Instance.ListAllObjectsIsBin(pageno, pageSize, out totalCount);
                Pager<Companies> pager = new Pager<Companies>(lst, pageno, pageSize, totalCount);
                ViewBag.ModelObj = pager;
            }
            else
                if (BizID == typeof(ComLocationStoreBiz).FullName)
                {
                    var lst = ComLocationStoreBiz.Instance.ListAllObjectsIsBin(pageno, pageSize, out totalCount);
                    Pager<ComLocationStore> pager = new Pager<ComLocationStore>(lst, pageno, pageSize, totalCount);
                    ViewBag.ModelObj = pager;
                }
            return View();
        }
コード例 #6
0
        public ActionResult GetProductPage(int page, int rows)
        {
            Pager<PM_Product> pager=new Pager<PM_Product>();
            try
            {
                String sort = Request.Params["sort"];
                String order = Request.Params["order"];
                String pm_TPName = Request.Params["pm_TPName"];
                String pm_TPJjfaName = Request.Params["pm_TPJjfaName"];
                String pm_TPLead = Request.Params["pm_TPLead"];
                String pm_TPAddtime = Request.Params["pm_TPAddtime"];

                Dictionary<String,Object> di=new Dictionary<string, object>();
                di.Add("pm_TPName", pm_TPName);
                di.Add("pm_TPJjfaName", pm_TPJjfaName);
                di.Add("pm_TPLead", pm_TPLead);
                di.Add("pm_TPAddtime", pm_TPAddtime);
                pager = this.iProductManager.FinPager(di, page, rows);

            }
            catch (Exception)
            {
                pager=new Pager<PM_Product>();
            }
            return Json(pager, JsonRequestBehavior.AllowGet);
        }
コード例 #7
0
 // GET: Admin/IoTClients
 public ActionResult Index(int? page)
 {
     int pageno = 0;
     pageno = page == null ? 1 : page.Value;
     int pageSize = UGConstants.DefaultPageSize;
     var query = IoTClientManager.IoTClients.Where(x => !x.Deleted).OrderBy(x => x.ClientId);
     Pager<IoTClient> pager = new Pager<IoTClient>(query, pageno, pageSize);
     return View(pager);
 }
コード例 #8
0
ファイル: HomeController.cs プロジェクト: zealoussnow/OneCode
        /// <summary>
        /// 用来显示分页
        /// </summary>
        /// <param name="id">当前页面序号</param>
        /// <returns>操作结果</returns>
        public ActionResult Index(int? id)
        {
            int pageIndex = Convert.ToInt32(id);
            List<Employee> empList = EmployeeSet.Employees;
            int pagesSize = 5;

            Pager<Employee> pager = new Pager<Employee>(empList, pageIndex, Url.Content("~/Home/Index"), Url.Content("~/images/left.gif"), Url.Content("~/images/right.gif"), pagesSize);

            ViewData["pager"] = pager;
            return View(empList.Skip(pager.pageSize * pageIndex).Take(pager.pageSize));
        }
コード例 #9
0
 public ActionResult ProductByBrand(PagerRequest request, ReportByProductBrandOption search)
 {
     if (!ModelState.IsValid)
     {
         ViewBag.SearchOptions = search;
         return View();
     }
     var prods = searchProduct(search);
     var v = new Pager<ProductByBrandReportViewModel>(request, prods.Count()) { Data = prods.ToList() };
     ViewBag.SearchOptions = search;
     return View(v);
 }
コード例 #10
0
 public ActionResult StoreCouponUsage(PagerRequest request, StoreCouponUsageOption search)
 {
     if (!ModelState.IsValid)
     {
         ViewBag.SearchOptions = search;
         return View();
     }
     var prods = searchCouponLog(search);
     var v = new Pager<StoreCouponUsageViewModel>(request, prods.Count()) { Data = prods.ToList() };
     ViewBag.SearchOptions = search;
     return View(v);
 }
コード例 #11
0
		public ActionResult UnCategorizedRecipes(int? page)
		{
			var pager = new Pager { CurrentPage = page ?? 1, ItemsPerPage = this.WebSettings.DefaultRecipesPerPage };

			var recipes = this.BeerStyleService.GetUnCategorizedRecipesPage(pager);

			if (recipes.Any() && !pager.IsInRange())
			{
				return this.Issue404();
			}

			return View("UnCategorized", new UnCategorizedRecipesViewModel { Recipes = recipes, Pager = pager, 
				BaseUrl = Url.Action("other-homebrew-recipes", "Recipe", new { page = (int?)null }, "http")});
		}
コード例 #12
0
        public ActionResult List(PagerRequest request,TagPropertyValueSearchOption search)
        {
            int totalCount;
            var linq = _tagpropertyvalueRepo.Get(pv => pv.Status != (int)DataStatus.Deleted)
                        .Join(_tagpropertyRepo.Get(p => p.Status != (int)DataStatus.Deleted), o => o.PropertyId, i => i.Id, (o, i) => new { PV = o, P = i })
                        .Join(_tagRepo.GetAll(), o => o.P.CategoryId, i => i.Id, (o, i) => new { PV = o.PV, P = o.P, T = i })
                        .Where(l => (!search.PId.HasValue || l.PV.Id == search.PId.Value) &&
                                   (string.IsNullOrEmpty(search.PropertyDesc) || l.P.PropertyDesc.StartsWith(search.PropertyDesc)) &&
                                   (string.IsNullOrEmpty(search.ValueDesc) || l.PV.ValueDesc.StartsWith(search.ValueDesc)) &&
                                   (!search.CategoryId.HasValue || l.P.CategoryId == search.CategoryId.Value));
            linq = linq.WhereWithPageSort(
                                                 out totalCount
                                                , request.PageIndex
                                                , request.PageSize
                                                , e =>
                                                {
                                                    return e.OrderByDescending(l => l.P.CategoryId).ThenByDescending(l => l.P.CreatedDate);
                                                });
             var vo = new List<TagPropertyViewModel>();
            foreach (var l in linq)
            {
                var existProperty = vo.Find(t=>t.CategoryId == l.P.CategoryId);
                var newValue = new TagPropertyValueViewModel().FromEntity<TagPropertyValueViewModel>(l.PV,p=>{
                    p.PropertyDesc = l.P.PropertyDesc;
                    p.SortOrder = l.P.SortOrder;
                    p.PropertyId = l.P.Id;
                    p.ValueId = l.PV.Id;
                   
                });
                if (existProperty != null)
                {
                    existProperty.Values.Add(newValue);
                    
                } else
                {
                    vo.Add(new TagPropertyViewModel().FromEntity<TagPropertyViewModel>(l.P,p=>{
  
                        p.CategoryName = l.T.Name;
                        p.Values = new List<TagPropertyValueViewModel>();
                        p.Values.Add(newValue);
                    }));
                }
    
            }
              
            var v = new Pager<TagPropertyViewModel>(request, totalCount) { Data =vo };

            return View("List", v);
        }
コード例 #13
0
        public ActionResult List(PagerRequest request)
        {
            int totalCount;
           
            var data = _wxRepo.Get(w=>w.Status!=(int)DataStatus.Deleted,
                            out totalCount,
                            request.PageIndex,
                            request.PageSize,
                            w=>w.OrderByDescending(wi=>wi.UpdateDate));
            var vo = data.ToList().Select(d => new WXReplyViewModel().FromEntity<WXReplyViewModel>(d));
          
            var v = new Pager<WXReplyViewModel>(request, totalCount) { Data = vo.ToList() };

            return View("List", v);
        }
コード例 #14
0
        public ActionResult GetUserPager(int page, int rows)
        {
            Pager<PM_User> pager = new Pager<PM_User>();
            try
            {
                pager = this.iUserManager.FinPager(null, page, rows);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);

                pager = new Pager<PM_User>();
            }
            return Json(pager, JsonRequestBehavior.AllowGet);
        }
コード例 #15
0
        public ActionResult List(PagerRequest request, StorePromotionSearchOption search)
        {
            int totalCount;
            var dbContext = _storepromotionRepo.Context;
            var linq = from e in dbContext.Set<StorePromotionEntity>()
                       let scope = from es in dbContext.Set<StorePromotionScopeEntity>()
                                   where es.StorePromotionId == e.Id && es.StoreId == search.StoreId.Value
                                   select es

                        where (!search.SId.HasValue || e.Id == search.SId.Value)
                                && (string.IsNullOrEmpty(search.Name) || e.Name.ToLower().StartsWith(search.Name.ToLower()))
                                && (!search.Status.HasValue || e.Status == (int)search.Status.Value)
                                && (!search.ActiveStartDate.HasValue || e.ActiveStartDate >= search.ActiveStartDate.Value)
                                && (!search.ActiveEndDate.HasValue || e.ActiveEndDate >= search.ActiveEndDate.Value)
                                && e.Status != (int)DataStatus.Deleted
                                && (!search.StoreId.HasValue || scope.Any())
                        select e;
            linq = linq.WhereWithPageSort<StorePromotionEntity>(
                                                 out totalCount
                                                , request.PageIndex
                                                , request.PageSize
                                                , e =>
                                                {
                                                    if (!search.SortBy.HasValue)
                                                        return e.OrderByDescending(o => o.CreateDate);
                                                    else
                                                    {
                                                        switch (search.SortBy.Value)
                                                        {
                                                            case GenericOrder.OrderByCreateUser:
                                                                return e.OrderByDescending(o => o.CreateUser);
                                                            case GenericOrder.OrderByName:
                                                                return e.OrderByDescending(o => o.Name);
                                                            case GenericOrder.OrderByCreateDate:
                                                            default:
                                                                return e.OrderByDescending(o => o.CreateDate);

                                                        }
                                                    }
                                                });

            var vo = from l in linq.ToList()
                     select new StorePromotionViewModel().FromEntity<StorePromotionViewModel>(l);

            var v = new Pager<StorePromotionViewModel>(request, totalCount) { Data = vo.ToList() };
            ViewBag.SearchOptions = search;
            return View("List", v);
        }
コード例 #16
0
 public static MvcHtmlString SetPager(this AjaxHelper ajaxHelper, PagerOption option, AjaxOptions ajaxOptions, object values = null)
 {
     if (option.CurentPage < 1)
     {
         return MvcHtmlString.Empty;
     }
     RouteValueDictionary routeDictionary = null;
     if (values != null)
     {
         routeDictionary = new RouteValueDictionary(values);
     }
     else
     {
         routeDictionary = new RouteValueDictionary();
     }
     var pager = new Pager(option, routeDictionary, ajaxHelper.ViewContext, ajaxHelper, ajaxOptions);
     return MvcHtmlString.Create(pager.BuildLinks());
 }
コード例 #17
0
        public ActionResult List(OrderSearchOption search, PagerRequest request)
        {
            int totalCount;
            search.CurrentUser = CurrentUser.CustomerId;
            search.CurrentUserRole = CurrentUser.Role;
            var dbContext = _orderRepo.Context;
            var linq = dbContext.Set<OrderEntity>().Where(p => (string.IsNullOrEmpty(search.OrderNo) || p.OrderNo == search.OrderNo) &&
                (!search.CustomerId.HasValue || p.CustomerId == search.CustomerId.Value) &&
                (!search.Status.HasValue || p.Status == (int)search.Status.Value) &&
                     (!search.Store.HasValue || p.StoreId == search.Store.Value) &&
                      (!search.Brand.HasValue || p.BrandId == search.Brand.Value) &&
                      (!search.FromDate.HasValue || p.CreateDate>=search.FromDate.Value) &&
                      (!search.ToDate.HasValue || p.CreateDate<=search.ToDate.Value) &&
                p.Status !=(int)DataStatus.Deleted);
            linq = _userAuthRepo.AuthFilter(linq, search.CurrentUser, search.CurrentUserRole) as IQueryable<OrderEntity>;

            var linq2 = linq.Join(dbContext.Set<UserEntity>().Where(u => u.Status != (int)DataStatus.Deleted),
                    o => o.CustomerId,
                    i => i.Id,
                    (o, i) => new { O = o,C =i})
                .GroupJoin(dbContext.Set<ShipViaEntity>().Where(s => s.Status != (int)DataStatus.Deleted),
                    o => o.O.ShippingVia,
                    i => i.Id,
                    (o, i) => new { O = o.O,C =o.C, S = i.FirstOrDefault() }).OrderByDescending(l => l.O.CreateDate);
            
           
            totalCount = linq2.Count();

            var skipCount = (request.PageIndex - 1) * request.PageSize;

            var linq3 = skipCount == 0 ? linq2.Take(request.PageSize) : linq2.Skip(skipCount).Take(request.PageSize);
            

            var vo = from l in linq3.ToList()
                     select new OrderViewModel().FromEntity<OrderViewModel>(l.O, p =>
                     {
                         p.ShippingViaMethod = l.S;
                         p.Customer = new CustomerViewModel().FromEntity<CustomerViewModel>(l.C);
                     });

            var v = new Pager<OrderViewModel>(request, totalCount) { Data = vo.ToList() };
            ViewBag.SearchOptions = search;
            return View(v);
        }
コード例 #18
0
        public ActionResult SectionListP(SectionSearchViewModel search, PagerRequest request)
        {
            int totalCount;
          
            var linq = Context.Set<SectionEntity>().Where(s=>s.StoreId ==search.StoreId && s.Status !=(int)DataStatus.Deleted && s.ChannelSectionId.HasValue)
                      ;
           

            totalCount = linq.Count();

            var skipCount = (request.PageIndex - 1) * request.PageSize;

            linq = skipCount == 0 ? linq.OrderBy(l => l.Id).Take(request.PageSize) : linq.OrderBy(l => l.Id).Skip(skipCount).Take(request.PageSize);


            var vo =  linq.ToList().Select(l=>new SectionViewModel().FromEntity<SectionViewModel>(l));

            var v = new Pager<SectionViewModel>(request, totalCount) { Data = vo.ToList() };
            return Json(v);
        }
コード例 #19
0
 //本期下载排行
 public ActionResult curDown(IssueContentQuery contentQuery, int page = 1)
 {
     IIssueFacadeService magazineService = ServiceContainer.Instance.Container.Resolve<IIssueFacadeService>();
     contentQuery.JournalID = JournalID;
     contentQuery.CurrentPage = page;
     contentQuery.SortName = " Downloads ";
     contentQuery.SortOrder = " DESC ";
     contentQuery.PageSize = 10;
     Pager<IssueContentEntity> pagerContentEntity = magazineService.GetIssueContentPageList(contentQuery);
     if (pagerContentEntity != null)
     {
         ViewBag.PagerInfo = Utils.GetPageNumbers(page, pagerContentEntity.TotalPage, "/Magazine/curDown/?Year=" + contentQuery.Year + "&Issue=" + contentQuery.Issue, 10);
     }
     else
     {
         pagerContentEntity = new Pager<IssueContentEntity>();
     }
     ViewBag.Year = contentQuery.Year;
     ViewBag.Issue = contentQuery.Issue;
     return View(pagerContentEntity);
 }
コード例 #20
0
 /// <summary>
 /// 在线留言
 /// </summary>
 /// <returns></returns>
 public ActionResult Index(int page = 1)
 {
     GuestbookQuery guestBookQuery = new GuestbookQuery();
     guestBookQuery.JournalID = JournalID;
     guestBookQuery.CurrentPage = page;
     guestBookQuery.PageSize = 15;
     Pager<GuestbookEntity> pageGuestBook = new Pager<GuestbookEntity>();
     try
     {
         ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
         pageGuestBook = service.GetSiteGuestBookPageList(guestBookQuery);
         if (pageGuestBook != null)
         {
             ViewBag.PagerInfo = Utils.GetPageNumbers(page, pageGuestBook.TotalPage, "/Message/", 5);
         }
     }
     catch (Exception ex)
     {
         WKT.Log.LogProvider.Instance.Error("获取留言列表出现异常:" + ex.Message);
     }
     return View(pageGuestBook);
 }
コード例 #21
0
        // GET: Admin/UserGroups
        public async Task<ActionResult> Index(string sortOrder, int? page, string SearchString = "")
        {
            var lst = GroupManager.UserGroups.Select(x => x.UserName).Distinct();
            //return View(lst.ToList());

            ViewBag.CurrentSort = sortOrder;
            ViewBag.NameSortParm = sortOrder == "name" ? "name_desc" : "name";
            ViewBag.CurrentSearchKey = SearchString;

            int pageno = 0;
            pageno = page == null ? 1 : page.Value;
            int pageSize = UGConstants.DefaultPageSize;

            if (!String.IsNullOrEmpty(SearchString))
            {
                lst = lst.Where(s => s.ToUpper().Contains(SearchString.ToUpper()));
            }
            long totalCount = lst.LongCount();
            switch (sortOrder)
            {
                case "name_desc":
                    lst = lst.OrderByDescending(s => s);
                    break;
                default:
                    lst = lst.OrderBy(s => s);
                    break;
            }

            var lstUser = await lst.Skip((pageno - 1) * pageSize).Take(pageSize).ToListAsync();
            Pager<string> pager = new Pager<string>(lstUser, pageno, pageSize, totalCount);

            pager.RouteValues = new System.Web.Routing.RouteValueDictionary();
            pager.RouteValues.Add("sortOrder", sortOrder);
            pager.RouteValues.Add("SearchString", SearchString);

            return View(pager);

            
        }
コード例 #22
0
 //本期浏览排行
 public ActionResult curList(IssueContentQuery contentQuery, int page = 1)
 {
     IIssueFacadeService magazineService = ServiceContainer.Instance.Container.Resolve<IIssueFacadeService>();
     contentQuery.JournalID = JournalID;
     contentQuery.CurrentPage = page;
     contentQuery.SortName = " Hits ";
     contentQuery.SortOrder = " DESC ";
     contentQuery.PageSize = 10;
     Pager<IssueContentEntity> pagerContentEntity = magazineService.GetIssueContentPageList(contentQuery);
     if (pagerContentEntity != null)
     {
         ViewBag.PagerInfo = Utils.GetPageNumbers(page, pagerContentEntity.TotalPage, "/Magazine/curList/?Year=" + contentQuery.Year + "&Issue=" + contentQuery.Issue, 10);
     }
     else
     {
         pagerContentEntity = new Pager<IssueContentEntity>();
     }
     ViewBag.Year = contentQuery.Year;
     ViewBag.Issue = contentQuery.Issue;
     //ViewBag.journalChannelList = HtmlHelperExtensions.GeIssueContentList(1000, ViewBag.Issue, ViewBag.Year).Count;
     return View(pagerContentEntity);
 }
コード例 #23
0
        public JsonResult ListP(PMessageSearchOption search, PagerRequest request)
        {
            int totalCount;

            var linq = Context.Set<PMessageEntity>().Where(p => (!search.FromDate.HasValue || p.CreateDate>=search.FromDate.Value) &&
                (!search.ToDate.HasValue || p.CreateDate == search.ToDate.Value));
            if ((CurrentUser.Role & (int)UserRole.Admin) != (int)UserRole.Admin)
            {
                linq = linq.Where(l => l.FromUser == CurrentUser.CustomerId || l.ToUser == CurrentUser.CustomerId);
            }
            var linq2 = linq.GroupBy(l => new { F = l.FromUser, T = l.ToUser })
                                      .Select(l => new { F = l.Key.F, T = l.Key.T, MsgID = l.Max(m => m.Id) });
            var linq3 = linq2.Where(l=>!linq2.Any(l2=>l2.F==l.T && l2.T == l.F && l2.MsgID>l.MsgID))
                        .Join(Context.Set<PMessageEntity>(),o=>o.MsgID,i=>i.Id,(o,i)=>new {MsgID=o.MsgID,P=i})
                        .Join(Context.Set<UserEntity>(), o => o.P.FromUser, i => i.Id, (o, i) => new { P = o.P, FromUser = i })
                        .Join(Context.Set<UserEntity>(), o => o.P.ToUser, i => i.Id, (o, i) => new { P = o.P, FromUser = o.FromUser, ToUser = i})
                        .OrderByDescending(l=>l.P.Id);
                       
            totalCount = linq2.Count();

            var skipCount = (request.PageIndex - 1) * request.PageSize;

            var linq4 = skipCount == 0 ? linq2.Take(request.PageSize) : linq2.Skip(skipCount).Take(request.PageSize);


            var vo = from l in linq3.ToList()
                     select new PMessageViewModel().FromEntity<PMessageViewModel>(l.P, p =>
                     {
                         p.FromUser = l.P.FromUser;
                         p.ToUser = l.P.ToUser;
                         p.FromUserModel = new CustomerViewModel().FromEntity<CustomerViewModel>(l.FromUser);
                         p.ToUserModel = new CustomerViewModel().FromEntity<CustomerViewModel>(l.ToUser);

                     });

            var v = new Pager<PMessageViewModel>(request, totalCount) { Data = vo.ToList() };
            return Json(v);
        }
コード例 #24
0
        public ActionResult Index(int page = 1, int perPage = 5)
        {
            // Get the animals
            var animals = Animal.GetAnimals().ToList();

            // Create a pager instance, passing the animals, the current page
            // where we are and the number of how many animals we want to
            // display on a single page
            Pager<Animal> pager = new Pager<Animal>(animals, page, perPage);


            // Create the view model: it holds all the visual data
            var model = new AnimalViewModel()
            {
                PageTitle = "ASP.NET MVC Pagination",
                AnimalList = pager.PagedList,
                AnimalsCount = pager.NumberOfTotalItems,
                CurrentPage = pager.CurrentPage,
                NumberOfPages = pager.NumberOfPages
            };

            return View(model);
        }
コード例 #25
0
ファイル: RoleManagerController.cs プロジェクト: pjjwpc/PMIS
        public ActionResult GetRolePage()
        {
            Pager<PM_Role> pager=new Pager<PM_Role>();
            try
            {
                int page = Convert.ToInt16(Request.Params["page"]);
                int rows = Convert.ToInt16(Request.Params["rows"]);
                String pm_TRNanme = Request.Params["pm_TRNanme"];
                Dictionary<String,Object> di=null;
                if (!string.IsNullOrEmpty(pm_TRNanme))
                {
                    di=new Dictionary<string, object>();
                     di.Add("pm_TRNanme",pm_TRNanme);
                }

               pager= iRoleManager.FinPager(di, page, rows);
            }
            catch (Exception)
            {
                pager = new Pager<PM_Role>();
            }
            return Json(pager, JsonRequestBehavior.AllowGet);
        }
コード例 #26
0
        public ActionResult Index(Pager pager)
        {
            if (pager == null || !this.ModelState.IsValid)
            {
                pager = new Pager
                {
                    PageSize = ProfilesPerPage
                };
            }

            if (pager.TotalPages == 0)
            {
                pager.TotalPages =
                    this.Cache.Get(
                        "userPages",
                        () => this.users.GetTotalPages(ProfilesPerPage),
                        durationInSeconds: 15 * 60);
            }

            pager.PageSize = ProfilesPerPage;

            var models = this.users.GetPage(pager)
                .To<PublicProfileDetailed>()
                .ToList();

            var maxQuizzesCreated = this.users.GetMaxCreatedQuizzesCount();
            PublicProfileDetailed.MaxQuizzesCreated = maxQuizzesCreated;

            var viewModel = new IndexViewModel
            {
                Pager = pager,
                Profiles = models
            };

            return this.View(viewModel);
        }
コード例 #27
0
        public ActionResult GetBugPage(int pageIndex, int pageSize)
        {
            Pager<PM_BUG> pager=new Pager<PM_BUG>();
            try
            {
                String cjsj = Request.Params["cjsj"];
                String Czr = Request.Params["Czr"];
                Dictionary<String,object> di=new Dictionary<string, object>();
                if (!String.IsNullOrEmpty(Czr))
                {
                    di.Add("pm_CzrId",Czr);
                }
                if (!String.IsNullOrEmpty(cjsj))
                {
                    di.Add("pm_Cjas",cjsj);
                }
            }
            catch (Exception)
            {

                throw;
            }
            return Json(pager, JsonRequestBehavior.AllowGet);
        }
コード例 #28
0
        //
        // GET: /Question/
        public ActionResult Index(int? page, int? pagecount)
        {
            page = page.HasValue ? page : 1;
            pagecount = pagecount.HasValue ? pagecount : 10;
            IEnumerable<Question> questions = QuestionModel.SelectQuestion((page.Value - 1) * pagecount.Value, pagecount.Value);

            Pager p = new Pager()
            {
                CurrentPage = page.Value,
                PageCount = pagecount.Value,
                ReachLastPage = questions.Count() < pagecount.Value
            };
            this.ViewData.SetPager(p);

            return View(questions);
        }
コード例 #29
0
 public Pager<AuthorInfoEntity> GetMemberInfoList(AuthorInfoQuery authorQueryEntity)
 {
     Pager<AuthorInfoEntity> pagerMember = new Pager<AuthorInfoEntity>();
     try
     {
         IAuthorInfoService authorService = ServiceContainer.Instance.Container.Resolve<IAuthorInfoService>();
         pagerMember = authorService.GetMemberInfoPageList(authorQueryEntity);
     }
     catch (Exception ex)
     {
         pagerMember = null;
         WKT.Log.LogProvider.Instance.Error("获取编辑部成员列表信息时出现异常:" + ex.Message);
     }
     return pagerMember;
 }
コード例 #30
0
 public Pager<AuthorInfoEntity> GetExpertPageList(AuthorInfoQuery query)
 {
     Pager<AuthorInfoEntity> pagerExpert = new Pager<AuthorInfoEntity>();
     try
     {
         IAuthorInfoService authorService = ServiceContainer.Instance.Container.Resolve<IAuthorInfoService>();
         pagerExpert = authorService.GetExpertPageList(query);
     }
     catch (Exception ex)
     {
         pagerExpert = null;
         WKT.Log.LogProvider.Instance.Error("获取专家列表时出现异常:" + ex.Message);
     }
     return pagerExpert;
 }