I am trying to figure out a pattern that would allow me to keep track of scheduled day ranges and time ranges during a week to make sure that they don't overlap one another when entering into an interface. I was wondering if anyone has ever come across this and has any ideas? Remembering that this does not deal with any datetime values, only DayOfWeek and Timespan. For example, the following schedules are added:
Monday-Saturday: 12:00 AM to 8:00 AM
Monday-Thursday, 8:00 AM to 12:00 PM and 1:00 PM to 6:00 PM
Monday-Thursday, 12:00 PM to 1:00 PM
Monday-Thursday, 1:00 PM to 5:00 PM (this one causes it to error)
My thoughts have been that I could step through the day ranges from the start day to the end day and through the time ranges using some combination of these values that make it unique to add to a dictionary so that if a replication occurs the dictionary throws an exception.
I have to think that something like this has been done before and was wondering if anyone can point me in a direction. I appreciate any comments on this.
James