public static bool isMathcCable(int cableid, DateTime date)
 {
     Cablehistory[] historys = CablehistoryDao.FindAll(new EqExpression("Cableid", cableid));
     if (historys.Length > 0)
     {
         for (int i = 0; i < historys.Length; i++)
         {
             if (historys[i].Startdate == null || historys[i].Enddate == null)
             {
                 continue;
             }
             DateTime start = DateTime.Parse(historys[i].Startdate.ToString()); //合同起始日期
             DateTime end   = DateTime.Parse(historys[i].Enddate.ToString());   //合同结束日期
             if (isMath(date, start, end))
             {
                 return(true);
             }
             else
             {
                 continue;
             }
         }
         return(false);
     }
     else
     {
         return(false);
     }
 }
 public static Cablehistory[] getHistoryById(int id)
 {
     try
     {
         Cablehistory[] historys = CablehistoryDao.FindAll(new Order("Createtime", false), new EqExpression("Cableid", id), new EqExpression("Isdeleted", (int)EnmIsdeleted.使用中));
         return(historys);
     }
     catch (Exception ex)
     {
         Log.Error(ex.Message);
         MessageHelper.ShowMessage("E999", ex.Message);
         return(null);
     }
 }
        public static int isNewCable(int id)
        {
            try
            {
                Cablehistory[] his = CablehistoryDao.FindAll(new EqExpression("Cableid", id));

                return(his.Length);
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message);
                return(-1);
            }
        }
        public static bool IsCableByCableNumber(int cableid, int customerid)
        {
            Cablehistory his = CablehistoryDao.FindFirst(new EqExpression("Cableid", cableid),
                                                         new EqExpression("Customerid", customerid));

            if (his != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static Nullable <DateTime> getMigrateDate(int cableid, int cusid)
        {
            Cablehistory history = CablehistoryDao.FindFirst(new EqExpression("Cableid", cableid),
                                                             new EqExpression("Customerid", cusid),
                                                             new NotNullExpression("Default1"));

            if (history != null)
            {
                //DateTime date = DateTime.Parse(history.Default1).Date;
                return(history.Default1.Value.Date);
            }
            else
            {
                return(null);
            }
        }