コード例 #1
0
 def find_student(self, Id):
     '''
     Find a student based on its Id, and returns its characteristics
     '''
     try:
         return self.__rep.find(Id)
     except ValidatorError as ve:
         raise StoreError(ex=ve)
     except RepositoryError as re:
         raise StoreError(ex=re)
コード例 #2
0
 def delete_student(self, Id):
     '''
     Deletes a student and its characteristics
     '''
     try:
         self.__rep.delete(Id)
     except ValidatorError as ve:
         raise StoreError(ex=ve)
     except RepositoryError as re:
         raise StoreError(ex=re)
コード例 #3
0
 def add_student(self, Id, name, group):
     '''
     add a student
     '''
     s = Student(Id, name, group)
     try:
         self.__rep.save(s)
     except ValidatorError as ve:
         raise StoreError(ex=ve)
     except RepositoryError as re:
         raise StoreError(ex=re)
コード例 #4
0
ファイル: CLaboratory.py プロジェクト: andidh/Python
 def add_Laboratory(self, number, description, deadline):
     '''
     Adds a new laboratory assignment
     '''
     l = Laboratory(number, description, deadline)
     try:
         self.__rep.save(l)
     except ValidatorError as ve:
         raise StoreError(ex=ve)
     except RepositoryError as re:
         raise StoreError(ex=re)
コード例 #5
0
ファイル: console.py プロジェクト: andidh/Python
 def findLab(self):
     Nr = int(input("Give the number of lab: "))
     try:
         l = self.__controllerL.find_lab(Nr)
         print(l)
     except StoreError as ve:
         raise StoreError(ex=ve)
コード例 #6
0
ファイル: console.py プロジェクト: andidh/Python
 def FindStudent(self):
     Id = int(input("Give id: "))
     try:
         s = self.__controllerS.find_student(Id)
         print(s)
     except StoreError as ve:
         raise StoreError(ex=ve)
コード例 #7
0
ファイル: console.py プロジェクト: andidh/Python
 def DeleteLab(self):
     Id = int(input("Give the number of lab:"))
     try:
         self.__controllerL.delete_Laboratory(Id)
         self.PrintAllLaboratories()
     except StoreError as ve:
         raise StoreError(ex=ve)
コード例 #8
0
ファイル: console.py プロジェクト: andidh/Python
 def DeleteStudent(self):
     Id = int(input("Give id:"))
     try:
         self.__controllerS.delete_student(Id)
         self.PrintAllStudents()
     except StoreError as ve:
         raise StoreError(ex=ve)
コード例 #9
0
ファイル: CGrade.py プロジェクト: andidh/Python
 def associate(self, Id, number, Grade):
     '''
     Assigns to every student a laboratory
     Input - id (integer)
           - number (integer) - the number of laboratory
           - grade (float) - the grade for the assignment
     '''
     try:
         stud = self.__repoS.find(Id)
         lab = self.__repoL.find(number)
         n = Grade(stud, lab, Grade)
         self.__repoG.save(n)
     except ValidatorError as ve:
         raise StoreError(ex=ve)
     except RepositoryError as re:
         raise StoreError(ex=re)
     return n
コード例 #10
0
ファイル: console.py プロジェクト: andidh/Python
 def UpdateStudent(self):
     Id = int(input("Give id: "))
     name = input("Give name: ")
     group = int(input("Give group:"))
     try:
         self.__controllerS.update_student(Id, name, group)
         self.PrintAllStudent()
     except StoreError as ve:
         raise StoreError(ex=ve)
コード例 #11
0
ファイル: console.py プロジェクト: andidh/Python
 def PrintLab(self, Id):
     Id = int(input("Give the number of the Laboratory: "))
     description = input("Give a description ")
     deadline = input("Give deadline: ")
     try:
         self.__controllerL.add_Laboratory(Id, description, deadline)
         print("Laboratory was successfully added.")
     except StoreError as ve:
         raise StoreError(ex=ve)
コード例 #12
0
ファイル: console.py プロジェクト: andidh/Python
 def PrintStud(self, Id):
     Id = int(input("Give id: "))
     name = input("Give name: ")
     group = int(input("Give group: "))
     try:
         self.__controllerS.add_student(Id, name, group)
         print(name, "was successfully added.")
     except StoreError as ve:
         raise StoreError(ex=ve)
コード例 #13
0
ファイル: console.py プロジェクト: andidh/Python
 def UpdateLaboratory(self):
     Id = int(input("Give id: "))
     description = input("Give description: ")
     deadline = input("Give deadline:")
     try:
         self.__controllerL.update_lab(Id, description, deadline)
         self.PrintAllLaboratories()
     except StoreError as ve:
         raise StoreError(ex=ve)
コード例 #14
0
ファイル: console.py プロジェクト: andidh/Python
 def PrintGrades(self):
     Id = int(input("Give id student:"))
     Nr = int(input("Give the number of assignment:"))
     grade = int(input("Give grade:"))
     try:
         self.__controllerG.associate(Id, Nr, grade)
         print(self.__controllerS.find_student(Id), "has grade ", grade,
               " for laboratory number ", Nr)
     except StoreError as ve:
         raise StoreError(ex=ve)