zoukankan      html  css  js  c++  java
  • C# 一些请求的基类(待补充)

    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; }
        }
  • 相关阅读:
    lintcode-135-数字组合
    如何下载网页上的视频?
    tree
    lintcode-512-解码方法
    前端 启动项目内存溢出
    导入txt和导出txt文件
    webStorm 2018.3.2永久破解方法
    前端导出功能
    定时器刷新机制 setInterval react
    getFieldsValue,getFieldValue,validateFields,resetFields,getFieldDecorator的用法;
  • 原文地址:https://www.cnblogs.com/zhshlimi/p/8026249.html
Copyright © 2011-2022 走看看