Пример #1
0
        public bool IsInRange(DateTime dateTime)
        {
            DateTime checkFrom, checkTo;

            int fromDeltaYears = DateTime.UtcNow.Year - From.Year;
            int toDeltaYears   = DateTime.UtcNow.Year - To.Year;

            if (Annual && fromDeltaYears >= 0 && toDeltaYears >= 0)
            {
                checkFrom = From.AddYears(fromDeltaYears);
                checkTo   = To.AddYears(toDeltaYears);
            }
            else
            {
                checkFrom = From;
                checkTo   = To;
            }
            return(dateTime > checkFrom && dateTime < checkTo);
        }