示例#1
0
 def verifyGrade(self, grade):
     if self.__repositoryStudent.verifyID(grade.getStudentID()) == False:
         raise ServiceError("student with ID " + str(grade.getStudentID()) +
                            " doesn't exist")
     if self.__repositoryAssignment.verifyID(
             grade.getAssignmentID()) == False:
         raise ServiceError("assignment with ID " +
                            str(grade.getAssignmentID()) + " doesn't exit")
     if self.__repositoryGrade.verifyID(grade.getID()) == True:
         raise ServiceError("grade with student ID " +
                            str(grade.getStudentID()) +
                            " and assignment ID " +
                            str(grade.getAssignmentID()) +
                            " already exists")
示例#2
0
 def update(self, assignment, newAssignment):
     if assignment.getID() == newAssignment.getID():
         self.__repository.replace(assignment, newAssignment)
     else:
         raise ServiceError("ID" + str(assignment.getID()) +
                            " doesn't match ID " +
                            str(newAssignment.getID()))
 def update(self, student, newStudent):
     if student.getID() == newStudent.getID():
         self.__repository.replace(student, newStudent)
     else:
         raise ServiceError("ID" + str(student.getID()) +
                            " doesn't match ID " + str(newStudent.getID()))
 def check(self, student):
     if self.__repository.verifyID(student.getID()) == False:
         raise ServiceError("student with ID " + str(student.getID()) +
                            " doesn't exist")
 def verify(self, student):
     if self.__repository.verifyID(student.getID()) == True:
         raise ServiceError("student with ID " + str(student.getID()) +
                            " already exists")
示例#6
0
 def checkGrade(self, grade):
     if self.__repositoryGrade.verifyID(grade.getID()) == False:
         raise ServiceError("grade with student ID " +
                            str(grade.getStudentID()) +
                            " and assignment ID " +
                            str(grade.getAssignmentID()) + " doesn't exist")
示例#7
0
 def update(self, grade, newGrade):
     if grade.getID() == newGrade.getID():
         self.__repositoryGrade.replace(grade, newGrade)
     else:
         raise ServiceError("ID" + str(grade.getID()) +
                            " doesn't match ID " + str(newGrade.getID()))