/// <summary> /// Gets complete information about an instruction day in terms of regular and extra classes along with attendance. /// </summary> /// <param name="instructionDayDate"> /// The date for which to get the details. /// </param> /// <returns> /// A static copy of the day's information as a DayInfo object. /// </returns> public DayInfo GetExactDayInfo(DateTimeOffset instructionDayDate) { int day = (int)instructionDayDate.DayOfWeek; DateTimeOffset date = new DateTimeOffset(instructionDayDate.Date, new TimeSpan(5, 30, 0)); DayInfo dayInfo = new DayInfo(); Dictionary<Course, int> courseBlotCount = new Dictionary<Course, int>(); foreach (ClassHours classHours in _weekRegularClasses[day]) { if (courseBlotCount.ContainsKey(classHours.Parent)) courseBlotCount[classHours.Parent] += 1; else courseBlotCount[classHours.Parent] = 0; AttendanceGroup group = GetAttendanceGroup(classHours.Parent.Attendance._details, date); AttendanceStub stub = null; if (group != null) if (group.Details.Count > courseBlotCount[classHours.Parent]) stub = group.Details[courseBlotCount[classHours.Parent]]; dayInfo.RegularClassDetails.Add(new KeyValuePair<ClassHours, AttendanceStub>(classHours, stub)); } foreach (LtpCourse course in _weekNeglectedCourses[day]) { AttendanceGroup group = GetAttendanceGroup(course.Attendance._details, date); if (group != null) { foreach (AttendanceStub stub in group.Details) dayInfo.ExtraClassDetails.Add(new KeyValuePair<LtpCourse, AttendanceStub>(course, stub)); } } return dayInfo; }