using System.Runtime.Serialization; /// <summary> /// 通用分页请求类 /// </summary> [DataContract] public class PagedListModelReq : Request { /// <summary> /// <strong>Initializes a new instance of the <see cref="</strong>PagedListModelReq<strong>" /> class</strong> /// </summary> public PagedListModelReq() { this.PageIndex = 1; this.PageSize = 15; } /// <summary> /// 索引开始 /// </summary> [DataMember] public int StartIndex { get { int index = 0; if (this.PageSize > 0 && this.PageIndex > 0) { index = ((this.PageIndex - 1) * this.PageSize) + 1; } return index; } } /// <summary> /// 索引结束 /// </summary> [DataMember] public int EndIndex { get { int index = 1; if (this.PageSize > 0 && this.PageIndex > 0) { index = this.PageIndex * this.PageSize; } return index; } } /// <summary> /// 分页大小 /// </summary> [DataMember] public int PageSize { get; set; } /// <summary> /// 第几页数 /// </summary> [DataMember] public int PageIndex { get; set; } /// <summary> /// Called when [deserialized]. /// </summary> /// <param name="context">StreamingContext</param> [OnDeserialized] private void OnDeserialized(StreamingContext context) { if (this.PageIndex <= 0) { this.PageIndex = 1; } if (this.PageSize <= 0) { this.PageSize = 15; } } }
/// <summary> /// Model的基类 /// </summary> [DataContract] public abstract class BaseModel { /// <summary> /// CreateUser /// </summary> [DataMember] public string Creator { get; set; } /// <summary> /// CreateUser /// </summary> [DataMember] public string Editor { get; set; } /// <summary> /// CreateUser /// </summary> [DataMember] public DateTime? CreateTime { get; set; } /// <summary> /// CreateUser /// </summary> [DataMember] public DateTime? EditTime { get; set; } /// <summary> /// CreateUser /// </summary> [DataMember] public bool IsDel { get; set; } }