• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PageInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PageInfo的典型用法代码示例。如果您正苦于以下问题:C# PageInfo类的具体用法?C# PageInfo怎么用?C# PageInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PageInfo类属于命名空间,在下文中一共展示了PageInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetUser

        /// <summary>
        /// 获取用户
        /// </summary>
        /// <param name="userInfo">用户实体</param>
        /// <param name="pageInfo">分页实体</param>
        /// <returns></returns>
        public IList<UsersInfo> GetUser(UsersInfo userInfo, PageInfo pageInfo)
        {
            using (DataContextDB DB = new DataContextDB())
            {
                IQueryable<UsersInfo> userInfos =
                    (
                        from item in DB.GetTable<UsersInfo>()
                        orderby item.ID descending
                        select item
                    );
                if (userInfo != null && userInfo.ID != 0)
                    userInfos = userInfos.Where<UsersInfo>(m => m.ID == userInfo.ID);
                if (userInfo != null && !string.IsNullOrEmpty(userInfo.Name))
                    userInfos = userInfos.Where<UsersInfo>(m => m.Name.Contains(userInfo.Name));
                if (userInfo != null && userInfo.UserGroup != 0)
                    userInfos = userInfos.Where<UsersInfo>(m => m.UserGroup == userInfo.UserGroup);

                if (pageInfo != null)
                {
                    pageInfo.TotalRecord = userInfos.Count();
                    return userInfos.Skip(pageInfo.PageSize * (pageInfo.PageIndex - 1)).Take(pageInfo.PageSize).ToList<UsersInfo>();
                }
                else
                    return userInfos.ToList<UsersInfo>();
            }
        }
开发者ID:houzhenggang,项目名称:PhoneEmail,代码行数:32,代码来源:Users.cs


示例2: Details

        public ActionResult Details(int id)
        {
            ViewQuestionDetailsViewModel vm = new ViewQuestionDetailsViewModel { HighlightAnswers = new List<Answer>() };
            var pageInfo = new PageInfo(AppConfigs.AnswersPageSize, 1);

            var feedback = _qRepo.GetQuestionDetails(id);
            var feedback2 = _aRepo.GetAllAnswers(id, pageInfo);
            var feedback3 = _aRepo.GetHighlightAnswers(id, AppConfigs.HighlightAnswerNumber);

            if (feedback.Success && feedback2.Success && feedback3.Success)
            {
                vm = new ViewQuestionDetailsViewModel
                {
                    Question = feedback.Data,
                    Answers = feedback2.Answers,
                    Total = feedback2.Total,
                    HasMore = feedback2.Total > pageInfo.PageSize * pageInfo.PageNo,
                    CurrentUserId = CurrentUser != null ? CurrentUser.UserInfo.Id : 0,
                    HighlightAnswers = feedback3.Data,
                    CanEdit = CurrentUser != null ? SecurityHelper.CanEditContentsDirectly() : false,
                };
                return View(vm);
            }
            return View("NotFound");
        }
开发者ID:keikan231,项目名称:Vuabep,代码行数:25,代码来源:QuestionsController.cs


示例3: ParentPageComboItem

 public ParentPageComboItem(PageInfo pageInfo, int indentLevel, ArrayList children)
     : base(pageInfo.Id, pageInfo.Title)
 {
     _pageInfo = pageInfo;
     _indentLevel = indentLevel;
     _children = children;
 }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:7,代码来源:PageParentComboBox.cs


示例4: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     CurrentPage = new PageInfo()
     {
         TemplatePath = @"Default/DetailPage.ascx"
     };
 }
开发者ID:joyinan,项目名称:CMS,代码行数:7,代码来源:CommonPage.aspx.cs


示例5: FindByAjax

        public ActionResult FindByAjax(int id = 1, int page = 1)
        {

            int pageSize = 3;

            var userKnowledgers = serviceForUserKnowl.GetAll().Where((x) => x.KnowledgeId == id).Select(x => x.ToWebUserKnowl());

            var usersTemp = service.GetAll().Select(y => y.ToWebUser());

            Dictionary<int, string> usersForViewBag = new Dictionary<int, string>();
            foreach (var x in service.GetAll().ToList())
            {
                usersForViewBag.Add(x.UserId, x.Name);
            }
            ViewBag.Users = usersForViewBag;
            ViewBag.ID = id;

            var q = from t in userKnowledgers
                    join tID in usersTemp on t.UserId equals tID.UserId
                    select new UserViewModel { Email = tID.Email, Name = tID.Name, Photo = tID.Photo, UserId = tID.UserId };

            var users = q.Skip((page - 1) * pageSize).Take(pageSize);

            PageInfo pageInfo = new PageInfo { PageNumber = page, PageSize = pageSize, TotalItems = userKnowledgers.Count() };
            IndexViewModel ivm = new IndexViewModel { PageInfo = pageInfo, UserViewModel = users };
            return PartialView("FindByAjax", ivm);

        }
开发者ID:YauheniTretsyak,项目名称:myProject,代码行数:28,代码来源:UsersCotroller.cs


示例6: PageLinks

        public static MvcHtmlString PageLinks(this HtmlHelper html, PageInfo pageInfo, Func<int, string> pageUrl)
        {
            StringBuilder result = new StringBuilder();

            for (int i = 1; i <= pageInfo.TotalPages; i++)
            {
                TagBuilder tag = new TagBuilder("a");
                tag.MergeAttribute("href", pageUrl(i));
                tag.MergeAttribute("data-ajax-update", "#address-cursor-rows");
                tag.MergeAttribute("data-ajax-success", "OnSuccess");
                tag.MergeAttribute("data-ajax-mode", "replace");
                tag.MergeAttribute("data-ajax", "true");
                tag.InnerHtml = i.ToString();

                // если текущая страница, то выделяем ее, например, добавляя класс
                if (i == pageInfo.PageNumber)
                {
                    tag.AddCssClass("selected");
                    tag.AddCssClass("btn-primary");
                }
                tag.AddCssClass("btn btn-default");

                result.Append(tag.ToString());
            }

            return MvcHtmlString.Create(result.ToString());
        }
开发者ID:fedihor,项目名称:gmapa,代码行数:27,代码来源:PagingHelpers.cs


示例7: SearchUsers

        public ActionResult SearchUsers(string searchText, int page = 1)
        {
            UsersViewModel vm = new UsersViewModel();
            List<ApplicationUser> users = new List<ApplicationUser>();
            if (searchText == null)
            {
                return View();
            }
            if (searchText == "All")
            {
                users = UserManager.Users.ToList();
            }
            else
            {
                users = UserManager.Users.Where(u => u.UserName.Contains(searchText) || u.Email.Contains(searchText)).ToList();

            }
            PageInfo pageInfo = new PageInfo() { PageSize = 20, CurrentPage = 1 };
            pageInfo.PageCount = (users.Count() - 1) / pageInfo.PageSize + 1;
            pageInfo.CurrentPage = page <= pageInfo.PageCount ? page : 1;
            pageInfo.Url = "/admin/adminaccount/searchUsers?searchText=" + searchText + "@page=";
            vm.Users = users.Skip((pageInfo.CurrentPage - 1) * pageInfo.PageSize).Take(pageInfo.PageSize).ToList();
            vm.PageInfo = pageInfo;
            return View(vm);
        }
开发者ID:zhouleink,项目名称:ChinaTea,代码行数:25,代码来源:AdminAccountController.cs


示例8: Can_Generate_Page_Links

        public void Can_Generate_Page_Links()
        { 
            // Arrange - define and HTML helper - we need to do this
            // in order to apply the extension method
            HtmlHelper myHelper = null;

            // Arrange - create PageInfo data
            PageInfo pagingInfo = new PageInfo
                                    {
                                        CurrentPage = 2,
                                        TotalItems = 28,
                                        ItemsPerPage = 10
                                    };

            // Arrange - set up the delegate using the Lambda expression
            Func<int, string> pageUrlDelegate = i => "Page" + i;

            // Act 
            MvcHtmlString result = myHelper.PageLinks(pagingInfo, pageUrlDelegate);

            // Assert
            Assert.AreEqual(@"<a class=""btn btn-default"" href=""Page1"">1</a>" 
                          + @"<a class=""btn btn-default btn-primary selected"" href=""Page2"">2</a>"
                          + @"<a class=""btn btn-default"" href=""Page3"">3</a>", 
                          result.ToString());
        }
开发者ID:JanakaAbeyaratna,项目名称:SportsStore,代码行数:26,代码来源:UnitTest1.cs


示例9: GetPageInfo

        public List<PageInfo> GetPageInfo()
        {
            List<PageInfo> pageInfos = new List<PageInfo>();

            foreach (XmlNode pageNode in getAllPageNodes())
            {
                PageInfo pageInfo = new PageInfo()
                {
                    Id = pageNode.Attributes[@"ID"].Value,
                    Name = pageNode.Attributes[@"name"].Value,
                    DateTime = DateTime.Parse(pageNode.Attributes[@"dateTime"].Value),
                    LastModifiedTime = DateTime.Parse(pageNode.Attributes[@"lastModifiedTime"].Value),
                    PageLevel = Int32.Parse(pageNode.Attributes[@"pageLevel"].Value),
                };

                if (pageNode.Attributes[@"isCurrentlyViewed"] != null)
                {
                    pageInfo.IsCurrentlyViewed = pageNode.Attributes[@"isCurrentlyViewed"].Value;
                }

                pageInfo.LocationPath = getLocationPath(pageNode);

                pageInfos.Add(pageInfo);
            }

            return pageInfos;
        }
开发者ID:tksh164,项目名称:OneNoteStats,代码行数:27,代码来源:NotebookStats.cs


示例10: PageLinks

        public static MvcHtmlString PageLinks(this HtmlHelper html,
        PageInfo pageInfo, Func<int, string> pageUrl, String elementId)
        {
            TagBuilder ul = new TagBuilder("ul");
            ul.AddCssClass("pagination");

            int startPage = pageInfo.PageNumber > 3 ? pageInfo.PageNumber - 2 : 1;
            //if (pageInfo.PageNumber > 3)
            if (startPage != 1)
            {
                ul.InnerHtml += MakeListItem(1, pageUrl, elementId);
                ul.InnerHtml += MakeListItem(1, pageUrl, elementId, "disabled", "...");
            }

            int totalPages = pageInfo.TotalPages;
            int lastPage = pageInfo.PageNumber + 3 < totalPages ? pageInfo.PageNumber + 2 : totalPages;

            //for (int i = 1; i <= pageInfo.TotalPages; i++)
            for (int i = startPage; i <= lastPage; i++)
            {
                ul.InnerHtml += MakeListItem(i, pageUrl, elementId, i == pageInfo.PageNumber ? "active" : null);
            }

            if (lastPage != totalPages)
            {
                ul.InnerHtml += MakeListItem(totalPages, pageUrl, elementId, "disabled", "...");
                ul.InnerHtml += MakeListItem(totalPages, pageUrl, elementId);
            }

            return MvcHtmlString.Create(ul.ToString());
        }
开发者ID:VladSamodin,项目名称:Action,代码行数:31,代码来源:PagingHelpers.cs


示例11: AspNetParsedDocument

		public AspNetParsedDocument (string fileName, WebSubtype type, RootNode rootNode, PageInfo info) : base (fileName)
		{
			Flags |= ParsedDocumentFlags.NonSerializable;
			Info = info;
			RootNode = rootNode;
			Type = type;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:7,代码来源:AspNetParsedDocument.cs


示例12: ParseRequest

 public static PageInfo ParseRequest(Microsoft.AspNetCore.Http.HttpRequest request, int totalCount)
 {
     PageInfo result = new PageInfo();
     string paramStartIndex = null;
     string paramPageSize = null;
     Microsoft.AspNetCore.Http.IQueryCollection parameters = request.Query;
     if (parameters != null)
     {
         paramStartIndex = parameters["startIndex"];
         paramPageSize = parameters["pageSize"];
     }
     int startIndex, pageSize;
     if (!int.TryParse(paramStartIndex, out startIndex))
         startIndex = 0;
     if (!int.TryParse(paramPageSize, out pageSize))
         pageSize = 20;
     result.StartIndex = startIndex;
     result.TotalCount = totalCount;
     if (totalCount < 0)
     {
         result.ItemsCount = Math.Min(pageSize, Math.Abs(totalCount));
         result.AddPreviousNextPageLinks(request, pageSize);
         result.TotalCount = -1;
     }
     else
     {
         result.ItemsCount = Math.Max(0, Math.Min((startIndex + pageSize), totalCount) - startIndex);
         result.AddPreviousNextPageLinks(request, pageSize);
     }
     return result;
 }
开发者ID:CreatorDev,项目名称:DeviceServer,代码行数:31,代码来源:PageInfo.cs


示例13: IndexViewModel

 public IndexViewModel(
     PageInfo pageInfo, IEnumerable<BookView> bookViews, Int32 bookTagId)
 {
     this.PageInfo = pageInfo;
     this.BookViews = bookViews;
     this.BookTagId = bookTagId;
 }
开发者ID:blackknight16,项目名称:BookMarket,代码行数:7,代码来源:IndexViewModel.cs


示例14: GetAllProduct

        public List<BLL.BusinessObject.Product> GetAllProduct(PageInfo vobjPageInfo)
        {

            Database db = EnterpriseLibraryContainer.Current.GetInstance<Database>("CSWebDSN");//DatabaseFactory.CreateDatabase(Config);
            DbCommand dbCommand = db.GetStoredProcCommand("[sprocCS_GetProducts_V2]");
            db.AddInParameter(dbCommand, "SortColumnName", DbType.String, vobjPageInfo.SortColumnName);
            db.AddInParameter(dbCommand, "SortDirection", DbType.String, vobjPageInfo.SortDirection);
            db.AddInParameter(dbCommand, "SearchText", DbType.String, vobjPageInfo.SearchText);

            List<BLL.BusinessObject.Product> list = new List<BLL.BusinessObject.Product>();

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {

                while (dataReader.Read())
                {

                    BLL.BusinessObject.Product obj = new BLL.BusinessObject.Product();
                    list.Add(PopulateProductInfo(dataReader));

                }

            }

            return list;

        }
开发者ID:xyzthought,项目名称:iBeyondZ,代码行数:27,代码来源:Product.cs


示例15: Get

        public IHttpActionResult Get(int CurrentPage)
        {
            //申明参数
            int _pageSize = 10;

            try
            {
                PageInfo pageInfo = new PageInfo()
                {
                    PageIndex = CurrentPage,
                    PageSize = _pageSize,
                    OrderField = "POSTID",
                    Order = OrderEnum.asc
                };
                var list = bll.GetList(pageInfo);
                Response<IEnumerable<V_tm_pm_post>> response = new Response<IEnumerable<V_tm_pm_post>>
                {
                    Data = list,
                    PagesCount = pageInfo.Total / _pageSize
                };
                return Ok(response);
            }
            catch (Exception ex)
            {
                LogHelper.WriteInfo(ex.ToString());
                return BadRequest("异常");
            }
        }
开发者ID:x55756016,项目名称:CodeMaticProjectTemplate,代码行数:28,代码来源:tm_pm_post.cs


示例16: OnPreInit

    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        // Init the page components
        this.PageManager = this.manPortal;
        this.manPortal.SetMainPagePlaceholder(this.plc);

        int pageTemplateId = QueryHelper.GetInteger("templateid", 0);

        // Prepare virtual page info
        PageInfo pi = new PageInfo();
        pi.DocumentCulture = CMSContext.PreferredCultureCode;
        pi.DocumentPageTemplateID = pageTemplateId;
        pi.ClassName = "CMS.Root";
        pi.NodeAliasPath = "";
        pi.DocumentNamePath = "/" + ResHelper.GetString("edittabs.design");
        pi.NodeSiteId = CMSContext.CurrentSiteID;

        CMSContext.CurrentPageInfo = pi;

        // Set the design mode
        PortalContext.SetRequestViewMode(ViewModeEnum.Design);
        ContextHelper.Add("DisplayContentInDesignMode", "0", true, false, false, DateTime.MinValue);

        this.ManagersContainer = this.plcManagers;
        this.ScriptManagerControl = this.manScript;
    }
开发者ID:KuduApps,项目名称:Kentico,代码行数:28,代码来源:PageTemplate_Design.aspx.cs


示例17: Blogs

        public ActionResult Blogs(int uId = 0, int page = 1)
        {
            var currentUser = _userService.GetUserEntity(User.Identity.Name);
            int userId = (uId == 0) ? currentUser.Id : uId;
            var blogs = _blogService
                .GetAllBlogEntities()
                .Where(b => b.UserId == userId)
                .ToList();

            var models = blogs
                .Skip((page - 1) * 10)
                .Take(10)
                .Select(bl => bl.ToMvcBlog())
                .ToList();

            foreach (var m in models)
            {
                m.ArticleCount = _articleService
                    .GetAllArticleEntities(m.Id)
                    .Count();
            }
            PageInfo pageInfo = new PageInfo { PageNumber = page, PageSize = 10, TotalItems = blogs.Count() };
            var bvm = new BlogsViewModel { PageInfo = pageInfo, BlogViewModels = models };
            bvm.UserId = userId;

            return View(bvm);
        }
开发者ID:opolkosergey,项目名称:Blog.ASP.Net.Opolko,代码行数:27,代码来源:BlogController.cs


示例18: GetTopSellingProduct

        public List<Report> GetTopSellingProduct(List<Report> objData, PageInfo vobjPageInfo)
        {
            List<Report> lstobjReport = new List<Report>();
            try
            {

                object[] mParams = {
                                        new SqlParameter("@SortColumnName", SqlDbType.NVarChar),                                              
                                        new SqlParameter("@SortDirection", SqlDbType.NVarChar),
                                        new SqlParameter("@SearchText", SqlDbType.NVarChar)
                                };

                mParams[0] = vobjPageInfo.SortColumnName;
                mParams[1] = vobjPageInfo.SortDirection;
                mParams[2] = vobjPageInfo.SearchText;

                using (IDataReader reader = dBase.ExecuteReader("sprocCS_GetTop10SellingProduct", mParams))
                {
                    while (reader.Read())
                    {
                        lstobjReport.Add(PopulateReport(reader));
                    }
                }
            }
            catch (Exception ex)
            {

                Common.LogError("CSWeb > Error > " + (new StackTrace()).GetFrame(0).GetMethod().Name, ex.ToString());
            }
            return lstobjReport;
        }
开发者ID:xyzthought,项目名称:iBeyondZ,代码行数:31,代码来源:ReportDB.cs


示例19: AddPage

		public void AddPage( PageInfo info )
		{
			lock ( SaveLock )
				m_Pages.Add( info );

			info.History = this;
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:7,代码来源:StaffHistory.cs


示例20: Pager

 public Pager(RequestContext requestContext, PageInfo pageInfo, IEnumerable<string> queryKeysForCut)
 {
     _requestContext = requestContext;
     _request = _requestContext.HttpContext.Request;
     _pageInfo = pageInfo;
     _queryKeysForCut = queryKeysForCut;
 }
开发者ID:v0id24,项目名称:ByndyuSoft.Infrastructure,代码行数:7,代码来源:Pager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PageList类代码示例发布时间:2022-05-24
下一篇:
C# PageDefinition类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap