zoukankan      html  css  js  c++  java
  • 对象自定义排序

    public class JSForm: IComparer<JSForm>, IComparable<JSForm>
        {
            [Key]
            [Required]
            public int ID { get; set; }
    
            [Required]
            public string RowGuid { get; set; } 
    
            public int IsDelete { get; set; }
    
            [Required]
            public string SendNumber { get; set; } //发货编号
            public string ClientRowGuid { get; set; }//客户RowGuid
            public string ClientAddress { get; set; }//客户地址
            public string ClientName { get; set; }//客户名称
            public string ClientContactUser { get; set; }//客户联系人
    
            public string SendDate { get; set; } //发货日期    
    
            public string WuLiuName { get; set; } //物流名称
    
            public string WuLiuRowGuid { get; set; }
    
            public string WuLiuNumber { get; set; }
    
            public string CashCharge { get; set; } //现付费用
            public string CashChargeDesc { get; set; } //对方付,我方付
            public string SelfCharge { get; set; } // 自提费用
    
            public string WuLiuUnitPrice { get; set; }
    
            public string BucketStyle { get; set; } //销桶,返桶,自带桶
            public string BucketCount { get; set; }
            public string BucketPrice { get; set; }
            public string BucketSumPrice { get; set; }
    
            public string ActPay { get; set; } //实付
            public string Manager { get; set; }
    
            public string SettlementModel { get; set; } //结算方式
            public string IsNote { get; set; } //是否开票
            public string IsContract { get; set; } //是否合同
    
            public string Description { get; set; }
    
            public int Compare(JSForm j1, JSForm j2)
            {
                string sn1 = j1.SendNumber.Substring(4);
                string sn2 = j2.SendNumber.Substring(4);
                long v1 = Convert.ToInt64(sn1);
                long v2 = Convert.ToInt64(sn2);
                if (v1 > v2)
                    return 1;
                if (v1 < v2)
                    return -1;
                return 0;
            }
    
            public int CompareTo(JSForm js)
            {
                return Compare(this, js);
            }
    
        }
    

      

  • 相关阅读:
    数据查询语句
    数据操作语句
    数据定义语句
    linux的常用命令
    NIO/IO/AIO阻塞/非阻塞/同步/异步
    XCode使用自带SVN,SVN命令
    正则表达式大全——持续更新中。。。
    sql语句优化
    sql一些语句性能及开销优化
    高质量图片无损压缩算法
  • 原文地址:https://www.cnblogs.com/wangzuofei/p/11428005.html
Copyright © 2011-2022 走看看