def create_project(self, name, user_id, project_type_id, semester_id,
                       assignment_id, project_description, partners, capacity,
                       preferred_room, b_days_pre_schedule, b_days_finale,
                       b_days_saturdays, preferred_b_days, additional_lecturer,
                       weekly):
        """Neues Projekt anlegen"""

        project = Project()
        project.set_name(name)
        project.set_user_id(user_id)
        project.set_project_type_id(project_type_id)
        project.set_semester_id(semester_id)
        project.set_assignment_id(assignment_id)
        project.set_project_description(project_description)
        project.set_partners(partners)
        project.set_capacity(capacity)
        project.set_preferred_room(preferred_room)
        project.set_b_days_pre_schedule(b_days_pre_schedule)
        project.set_b_days_finale(b_days_finale)
        project.set_b_days_saturdays(b_days_saturdays)
        project.set_preferred_b_days(preferred_b_days)
        project.set_additional_lecturer(additional_lecturer)
        project.set_weekly(weekly)
        project.set_id(1)

        with ProjectMapper() as mapper:
            return mapper.insert(project)
    def find_by_key(self, id):
        """Suchen eines Projektes mit vorgegebener user ID"""

        result = []
        cursor = self._cnx.cursor()
        command = "SELECT * FROM project WHERE id like '{}'".format(id)
        cursor.execute(command)
        tuples = cursor.fetchall()

        if len(tuples) != 0:

            for (id, name, user_id, project_type_id, state_id, semester_id,
                 assignment_id, project_description, partners, capacity,
                 preferred_room, b_days_pre_schedule, b_days_finale,
                 b_days_saturdays, preferred_b_days, additional_lecturer,
                 weekly, create_time) in tuples:
                project = Project()
                project.set_id(id)
                project.set_name(name)
                project.set_user_id(user_id)
                project.set_project_type_id(project_type_id)
                project.set_state_id(state_id)
                project.set_semester_id(semester_id)
                project.set_assignment_id(assignment_id)
                project.set_project_description(project_description)
                project.set_partners(partners)
                project.set_capacity(capacity)
                project.set_preferred_room(preferred_room)
                project.set_b_days_pre_schedule(b_days_pre_schedule)
                project.set_b_days_finale(b_days_finale)
                project.set_b_days_saturdays(b_days_saturdays)
                project.set_preferred_b_days(preferred_b_days)
                project.set_additional_lecturer(additional_lecturer)
                project.set_weekly(weekly)
                project.set_create_time(create_time)
                result.append(project)
                result = project

        else:

            result = None

        self._cnx.commit()
        cursor.close()

        return result
    def find_all(self):
        """Auslesen aller Projekte"""

        result = []
        cursor = self._cnx.cursor()
        command = "SELECT * FROM project"
        cursor.execute(command)
        tuples = cursor.fetchall()

        for (id, name, user_id, project_type_id, state_id, semester_id,
             assignment_id, project_description, partners, capacity,
             preferred_room, b_days_pre_schedule, b_days_finale,
             b_days_saturdays, preferred_b_days, additional_lecturer, weekly,
             create_time) in tuples:
            project = Project()
            project.set_id(id)
            project.set_name(name)
            project.set_user_id(user_id)
            project.set_project_type_id(project_type_id)
            project.set_state_id(state_id)
            project.set_semester_id(semester_id)
            project.set_assignment_id(assignment_id)
            project.set_project_description(project_description)
            project.set_partners(partners)
            project.set_capacity(capacity)
            project.set_preferred_room(preferred_room)
            project.set_b_days_pre_schedule(b_days_pre_schedule)
            project.set_b_days_finale(b_days_finale)
            project.set_b_days_saturdays(b_days_saturdays)
            project.set_preferred_b_days(preferred_b_days)
            project.set_additional_lecturer(additional_lecturer)
            project.set_weekly(weekly)
            project.set_create_time(create_time)
            result.append(project)

        self._cnx.commit()
        cursor.close()

        return result