public IList<Course> GetAllSelectableCourse(string className, string grade,int studentId) { IClassGradeCourseDao classGradeCourseDao = new ClassGradeCourseDao(sessionFactory); IList<ClassGradeCourse> classGradeCourseList = classGradeCourseDao.GetAllSelectableClassGradeCourse(className, grade); ICourseDao courseDao=new CourseDao(sessionFactory); for (int i = 0; i < classGradeCourseList.Count; i++) { Course closeCourse = courseDao.Get(classGradeCourseList[i].ID.classGradeCourseCourseId); //如果这一门课是关闭了,就去掉这个选课关联项 if (false == closeCourse.courseOpenCloseFlag) { classGradeCourseList.RemoveAt(i); continue; } //再去掉已经选择的课程,有courseID,年级,专业,课,这门课就不用显示了 ISelectionDao selectionDao = new SelectionDao(sessionFactory); IList<Selection> selectionList = selectionDao.GetSelectionByStudentId(studentId); for (int j = 0; j < selectionList.Count; j++) { if (selectionList[j].ID.selectionCourseID == classGradeCourseList[i].ID.classGradeCourseCourseId) { classGradeCourseList.RemoveAt(i); continue; } } } IList<Course> selectableCourseList = new List<Course>(); for (int j = 0; j < classGradeCourseList.Count; j++) { Course selectableCourse =courseDao.Get(classGradeCourseList[j].ID.classGradeCourseCourseId); selectableCourseList.Add(selectableCourse); } return selectableCourseList; }
public IList<Course> GetAllSelectedCourse(int studentId) { ISelectionDao selectionDao = new SelectionDao(sessionFactory); IList<Selection> selectedSelectionList=selectionDao.GetSelectionByStudentId(studentId); ICourseDao courseDao = new CourseDao(sessionFactory); IList<Course> selectedCourseList = new List<Course>(); for (int i = 0; i < selectedSelectionList.Count;i++ ) { Course selectedCourse=courseDao.Get(selectedSelectionList[i].ID.selectionCourseID); selectedCourseList.Add(selectedCourse); } return selectedCourseList; }