public SCValidatorCreator(List <SHStudentRecord> studentList, List <SHCourseRecord> courseList, List <SHSCAttendRecord> scaList) { _studentDict = new StudentNumberDictionary(); _courseDict = new Dictionary <string, SHCourseRecord>(); _studentCourseInfo = new StudentCourseInfo(); _attendCourseIDs = new List <string>(); foreach (SHStudentRecord student in studentList) { string studentNumber = student.StudentNumber; //studentNumber = GetStudentNumberFormat(studentNumber); if (!_studentDict.ContainsKey(studentNumber)) { _studentDict.Add(studentNumber, student); } _studentCourseInfo.Add(student); } foreach (SHCourseRecord course in courseList) { if (!_courseDict.ContainsKey(course.ID)) { _courseDict.Add(course.ID, course); } } //Linq var student_ids = from student in studentList select student.ID; //foreach (JHSCAttendRecord sc in JHSCAttend.Select(student_ids.ToList<string>(), null, null, "" + schoolYear, "" + semester)) foreach (SHSCAttendRecord sc in scaList) { if (!_studentCourseInfo.ContainsID(sc.RefStudentID)) { continue; } if (!_courseDict.ContainsKey(sc.RefCourseID)) { continue; } if (!_attendCourseIDs.Contains(sc.RefCourseID)) { _attendCourseIDs.Add(sc.RefCourseID); } _studentCourseInfo.AddCourse(sc.RefStudentID, _courseDict[sc.RefCourseID]); } }
public StudentValidator(StudentNumberDictionary studentDict) { _studentDict = studentDict; }