Ideal data structure/techniques for storing generic scheduler data in C#
- by GraemeMiller
I am trying to implement a generic scheduler object in C# 4 which will output a table in HTML. Basic aim is to show some object along with various attributes, and whether it was doing something in a given time period.
The scheduler will output a table displaying the headers:
Detail Field 1 ....N| Date1.........N
I want to initialise the table with a start date and an end date to create the date range (ideally could also do other time periods e.g. hours but that isn't vital). I then want to provide a generic object which will have associated events.
Where an object has events within the period I want a table cell to be marked
E.g.
Name Height Weight 1/1/2011 2/1/2011 3/1/20011...... 31/1/2011
Ben 5.11 75 X X X
Bill 5.7 83 X X
So I created scheduler with Start Date=1/1/2011 and end date 31/1/2011
I'd like to give it my person object (already sorted) and tell it which fields I want displayed (Name, Height, Weight)
Each person has events which have a start date and end date. Some events will start and end outwith but they should still be shown on the relevant date etc.
Ideally I'd like to have been able to provide it with say a class booking object as well. So I'm trying to keep it generic.
I have seen Javasript implementations etc of similar.
What would a good data structure be for this? Any thoughts on techniques I could use to make it generic. I am not great with generics so any tips appreciated.