当前位置: 首页>>代码示例>>C#>>正文


C# IQueryable.Skip方法代码示例

本文整理汇总了C#中IQueryable.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# IQueryable.Skip方法的具体用法?C# IQueryable.Skip怎么用?C# IQueryable.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IQueryable的用法示例。


在下文中一共展示了IQueryable.Skip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PackageListViewModel

        public PackageListViewModel(IQueryable<Package> packages,
            string searchTerm,
            string sortOrder,
            int totalCount,
            int pageIndex,
            int pageSize,
            UrlHelper url)
        {
            // TODO: Implement actual sorting
            IEnumerable<ListPackageItemViewModel> items;
            using (MiniProfiler.Current.Step("Querying and mapping packages to list"))
            {
                items = packages.Skip(pageIndex * pageSize)
                                .Take(pageSize)
                                .ToList()
                                .Select(pv => new ListPackageItemViewModel(pv));
            }
            PageIndex = pageIndex;
            PageSize = pageSize;
            TotalCount = totalCount;
            SortOrder = sortOrder;
            SearchTerm = searchTerm;
            int pageCount = (TotalCount + PageSize - 1) / PageSize;

            var pager = new PreviousNextPagerViewModel<ListPackageItemViewModel>(
                items,
                PageIndex,
                pageCount,
                page => url.PackageList(page, sortOrder, searchTerm)
            );
            Items = pager.Items;
            FirstResultIndex = 1 + (PageIndex * PageSize);
            LastResultIndex = FirstResultIndex + Items.Count() - 1;
            Pager = pager;
        }
开发者ID:N198,项目名称:NugetGallery21-DeleteMe,代码行数:35,代码来源:PackageListViewModel.cs

示例2: RequestsViewModel

        public RequestsViewModel(IQueryable<Request> requests, int pageNo, int pageSize, User user, RequestFilters requestFilter)
        {
            User = user;
            RequestFilter = requestFilter;

            CurrentPage = pageNo;
            PageSize = pageSize;
            TotalResults = requests.Count();

            TotalPages = (int)Math.Ceiling(TotalResults / (float)PageSize);

            if (TotalPages > CurrentPage)
            {
                NextPage = CurrentPage + 1;
            }

            if (CurrentPage > 1)
            {
                PreviousPage = CurrentPage - 1;
            }

            Count = (TotalResults > pageNo * pageSize) ? pageSize : TotalResults - (pageNo - 1) * pageSize;

            if (Count > 0)
            {
                Requests = requests.Skip((pageNo - 1) * pageSize).Take(Count).AsEnumerable().Select(i => new RequestViewModel(user, i));
            }
            else
            {
                Count = 0;

                Requests = new List<RequestViewModel>();
            }
        }
开发者ID:osama-lionheart,项目名称:ServerRequests,代码行数:34,代码来源:RequestsViewModel.cs

示例3: Page

		protected static IQueryable<UserEntity> Page(SearchModel model, IQueryable<UserEntity> result)
		{
			var pagedResult = result
				.Skip((model.PageNumber - 1)*model.PageSize)
				.Take(model.PageSize);
			return pagedResult;
		}
开发者ID:klabranche,项目名称:Griffin.Table,代码行数:7,代码来源:UserBaseController.cs

示例4: Translate

            public IQueryable<MediaContent> Translate(IExpression expression, IQueryable<MediaContent> contentQueryable)
            {
                this.Visite(expression);

                contentQueryable = contentQueryable.Where(this.LinqExpression);

                if (this.OrderExprssion != null)
                {
                    if (!this.OrderDesc)
                    {
                        contentQueryable = contentQueryable.OrderBy(this.OrderExprssion);
                    }
                    else
                    {
                        contentQueryable = contentQueryable.OrderByDescending(this.OrderExprssion);
                    }
                }

                if (Skip.HasValue)
                {
                    contentQueryable = contentQueryable.Skip(Skip.Value);
                }
                if (Take.HasValue)
                {
                    contentQueryable = contentQueryable.Take(Take.Value);
                }

                return contentQueryable;
            }
开发者ID:Godoy,项目名称:CMS,代码行数:29,代码来源:MediaContentProvider.cs

示例5: GetFrTo

        public static List<VModule> GetFrTo(IQueryable<VModule> table, int start, int end)
        {
            if (start <= 0)
                start = 1;
            List<VModule> list = table.Skip(start - 1).Take(end - start + 1).ToList();

            return list;
        }
开发者ID:lengocluyen,项目名称:pescode,代码行数:8,代码来源:VModule.cs

示例6: Get

        public static List<VPart> Get(IQueryable<VPart> table, int start, int end)
        {
            if (start <= 0)
                start = 1;
            List<VPart> l = table.Skip(start - 1).Take(end - start + 1).ToList();

            return l;
        }
开发者ID:lengocluyen,项目名称:pescode,代码行数:8,代码来源:VPart.cs

示例7: ContributionsList

 public IEnumerable<ContributionInfo> ContributionsList(int startRow, int pageSize)
 {
     contributions = FetchContributions();
     if (!_count.HasValue)
         _count = contributions.Count();
     contributions = contributions.Skip(startRow).Take(pageSize);
     return ContributionsList(contributions);
 }
开发者ID:rossspoon,项目名称:bvcms,代码行数:8,代码来源:APIContributionSearchModel.cs

示例8: ApplyPaging

        //
        // GET: /Admin/Product/

        IQueryable<Product> ApplyPaging(IQueryable<Product> products, int? page, int pageSize)
        {
            if (products == null)
                return null;
            int currentPage = page ?? 0;
            if (page < 0)
                return products;
            return products.Skip(currentPage * pageSize).Take(pageSize);
        }
开发者ID:fathurxzz,项目名称:aleqx,代码行数:12,代码来源:ProductController.cs

示例9: GetPageList

        public PagerModel GetPageList(PagerDataRequest dataPager, IQueryable queryPaging)
        {
            PagerModel pagerModel = new PagerModel();

            pagerModel.TotalRows = queryPaging.Count();

            #region " Filtering "

            if (dataPager.Filter != null && (dataPager.Filter.Filters != null && dataPager.Filter.Filters.Count > 0))
            {
                //string whereCond = null;
                //var param = new List<object>();
                //var filters = dataPager.Filter.Filters;

                //for (int i = 0; i < filters.Count; i++)
                //{
                //    if (i == 0)
                //    {
                //        whereCond += string.Format(" {0}",)
                //    }
                //    else
                //    {

                //    }
                //}

            }

            #endregion

            #region " Sorting "

            var sort = dataPager.Sort;
            string sortBy = null;

            for (int i = 0; i < sort.Count; i++)
            {
                if (i == sort.Count - 1)
                {
                    sortBy += sortBy + string.Format("{0} {1}", sort[i].Field, sort[i].Dir);
                }
                else
                {
                    sortBy += sortBy + string.Format("{0} {1}, ", sort[i].Field, sort[i].Dir);
                }
            }
            queryPaging = queryPaging.OrderBy(sortBy);

            #endregion

            pagerModel.Data = queryPaging.Skip(dataPager.Skip).Take(dataPager.Take);

            return pagerModel;
        }
开发者ID:sbudihar,项目名称:SIRIUSrepo,代码行数:54,代码来源:PagingService.cs

示例10: FilterPagingSortingSearch

        public IQueryable FilterPagingSortingSearch(DataTablesParam DTParams, IQueryable data, out int totalRecordsDisplay, Tuple<string, Type>[] columns)
        {

            if (!String.IsNullOrEmpty(DTParams.sSearch))
            {
                string searchString = "";
                bool first = true;
                for (int i = 0; i < DTParams.iColumns; i++)
                {
                    if (DTParams.bSearchable[i])
                    {
                        string columnName = columns[i].Item1;

                        if (!first)
                            searchString += " or ";
                        else
                            first = false;

                        if (columns[i].Item2 == typeof(int))
                        {
                            searchString += columnName + ".ToString().StartsWith(\"" + DTParams.sSearch + "\")";
                        }
                        else
                        {
                            searchString += columnName + ".Contains(\"" + DTParams.sSearch + "\")";
                        }
                    }
                }
                data = data.Where(searchString);
            }
            string sortString = "";
            for (int i = 0; i < DTParams.iSortingCols; i++)
            {
                
                int columnNumber = DTParams.iSortCol[i];
                string columnName = columns[columnNumber].Item1;
                string sortDir = DTParams.sSortDir[i];
                if (i != 0)
                    sortString += ", ";
                sortString += columnName + " " + sortDir;
            }

            totalRecordsDisplay = data.Count();

            data = data.OrderBy(sortString);
            data = data.Skip(DTParams.iDisplayStart).Take(DTParams.iDisplayLength);

            return data;
        }
开发者ID:ViktorOstrovskyy,项目名称:mvc.jquery.datatables,代码行数:49,代码来源:DataTablesFilter.cs

示例11: load

 protected void load()
 {
     int pageSize, pageNo, totalPage,listCount;//每页的数量,页码(第几页),一共的页码,数据的个数
     listCount = db.SaralyV.Count(o => o.UserID == LoginUser.UserID);
     pageSize = 10;
     //totalPage = (listCount / pageSize) + 1;
     totalPage = (int)Math.Ceiling((decimal)listCount/pageSize);
     totalPage = (totalPage == 0 ? 1 : totalPage);
     pageNo = ZKRequest.GetInt("pageNo",0);
     pageNo = pageNo < 1 ?1:pageNo;
     pageNo = pageNo > totalPage ? totalPage : pageNo;
     saralylist = db.SaralyV.Where(o => o.UserID == LoginUser.UserID).OrderByDescending(o => o.saralyDate);
     saralylist = saralylist.Skip((pageNo - 1) * pageSize).Take(pageSize);
     totalucom = db.SaralyV.Where(o=>o.UserID==LoginUser.UserID).Sum(o=>o.RealMoney);
     fenye.InnerHtml = ShowPages(totalPage, pageSize, pageNo);
 }
开发者ID:yalunwang,项目名称:family,代码行数:16,代码来源:salaryList.aspx.cs

示例12: FilterMaps

        static ZkDataContext FilterMaps(string search,
                                        bool? supported,
                                        bool? featured,
                                        int? offset,
                                        bool? assymetrical,
                                        int? sea,
                                        int? hills,
                                        int? size,
                                        bool? elongated,
                                        bool? needsTagging,
                                        bool? isTeams,
                                        bool? is1v1,
                                        bool? ffa,
                                        bool? chicken,
                                        int? isDownloadable,
                                        int? special,
                                        out IQueryable<Resource> ret) {
            var db = new ZkDataContext();
            if (featured == null) featured = true;

            ret = db.Resources.Where(x => x.TypeID == ResourceType.Map);
            if (!string.IsNullOrEmpty(search)) {
                foreach (var word in search.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)) {
                    var w = word;
                    ret = ret.Where(x => x.InternalName.Contains(w) || x.AuthorName.Contains(w));
                }
            }

            if (needsTagging == true) {
                ret =
                    ret.Where(
                        x =>
                        x.MapIsFfa == null || x.MapIsAssymetrical == null || x.MapIsSpecial == null || x.AuthorName == null || x.MapHills == null ||
                        x.MapWaterLevel == null);
            }

            if (supported == true) ret = ret.Where(x => x.MapIsSupported == true);
            if (featured == true) ret = ret.Where(x => x.FeaturedOrder > 0);
            if (isDownloadable == 1) ret = ret.Where(x => x.ResourceContentFiles.Any(y => y.LinkCount > 0));
            else if (isDownloadable == 0) ret = ret.Where(x => x.ResourceContentFiles.All(y => y.LinkCount <= 0));
            if (special != -1) ret = ret.Where(x => x.MapIsSpecial == (special == 1));
            
            if (sea.HasValue) ret = ret.Where(x => x.MapWaterLevel == sea);
            if (hills.HasValue) ret = ret.Where(x => x.MapHills == hills);
            if (assymetrical.HasValue) ret = ret.Where(x => x.MapIsAssymetrical == assymetrical);
            if (elongated == true) ret = ret.Where(x => x.MapSizeRatio <= 0.5 || x.MapSizeRatio >= 2);
            else if (elongated == false) ret = ret.Where(x => x.MapSizeRatio > 0.5 && x.MapSizeRatio < 2);
            // Diagonal of a map used to determine size; 16 and below are considered small, bigger than 24 is large
            if (size == 1) ret = ret.Where(x => (x.MapHeight*x.MapHeight + x.MapWidth*x.MapWidth) <= 16*16);
            else if (size == 2) {
                ret =
                    ret.Where(
                        x =>
                        (x.MapHeight*x.MapHeight + x.MapWidth*x.MapWidth) > 16*16 &&
                        (x.MapHeight*x.MapHeight + x.MapWidth*x.MapWidth) <= 24*24);
            }
            else if (size == 3) ret = ret.Where(x =>(x.MapHeight*x.MapHeight + x.MapWidth*x.MapWidth) > 24*24);
            if (isTeams.HasValue) ret = ret.Where(x => x.MapIsTeams == isTeams);
            if (is1v1.HasValue) ret = ret.Where(x => x.MapIs1v1 == is1v1);
            if (chicken.HasValue) ret = ret.Where(x => x.MapIsChickens == chicken);
            if (ffa.HasValue) ret = ret.Where(x => x.MapIsFfa == ffa);

            //if (featured == true) ret = ret.OrderByDescending(x => -x.FeaturedOrder).ThenByDescending(x => x.ResourceID);
            //else ret = ret.OrderByDescending(x => x.ResourceID);
            ret = ret.OrderByDescending(x => x.ResourceID);
            if (offset != null) ret = ret.Skip(offset.Value);
            ret = ret.Take(Global.AjaxScrollCount);
            return db;
        }
开发者ID:Jamanno,项目名称:Zero-K-Infrastructure,代码行数:69,代码来源:MapsController.cs

示例13: Apply

        public IQueryable Apply(IQueryable data)
        {
            if (_orderBy != null) data = _orderBy(data);
            if (_offset != null) data = data.Skip(_offset.Value);
            if (_limit != null) data = data.Take(_limit.Value);
            if(!_selectStar) data = SelectDynamic(data, _columns);

            return data;
        }
开发者ID:paultyng,项目名称:GoogleVisualization,代码行数:9,代码来源:Query.cs

示例14: Execute

        protected virtual object Execute(IQueryable<TextContent> queryable, IEnumerable<OrderExpression> orders, CallType callType, int? skip, int? take)
        {
            #region Order query
            IOrderedQueryable<TextContent> ordered = null;
            foreach (var orderItem in orders)
            {
                if (!orderItem.Descending)
                {
                    if (ordered == null)
                    {
                        ordered = queryable.OrderBy(orderItem.OrderExprssion);
                    }
                    else
                    {
                        ordered = ordered.ThenBy(orderItem.OrderExprssion);
                    }

                }
                else
                {
                    if (ordered == null)
                    {
                        ordered = queryable.OrderByDescending(orderItem.OrderExprssion);
                    }
                    else
                    {
                        ordered = ordered.ThenByDescending(orderItem.OrderExprssion);
                    }
                }
            }
            if (ordered != null)
            {
                queryable = ordered;
            }

            #endregion

            if (skip.HasValue)
            {
                queryable = queryable.Skip(skip.Value);
            }

            if (take.HasValue)
            {
                queryable = queryable.Take(take.Value);
            }
            switch (callType)
            {
                case Kooboo.CMS.Content.Query.Expressions.CallType.Count:
                    return queryable.Count();
                case Kooboo.CMS.Content.Query.Expressions.CallType.First:
                    return queryable.First();
                case Kooboo.CMS.Content.Query.Expressions.CallType.Last:
                    return queryable.Last();
                case Kooboo.CMS.Content.Query.Expressions.CallType.LastOrDefault:
                    return queryable.LastOrDefault();
                case Kooboo.CMS.Content.Query.Expressions.CallType.FirstOrDefault:
                    return queryable.FirstOrDefault();
                case Kooboo.CMS.Content.Query.Expressions.CallType.Unspecified:
                default:
                    return queryable.ToArray();
            }
        }
开发者ID:Epitomy,项目名称:CMS,代码行数:63,代码来源:QueryExecutor.cs

示例15: GetRecords

        List<RecordRepresentation> GetRecords(IQueryable<RecordsWithOpenDataPublicationInfoIndex.Result> query, int p)
        {
            int take = 1000; // can change this when paging is implemented in the UI
            int skip = (p - 1) * take;

            var records = query
                .Skip(skip)
                .Take(take)
                .As<Record>()
                .ToList()
                .Select(r => new RecordRepresentation
                {
                    Id = r.Id,
                    Title = r.Gemini.Title,
                    MetadataDate = r.Gemini.MetadataDate,
                    IsGeminiValid = r.Validation == Validation.Gemini,
                    OpenData = r.Publication.OpenData,
                })
                .ToList();

            return records;
        }
开发者ID:jncc,项目名称:topcat,代码行数:22,代码来源:OpenDataPublishingController.cs


注:本文中的IQueryable.Skip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。