def update(oid: int, name: str) -> int: """Update a department""" check_oid_exists(oid) check_not_null(name, "The department's name cannot be empty") try: new_oid = department_dal.update(oid, name) except DALException as exc: raise BLLException(exc) from exc return new_oid
def insert(name: str) -> int: """Insert a new department""" check_not_null(name, "The subject's name cannot be empty") # Insert the new department try: oid = department_dal.insert(name) except DALException as exc: raise BLLException(exc) from exc return oid
def insert(name: str, activity: str, year: int, subjectId: int, classroomId: int) -> int: """Insert a new group""" check_not_null(name, "The group's name cannot be empty") check_not_null(activity, "The group's activity cannot be empty") check_not_null(year, "The group's year cannot be empty") check_not_null(subjectId, "The group's subjectId cannot be empty") check_not_null(classroomId, "The group's classroomId cannot be empty") # Insert the new group try: oid = group_dal.insert(name, activity, year, subjectId, classroomId) except DALException as exc: raise BLLException(exc) from exc return oid
def update( oid: int, name: str, activity: str, year: int, subjectId: int, classroomId: int, ) -> int: """Update a group""" check_oid_exists(oid) check_not_null(name, "The group's name cannot be empty") check_not_null(activity, "The group's activity cannot be empty") check_not_null(year, "The group's year cannot be empty") check_not_null(subjectId, "The group's subjectId cannot be empty") check_not_null(classroomId, "The group's classroomId cannot be empty") try: new_oid = group_dal.update(oid, name, activity, year, subjectId, classroomId) except DALException as exc: raise BLLException(exc) from exc return new_oid
def insert(self, name, acronym, n_credits, course, subject_type, degreeId): # Check that the name and acronym are not empty check_not_null(name, "The subject's name cannot be empty") check_not_null(acronym, "The subject's acronym cannot be empty") check_not_null(n_credits, "The subject's credits cannot be empty") # Insert the new subject try: oid = super().insert(name, acronym, n_credits, course, subject_type, degreeId) except DALException as exc: raise BLLException(exc) from exc return oid
def update(self, oid, name, acronym, n_credits, course, subject_type, degreeId): # Check that the name and acronym are not empty, and that the OID exists self.check_oid_exists(oid) check_not_null(name, "The subject's name cannot be empty") check_not_null(acronym, "The subject's acronym cannot be empty") check_not_null(n_credits, "The subject's credits cannot be empty") try: new_oid = super().update(oid, name, acronym, n_credits, course, subject_type, degreeId) except DALException as exc: raise BLLException(exc) from exc return new_oid
def insert(professorId: int, groupId: int, credits: int) -> int: """Insert a new group""" check_not_null(professorId, "The group's professorId cannot be empty") check_not_null(groupId, "The group's groupId cannot be empty") check_not_null(credits, "The group's credits cannot be empty") # Insert the new group try: oid = teaching_loads_dal.insert(professorId, groupId, credits) bussines_law_13(professorId, groupId) except DALException as exc: raise BLLException(exc) from exc return oid
def update(oid: int, professorId: int, groupId: int, credits: int) -> int: """Update a group""" check_oid_exists(oid) check_not_null(professorId, "The group's name cannot be empty") check_not_null(groupId, "The group's activity cannot be empty") check_not_null(credits, "The group's year cannot be empty") try: new_oid = teaching_loads_dal.update(oid, professorId, groupId, credits) bussines_law_13(professorId, groupId) except DALException as exc: raise BLLException(exc) from exc return new_oid
def check_attributes_not_empty(self, dni, firstName, surname, birthDate, email, category): check_not_null(dni, "DNI can't be empty") check_not_null(category, "The teacher's category can't be empty") check_not_null(firstName, "The teacher's firstName can't be empty") check_not_null(surname, "The teacher's surname can't be empty") check_not_null(birthDate, "The teacher's birthDate can't be empty") check_not_null(email, "The teacher's email can't be empty")
def check_attributes_not_empty(self, accessMethod, dniSt, firstNameSt, surname, birthDateSt, emailSt): check_not_null(accessMethod, "The accessMethod cannot be empty") check_not_null(dniSt, "The dniSt cannot be empty") check_not_null(firstNameSt, "The firstNameSt cannot be empty") check_not_null(surname, "The surname cannot be empty") check_not_null(birthDateSt, "The birthDateSt cannot be empty") check_not_null(emailSt, "The emailSt cannot be empty")
def check_attributes_not_empty(self, dateAppointment, hourAppointment, tutorialId, studentId): check_not_null(dateAppointment, "dateAppointment can't be empty") check_not_null(hourAppointment, "hourAppointment can't be empty") check_not_null(tutorialId, "The tutorialId can't be empty") check_not_null(studentId, "The studentId can't be empty")
def check_attributes_not_empty(self, dayWeek, startTime, endTime): check_not_null(dayWeek, "dayWeek can't be empty") check_not_null(startTime, "startTime can't be empty") check_not_null(endTime, "endTime can't be empty")
def insert( office_id: int, department_id: int, category: str, dni: str, first_name: str, surname: str, birth_date: str, email: str, ) -> int: """Insert a new professor""" check_not_null(office_id, "The group's office_id cannot be empty") check_not_null(department_id, "The group's department_id cannot be empty") check_not_null(category, "The group's category cannot be empty") check_not_null(dni, "The group's dni cannot be empty") check_not_null(first_name, "The group's first_name cannot be empty") check_not_null(surname, "The group's surname cannot be empty") check_not_null(birth_date, "The group's birth_date cannot be empty") check_not_null(email, "The group's email cannot be empty") check_field_is_enum( category, {"CU", "TU", "PCD", "PAD"}, f"The field 'category' must be one of ('CU', 'TU', 'PCD', 'PAD')", ) check_dni(dni) check_dni_exists(dni) check_email_exists(dni) bussines_law_14(category, department_id) # Insert the new group try: oid = professor_dal.insert( office_id, department_id, category, dni, first_name, surname, birth_date, email, ) except DALException as exc: raise BLLException(exc) from exc return oid
def update( oid: int, name: str, acronym: str, n_credits: int, course: int, subject_type: str, degree_id: int, department_id: int, ) -> int: """Update a subject""" check_oid_exists(oid) check_not_null(name, "The subject's name cannot be empty") check_not_null(acronym, "The subject's acronym cannot be empty") check_not_null(n_credits, "The subject's credits cannot be empty") check_not_null(course, "The subject's course cannot be empty") check_not_null(subject_type, "The subject's subject type cannot be empty") check_not_null(degree_id, "The subject's degree_id cannot be empty") check_not_null(department_id, "The subject's department_id cannot be empty") check_field_is_enum( subject_type, {"Formacion Basica", "Optativa", "Obligatoria"}, f"The field 'subject_type' must be one of ('Formacion Basica', 'Optativa', 'Obligatoria')", ) try: new_oid = subject_dal.update( oid, name, acronym, n_credits, course, subject_type, degree_id, department_id, ) except DALException as exc: raise BLLException(exc) from exc return new_oid