What suggestions do people have for a timeslot data structure?
人们对时隙数据结构有什么建议?
I have a number of activities and I'm planning to display them in a datagrid with days as columns and timeslots as rows. This suggests to me a timeslot data structure with 5 properties for the five days (the columns) for every value I want to use e.g. a timeslot ID and the number of slots left.
我有很多活动,我打算在数据网格中显示它们,将天数作为列,将时间段作为行显示。这向我建议了一个时隙数据结构,其中包含我想要使用的每个值的五天(列)的5个属性,例如时隙ID和剩余的插槽数。
So...
- Property Day1ID
- Property Day1Slots
- Property Day2ID
- Property Day2Slots
- Property Day3ID
- Property Day4Slots
- etc
Then each TimeSlot structure would be for a specific time... say 9:00 and another for each hour after that. Then I'd have a list of timeslot structures that will auto bind against the datagrid.
然后每个TimeSlot结构将在特定时间...比如9:00,之后每小时另一个结构。然后我会有一个时间段结构列表,它将自动绑定到数据网格。
I'm exporing new ground here and as you can see I'm not very clear on what/how to do it?
我在这里开辟了新的领域,你可以看到我不清楚该怎么做/怎么做?
All suggestions welcome,
欢迎所有建议,
Thanks
2 个解决方案
#1
Create a structure like this:
创建这样的结构:
struct DayInfo
{
int ID;
int[] Slots;
}
and then have a List to store all your data, which can be easy binded to 2 nested repeaters.
然后有一个List来存储你的所有数据,这些数据可以很容易地绑定到2个嵌套的中继器。
#2
I would not hard code the time slots and days. I would put them in a matrix. A matrix with e.g. 5 columns for the days and e.g. 24 rows for the timeslots.
我不会硬编码时间段和日期。我会把它们放在一个矩阵中。例如,矩阵每天有5列,例如时隙有24行。
#1
Create a structure like this:
创建这样的结构:
struct DayInfo
{
int ID;
int[] Slots;
}
and then have a List to store all your data, which can be easy binded to 2 nested repeaters.
然后有一个List来存储你的所有数据,这些数据可以很容易地绑定到2个嵌套的中继器。
#2
I would not hard code the time slots and days. I would put them in a matrix. A matrix with e.g. 5 columns for the days and e.g. 24 rows for the timeslots.
我不会硬编码时间段和日期。我会把它们放在一个矩阵中。例如,矩阵每天有5列,例如时隙有24行。