/// <summary> /// 依試別取得所有關聯課程 /// </summary> /// <param name="exam_id"></param> private void LoadCourses(string exam_id) { Dictionary <CourseRecord, AEIncludeRecord> courseAEDict = new Dictionary <CourseRecord, AEIncludeRecord>(); foreach (var course in Course.Instance.Items) { if (course.SchoolYear != intSchoolYear.Value) { continue; } if (course.Semester != intSemester.Value) { continue; } AssessmentSetupRecord asRecord = course.GetAssessmentSetup(); if (asRecord == null) { continue; } foreach (var ae in asRecord.GetAEIncludes()) { if (ae.RefExamID == exam_id) { if (!courseAEDict.ContainsKey(course)) { courseAEDict.Add(course, ae); } } } } Dictionary <string, List <SCETakeRecord> > courseScoreDict = GetCourseScores(exam_id); _courseListViewItemList.Clear(); foreach (CourseRecord course in courseAEDict.Keys) { List <SCETakeRecord> sceList = null; if (courseScoreDict.ContainsKey(course.ID)) { sceList = courseScoreDict[course.ID]; } else { sceList = new List <SCETakeRecord>(); } CourseListViewItem item = new CourseListViewItem(course, courseAEDict[course], sceList); _courseListViewItemList.Add(item); } }
/// <summary> /// 依試別取得所有關聯課程 /// </summary> /// <param name="exam_id"></param> private void LoadCourses(string exam_id) { Dictionary <CourseRecord, KH.JHAEIncludeRecord> courseAEDict = new Dictionary <CourseRecord, KH.JHAEIncludeRecord>(); List <string> CourseIDs = new List <string>(); foreach (var course in Course.Instance.Items) { if (course.SchoolYear != intSchoolYear.Value) { continue; } if (course.Semester != intSemester.Value) { continue; } CourseIDs.Add(course.ID); AssessmentSetupRecord asRecord = course.GetAssessmentSetup(); if (asRecord == null) { continue; } foreach (KH.JHAEIncludeRecord ae in _aeCache.Values) { if (ae.RefAssessmentSetupID == asRecord.ID && ae.RefExamID == exam_id) { if (!courseAEDict.ContainsKey(course)) { courseAEDict.Add(course, ae); } } } //foreach (var ae in asRecord.GetAEIncludes()) //{ // if (ae.RefExamID == exam_id) // { // KH.JHAEIncludeRecord ae2 = _aeCache[ae.ID]; // if (!courseAEDict.ContainsKey(course)) // courseAEDict.Add(course, ae2); // } //} } Dictionary <string, List <KH.JHSCETakeRecord> > courseScoreDict = GetCourseScores(exam_id, CourseIDs); _courseListViewItemList.Clear(); foreach (CourseRecord course in courseAEDict.Keys) { List <KH.JHSCETakeRecord> sceList = null; if (courseScoreDict.ContainsKey(course.ID)) { sceList = courseScoreDict[course.ID]; } else { sceList = new List <KH.JHSCETakeRecord>(); } CourseListViewItem item = new CourseListViewItem(course, courseAEDict[course], sceList); _courseListViewItemList.Add(item); } }