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);
            }
    
        }
    

      

  • 相关阅读:
    Mahout推荐算法ItemBased
    ALSA安装编程指南
    windbg更改cmd的token提升其特权
    至尊问题
    什么是“Bash”破绽?
    hdu 1548 A strange lift
    C 循环链表
    C++ 链表
    C_数据结构_链表的链式实现
    C _数据结构 _线性表的顺序存储
  • 原文地址:https://www.cnblogs.com/wangzuofei/p/11428005.html
Copyright © 2011-2022 走看看