//选课,生成一个Selection public bool SelectCourse(int studentId, int courseId) { //IStudentDao studentDao = new StudentDao(sessionFactory); ICourseDao courseDao = new CourseDao(sessionFactory); Course selectedCourse = courseDao.Get(courseId); Selection newSelection = new Selection { ID = new SelectionID { selectionStudentID=studentId, selectionCourseID=selectedCourse.courseID, selectionStudyYear=selectedCourse.courseStudyYear, selectionTerm=selectedCourse.courseTerm }, selectionScorePermit=false, selectionScore =-1 }; ISelectionDao selectionDao = new SelectionDao(sessionFactory); if (null != selectionDao.Save(newSelection)) { return true; } else { return false; } }
public void Save(Selection newSelection) { ISelectionDao selectionDao = new SelectionDao(sessionFactory); selectionDao.Save(newSelection); }