private static bool IsPeriodActiveForDayAndTime(ValidationPeriod period, DayOfWeek day, TimeSpan time, bool testOnlyAfterMidnight) { var configuration = new PeriodRangeConfiguration { StartTime = period.StartingTimeForDay(day), EndTime = period.EndingTimeForDay(day), EndsTomorrow = period.IsEndTimeAfterMidnightForDay(day), IsActiveOnlyWithinBounds = period.IsTimeBoundedForDay(day), }; int currentTime = Convert.ToInt32(time.TotalSeconds); return(IsTimeActiveForConfiguration(currentTime, configuration, testOnlyAfterMidnight)); }
private static bool IsRangeDefinedForDay(ValidationPeriod period, DayOfWeek day) { return((period.StartingTimeForDay(day) != 0) && (period.EndingTimeForDay(day) != 0)); }