/// <summary> /// Accesses the schedule database and updates a slot with different information /// </summary> public static List <Appointment> GetDay(DateTime date) { date = DateSupport.ToHour(date, 1); List <Appointment> appointments = new List <Appointment>(); int numAppts = -1; int dayOfWeek = DateSupport.GetDayIndex(date); if (dayOfWeek == (int)DayOfWeek.Saturday || dayOfWeek == (int)DayOfWeek.Sunday) { numAppts = APPT_WEEKDAY_TIMES.Length; } else { numAppts = APPT_WEEKEND_TIMES.Length; } for (int i = 0; i < numAppts; i++) { appointments.Add(new Appointment(date)); date = date.AddHours(1); } return(appointments); }
public static List <Appointment> GetWeek(DateTime date) { List <Appointment> appointments = new List <Appointment>(); date = DateSupport.BackToSunday(date); // get all appointment slots from all days in the week for (int i = 0; i < 7; i++) { appointments.AddRange(GetDay(date)); date = date.AddDays(1); } return(appointments); }
public static List <Appointment> GetMonth(DateTime date) { List <Appointment> appointments = new List <Appointment>(); // prepare our for loop date = DateSupport.BackToMonthStart(date); int numDays = DateSupport.NumDaysInMonth(date); // get all appointment slots from all days in the month for (int i = 0; i < numDays; ++i) { appointments.AddRange(GetDay(date)); date = date.AddDays(1); } return(appointments); }