|
public class SimpleScheduleDataProvider : ScheduleDataProvider
{
public override IScheduleAppointmentList GetSchedule(DateTime startDate, DateTime endDate)
{
ScheduleAppointmentList list = new ScheduleAppointmentList();
DateTime start = startDate.Date;
DateTime end = endDate.Date;
foreach(ScheduleAppointment item in this.MasterList)
{
if (item.StartTime.Date < item.EndTime.Date)
{
int count = item.EndTime.Date.Day - item.StartTime.Date.Day;
for (int i = 0; i < count+1; i++)
{
IScheduleAppointment appointment = item.Clone() as IScheduleAppointment;
appointment.StartTime = item.StartTime.AddDays(i);
appointment.EndTime = appointment.StartTime;
list.Add(appointment);
}
}
}
list.SortStartTime();
return list;
}
} |