我正在制作一个页面让讲座创建咨询槽,我制作的方式是将按钮控件循环5次(5个工作日)。我需要在时间表中禁用获得课程的按钮,并确定带有按钮内容的按钮,然后将其存储到数据库中。当讲师点击按钮时,弹出列(日期)+时间段的日期。获取当周的预约日期
Data for verify and disable button from table of timetable
start_time -> 2011-11-08 08:00:00
end_time -> 2011-11-08 10:00:00
然后,我打算使用END_TIME - START_TIME = 2小时后,在2个小时,然后08:00,08:30,从09:00 START_TIME,09:30 4按钮将禁用。我创建
string[] timeslot = {"08:00 AM", "08:30 AM", "09:00 AM", "09:30 AM", "10:00 AM", "10:30 AM", "11:00 AM", "11:30 AM", "12:00 PM", "12:30 PM", "01:00 PM", "01:30 PM", "02:00 PM", "02:30 PM", "03:00 PM", "03:30 PM", "04:00 PM", "04:30 PM", "05:00 PM", "05:30 PM"};
for (int i = 0; i < 20; i++)
{
Button btnMonday = new Button
{
Height = 38,
Width = 256,
Content = timeslot[i],
Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xB1, 0xB1, 0xB1))
};
// Sets dependency properties
btnMonday.SetValue(Grid.ColumnProperty, 0);
btnMonday.SetValue(Grid.RowProperty, i);
// Adds the dynamically created control to the canvas
LayoutRoot.Children.Add(btnMonday);
}
我创建了周一栏按钮的按钮,但我不能假设星期一是gettime.now()
,我可以知道我怎么能得到当前一周的一天的日期?
你要求'DayOfWeek'枚举吗?我有点困惑你的问题。 – Marc
我知道按钮是为星期一,星期二,星期三,星期四和星期五设计的。但它是自定义按钮,所以按钮需要知道本周的星期一的日期,本周的星期二... – 1myb