public bool Contains(WeekDayAndTime dt) { if (this.startTime <= this.endTime) { return(this.startTime <= dt && dt < this.endTime); } return(this.endTime > dt || dt >= this.startTime); }
public static byte[] GetWeekBitmapFromIntervals(ScheduleInterval[] intervals) { DateTime weekBitmapReference = ScheduleInterval.WeekBitmapReference; byte[] array = new byte[84]; foreach (ScheduleInterval scheduleInterval in intervals) { WeekDayAndTime t = scheduleInterval.StartTime.ToUniversalTime(weekBitmapReference); WeekDayAndTime t2 = scheduleInterval.EndTime.ToUniversalTime(weekBitmapReference); if (t <= t2) { ScheduleInterval.UpdateBitmap((int)t.DayOfWeek, t.Hour, t.Minute, (int)t2.DayOfWeek, t2.Hour, t2.Minute, array); } else { ScheduleInterval.UpdateBitmap((int)t.DayOfWeek, t.Hour, t.Minute, 6, 23, 60, array); ScheduleInterval.UpdateBitmap(0, 0, 0, (int)t2.DayOfWeek, t2.Hour, t2.Minute, array); } } return(array); }
public ScheduleInterval(WeekDayAndTime startTime, WeekDayAndTime endTime) { this.startTime = startTime.AlignToMinutes(15); this.endTime = endTime.AlignToMinutes(15); }