Need Help with conceptual on a Schedule Class

I'm writing a Task Queueing program and am having trouble with the design of the class that will allow a manager to configure an employees schedule.

The requirements are:

1) The employee has a "default" work week.  Say Monday - Friday 7:00 to 4:00 with 11:00 to 12:00 for lunch, Saturday and Sunday off
2) There are predefined Days off - i.e Christmas, New Years, etc. that all employees schedules should reflect
3) There are employee specific schedule changes - Vacation, Sick Days, Etc. for each employee.

I want to use the schedule this way -  the employee has a task that starts @ 9:00am on monday and is estimated to take 24 hours. so the task start would show
Start: Monday June 6, 2005 9:00am
The schedule class would be able to give the estimated task end baised on the configured Schedule.
End: Wednesday June 8, 2005 4:00pm

The trouble i'm having is the concept of how you would design/structure a class or collection to do this.  I'm really not asking to have the class written for me.   The best help would be direction to documentation that explaines how this is handled from a design perspective.  I've alway been realy week when it comes to date/time based concepts such as this.

 to get ths example above i had to write out a mini calender on paper.  :P

Hope this was clear.  

Any help would be appreciated.
Who is Participating?
Well you need these things for sure then....

Task Queue

The scheduler needs to be able to find the end time of a task based on the proper schedule.... the .net datetime functions are very advanced and can help alot but you will need to a little work here.

The task queue will be nice if it can take a time ( maybe) and return all in progress tasks for that time, for each employee, things like that, it can do this by communicating with the scheduler

The scheduler may be powered by the day->week->month type of layout

I have written a webapp just like yours for my company.  It is a long process.

You should think from the smallest item up to the largest items, and design classes that way.

For instance, you might have a classes represent these items:

single task
work week

The work week would contain a collection of single tasks items.

You will need to write some datetime handling classes, I call each work week (or work month, or whatever unit) a 'period'.

The period class represents a work week, and can be created by offering a date within that period.  The period class then determines the start and end of the week, and contains an array of 'work days' within the week.

It is also smart to build an interface for this period class so that you might create several implementations for different work weeks.

It may be that since your software is more task based than time based, you want your structure to be around tasks, rather than time, in which case you could do something more simple.  Create a task class, and each task has a start and end time.  You can imagine a collection of tasks as many overlapping layers,  at any given time you could iterate through the tasks and see which ones intersect (overlap) the current time.

I assume you are basing this out of some database?

Hopefully i have helped to to get some ideas, let me know what you are thinking and we can discuss further.
mnichols1202Author Commented:
Thanks KeirGordon,

I had never really thought of it that way Day= > Week => Month =>Y ear simplifies the problem in my mind a bit.  

I think I'll proceede that way for now.  However, just in case this gels somthing for you i'll explain in a bit more detail what i'm expecting to use the class  for.

The "Queue" as were calling it is basically a list of tasks,  essentialy a description, expected duration in hours and Task Order

so simplified - task #1 always starts NOW and is expected to end when duration has passed.  (oversimplified but should give you the jist)

Task #2 is expected to begin where Task #1 Ends.... then Task #3 and Task #4 etc.

the purpose of the schedule is so that if Task #1 Begins at 8:00am and is expected to take 10 hours that is does not end at 8:00pm that night.  it should end at 10:00 AM on the Next Day.  Assuming that it's a normal day

or better Task #1 begins at 8:00 am on friday May 27, 2005 (memorial Day Weekend) and is expected to last 12 hours it would not be scheduled to end until Tuesday May 31, 2005 at 10:00 am

Does that wordy explaination change anything?

So the Primary method in this class other that methos use to load it will be a function that takes a startdate/time and a duration and returns the end Date/time based on the schedule

Again Thanks, for your help...I think this is beginning to jell a bit

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.