Need Help with conceptual on a Schedule Class

Posted on 2005-04-21
Last Modified: 2010-04-23
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.
Question by:mnichols1202
    LVL 5

    Expert Comment

    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.

    Author Comment

    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

    LVL 5

    Accepted Solution

    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


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video discusses moving either the default database or any database to a new volume.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now