using JSMachine.WMS.Domain.IRepository; using System.Collections.Generic; namespace JSMachine.WMS.App.Dto { public class PagedResultDto { public static readonly PagedResultDto EmptyPagedResult = new PagedResultDto(0, 0, 0, 0, null); #region Public Properties /// /// 总记录数 /// public int TotalRecords { get; set; } /// /// 总页数 /// public int TotalPages { get; set; } /// /// 每页的记录数 /// public int PageSize { get; set; } /// /// 当前页码 /// public int PageNumber { get; set; } /// /// 获取或设置当前页码的记录 /// public List PageData { get; set; } #endregion public PagedResultDto() { this.PageData = new List(); } public PagedResultDto(int totalRecords, int totalPages, int pageSize, int pageNumber, List data) { this.TotalPages = totalPages; this.TotalRecords = totalRecords; this.PageSize = pageSize; this.PageNumber = pageNumber; this.PageData = data; } public PagedResultDto(int totalRecords, int pageSize, int pageNumber, List data) { if (pageSize > 0) { this.TotalPages = totalRecords % pageSize == 0 ? totalRecords / pageSize : totalRecords / pageSize + 1; } this.TotalRecords = totalRecords; this.PageSize = pageSize; this.PageNumber = pageNumber; this.PageData = data; } } }