public List <String> getCoursesName(List <CourseRelation> courseRelations) { List <String> temp = new List <String>(); foreach (CourseRelation courseRelation in courseRelations) { temp.Add(CourseNameApi.findByCourseNameID(courseRelation.preCourseNameID).courseName); } return(temp); }
public String getCourseName(int courseId) { //fragile return(CourseNameApi.findByCourseNameID(int.Parse(CourseInfoApi.findByCourseID(courseId).courseName)).courseName); }
public List <CourseAndClassList> currentCourseByStudentId(int studentId) { //fragile int month = DateTime.Now.Month + 1; int year = DateTime.Now.Year; if (month <= 2) { year--; } String semester = ""; if (month >= 3 && month <= 8) { semester = "春季"; } else { semester = "秋季"; } List <Takes> takesList = TakesApi.findByStudentID(studentId); List <CourseClass> courseClasses = new List <CourseClass>(); foreach (Takes takes in takesList) { courseClasses.Add(CourseClassApi.getByID(takes.courseClassID)); } List <CourseAndClassList> courseAndClassLists = new List <CourseAndClassList>(); foreach (CourseClass courseClass in courseClasses) { CourseInfo courseInfo = CourseInfoApi.findByCourseID(courseClass.courseID); if (courseInfo.courseYear.Equals(year) && courseInfo.courseSemester.Equals(semester)) { courseAndClassLists.Add(new CourseAndClassList(courseInfo, courseClass, CourseNameApi.findByCourseNameID(int.Parse(courseInfo.courseName)).courseName)); } } return(courseAndClassLists); }
/*public List<UnratedChapter> getUnratedChapters(int classId) * { * List<UserInfo> userInfos = CourseService.getStudentsByClassID(classId); * List<ChapterNode> chapterNodes = ChapterContentApi.findByCourseID(CourseClassApi.getByID(classId).courseID); * List<ChapterNode> chapterNodeList = new List<ChapterNode>(); * foreach (ChapterNode chapterNode in chapterNodes) * { * if (chapterNode.exerciseTitle != null) * chapterNodeList.Add(chapterNode); * } * List<UnratedChapter> unratedChapters = new List<UnratedChapter>(); * foreach (ChapterNode chapterNode in chapterNodeList) * { * foreach (UserInfo userInfo in userInfos) * { * StudentChapter studentChapter = StudentChapterApi.findByChapterIDAndStudentID(chapterNode.id, userInfo.userID); * if (studentChapter != null) * { * int? temp = studentChapter.scored_2; * if (temp != null) * { * if (temp == 0) * { * unratedChapters.Add(new UnratedChapter(chapterNode, userInfo.userID)); * break; * } * } * } * } * } * return unratedChapters; * } * */ public List <CourseAndClassList> currentCourseByTeacherId(int teacherId) { //fragile int month = DateTime.Now.Month + 1; int year = DateTime.Now.Year; if (month <= 2) { year--; } String semester = ""; if (month >= 3 && month <= 8) { semester = "春季"; } else { semester = "秋季"; } List <CourseInfo> courseInfos = CourseInfoApi.findByTeacherIDAndCourseYearAndCourseSemester(teacherId, year, semester); List <CourseAndClassList> courseAndClassLists = new List <CourseAndClassList>(); foreach (CourseInfo courseInfo in courseInfos) { courseAndClassLists.Add(new CourseAndClassList(courseInfo, CourseClassApi.findByCourseID(courseInfo.courseID), CourseNameApi.findByCourseNameID(int.Parse(courseInfo.courseName)).courseName)); } return(courseAndClassLists); }