src/Azos/Time/Event.cs
/// <summary>
/// Override to perform extra status checks
/// </summary>
Override to perform extra status checks
Override to perform extra status checks
protected virtual bool DoVisit(DateTime localNow)
      {
        if (
             (m_StartDate.HasValue &&
              m_EndDate.HasValue &&
              m_StartDate.Value>=m_EndDate.Value) ||
             (m_MaxCount<0)||
             (m_Interval==TimeSpan.Zero)
            )
        {
          setStatus(EventStatus.Invalid);
          return false;
        }
        if (m_EndDate.HasValue && localNow>=m_EndDate.Value)
        {
          setStatus(EventStatus.Expired);
          return false;
        }
        if (m_MaxCount>0 && m_CallCount>=m_MaxCount)
        {
          setStatus(EventStatus.Expired);
          return false;
        }
        if (m_StartDate.HasValue && localNow<m_StartDate.Value)
        {
          setStatus(EventStatus.NotStarted);
          return false;
        }
        setStatus(EventStatus.Started);
        if (m_LastCall == DateTime.MinValue)
        {
          m_LastCall = localNow;
          return true;
        }
        return (localNow-m_LastCall)>=m_Interval;
      }
protected virtual bool DoVisit ( DateTime localNow ) { if ( ( m_StartDate . HasValue && m_EndDate . HasValue && m_StartDate . Value >= m_EndDate . Value ) || ( m_MaxCount < 0 ) || ( m_Interval == TimeSpan . Zero ) ) { setStatus ( EventStatus . Invalid ) ; return false ; } if ( m_EndDate . HasValue && localNow >= m_EndDate . Value ) { setStatus ( EventStatus . Expired ) ; return false ; } if ( m_MaxCount > 0 && m_CallCount >= m_MaxCount ) { setStatus ( EventStatus . Expired ) ; return false ; } if ( m_StartDate . HasValue && localNow < m_StartDate . Value ) { setStatus ( EventStatus . NotStarted ) ; return false ; } setStatus ( EventStatus . Started ) ; if ( m_LastCall == DateTime . MinValue ) { m_LastCall = localNow ; return true ; } return ( localNow - m_LastCall ) >= m_Interval ; }
Override to perform extra status checks
Override to perform extra status checks
//check validity
localNow
DateTime