using System;
using System.Collections.Generic;
using System.Text;
using ChuPiao.Common.Models;

namespace ChuPiao.AutoPrint.Services.AutoPrint
{
    public class PrintTicketComparer : IComparer<L_LotTicketEntity>
    {
        #region Implementation of IComparer<L_LotTicketEntity>

        public int Compare(L_LotTicketEntity x, L_LotTicketEntity y)
        {
            int result = x.L_EndTime.CompareTo(y.L_EndTime);//按截止时间升序
            if(result==0)
            {
                result = y.L_Money.CompareTo(x.L_Money);//按金额降序
                if (result == 0)
                {
                    result = x.L_AddTime.CompareTo(y.L_AddTime);//按下载时间升序
                    if (result == 0)
                    {
                        result = Convert.ToInt32(x.L_Expect) - Convert.ToInt32(y.L_Expect);//按期号升序 
                        if (result == 0)
                        {
                            result = x.LotId - y.LotId;//按彩种升序
                            if (result == 0)
                            {
                                result = x.L_PlayId - y.L_PlayId;//按玩法升序
                            }
                        }
                    }
                }
            }
            
            return result;
        }

        #endregion
    }
    public class ExpectComparer : IComparer<L_ExpectEntity>
    {
        #region Implementation of IComparer<L_ExpectEntity>

        public int Compare(L_ExpectEntity x, L_ExpectEntity y)
        {
            if (string.IsNullOrEmpty(x.E_Expect) || string.IsNullOrEmpty(y.E_Expect))
                return 0;
            int result = Convert.ToInt32(x.E_Expect) - Convert.ToInt32(y.E_Expect);//按期号升序
            return result;
        }

        #endregion
    }
}
