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


C# PageInfo类代码示例

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


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


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