def quitCourse(username, courseId): id = AccountDAO.getStudentIdByUserName(username) result = CourseDAO.quitCourse(id, courseId) return xmlutil.loginResultToXml({ 'success': result[0], 'message': result[1] })
def getAllCourseInfo(): return xmlutil.courseResultToXml({ 'success': unicode(True), 'message': u'获取课程信息成功', 'courses': CourseService.__toCourseDict(CourseDAO.getAllCourseInfo()) })
def getCourseInfo(username): id = AccountDAO.getStudentIdByUserName(username) return xmlutil.courseResultToXml({ 'success': unicode(True), 'message': u'获取选课信息成功', 'courses': CourseService.__toCourseDict(CourseDAO.getCourseInfo(id)) })
def getCourseStatistics(): allInfo = CourseDAO.getAllCourseInfo() result = [] for info in allInfo: num = CourseService.__getSelectStudentNum(info[0]) result.append({ "courseId": unicode(info[0]), "studentNum": unicode(num), "name": info[1], "institutionId": unicode(departmentId) }) return xmlutil.icourseStatisticsToXml(result)
def iGetCourseInfoByIds(ids): courseList = [] for id in ids: courseList.extend(CourseDAO.getCourseInfoById(int(id))) return xmlutil.icourseResultToXml({ 'success': unicode(True), 'message': u'获取课程信息成功', 'courses': NetCourse.__itoCourseDict(courseList) })
def wsQuitCourse(username, courseId, courseDept): result = None id = AccountDAO.getStudentIdByUserName(username) if (courseDept == departmentId): result = CourseDAO.quitCourse(id, courseId) else: result = CourseWebService.__wsQuitCourse(id, departmentId, courseId, courseDept) return xmlutil.loginResultToXml({ 'success': unicode(result[0]), 'message': unicode(result[1]) })
def wsGetAllCourseInfo(): info = CourseDAO.getAllCourseInfo() info = map(lambda x: (departmentId, ) + x, info) otherInfo = CourseWebService.__wsGetOtherCourseInfo(departmentId) info.extend(otherInfo) return xmlutil.icourseResultToXml({ 'success': unicode(True), 'message': u'获取课程信息成功', 'courses': CourseWebService.__wsToCourseDict(info) })
def iGetSelectCourseInfo(username): id = AccountDAO.getStudentIdByUserName(username) info = CourseDAO.getCourseInfo(id) info = map(lambda x: (departmentId, ) + x, info) otherInfo = NetCourse.__iGetOtherSelectCourseInfo(id, departmentId) info.extend(otherInfo) return xmlutil.icourseResultToXml({ 'success': unicode(True), 'message': u'获取选课信息成功', 'courses': NetCourse.__itoCourseDict(info) })