Exemplo n.º 1
0
 def quitCourse(username, courseId):
     id = AccountDAO.getStudentIdByUserName(username)
     result = CourseDAO.quitCourse(id, courseId)
     return xmlutil.loginResultToXml({
         'success': result[0],
         'message': result[1]
     })
Exemplo n.º 2
0
 def getAllCourseInfo():
     return xmlutil.courseResultToXml({
         'success':
         unicode(True),
         'message':
         u'获取课程信息成功',
         'courses':
         CourseService.__toCourseDict(CourseDAO.getAllCourseInfo())
     })
Exemplo n.º 3
0
 def getCourseInfo(username):
     id = AccountDAO.getStudentIdByUserName(username)
     return xmlutil.courseResultToXml({
         'success':
         unicode(True),
         'message':
         u'获取选课信息成功',
         'courses':
         CourseService.__toCourseDict(CourseDAO.getCourseInfo(id))
     })
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
 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)
     })
Exemplo n.º 6
0
    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])
        })
Exemplo n.º 7
0
    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)
        })
Exemplo n.º 8
0
    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)
        })