Exemplo n.º 1
0
 def __init__(self, title="", abstract="", author="", category="", subcategory="", isExposed="", isPresented="", createdAt="", modifiedAt=""):
     self.title = title
     self.abstract = abstract
     self.author = author
     self.category = category
     self.subcategory = subcategory
     self.isExposed = isExposed
     self.isPresented = isPresented
     self.createdAt = createdAt
     self.modifiedAt = modifiedAt
     self.connection = DatabaseFactory().getConnection()
Exemplo n.º 2
0
 def __init__(self,
              name="",
              cpf="",
              isStudent=0,
              createdAt="",
              modifiedAt=""):
     self.name = name
     self.cpf = cpf
     self.isStudent = isStudent
     self.createdAt = createdAt
     self.modifiedAt = modifiedAt
     self.connection = DatabaseFactory().getConnection()
Exemplo n.º 3
0
 def __init__(self,
              cpf="",
              name="",
              email="",
              password="",
              createdAt="",
              modifiedAt=""):
     self.cpf = cpf
     self.name = name
     self.email = email
     self.password = password
     self.createdAt = createdAt
     self.modifiedAt = modifiedAt
     self.connection = DatabaseFactory().getConnection()
Exemplo n.º 4
0
class Subcategory():
    def __init__(self):
        self.connection = DatabaseFactory().getConnection()

    def getAllSubcategories(self):
        try:
            with self.connection.cursor() as cursor:
                sql = "SELECT  *  FROM  subcategories"
                cursor.execute(sql)
                result = cursor.fetchall()

                return result
        except Exception as e:
            print(e)
            return None
        finally:
            self.connection.close()
Exemplo n.º 5
0
class Event():
    def __init__(self, name="", description=""):
        self.name = name
        self.description = description
        self.connection = DatabaseFactory().getConnection()

    def getEventByCode(self, code):
        try:
            with self.connection.cursor() as cursor:
                sql = "SELECT  *  FROM  events  WHERE  code=%s"
                cursor.execute(sql, (code))
                result = cursor.fetchone()

                return result
        except Exception as e:
            print(e)
            return None
        finally:
            self.connection.close()
Exemplo n.º 6
0
class Admin():
    def __init__(self,
                 cpf="",
                 name="",
                 email="",
                 password="",
                 createdAt="",
                 modifiedAt=""):
        self.cpf = cpf
        self.name = name
        self.email = email
        self.password = password
        self.createdAt = createdAt
        self.modifiedAt = modifiedAt
        self.connection = DatabaseFactory().getConnection()

    def create(self):
        try:
            with self.connection.cursor() as cursor:
                sql = "INSERT INTO admins(cpf, name, email, password, createdAt, modifiedAt) VALUES (%s, %s, %s, %s, %s, %s)"
                cursor.execute(sql,
                               (self.cpf, self.name, self.email, self.password,
                                self.createdAt, self.modifiedAt))
                self.connection.commit()

                return True
        except Exception as e:
            print(e)
            return False
        finally:
            self.connection.close()

    def getAdminByEmail(self, email):
        try:
            with self.connection.cursor() as cursor:
                sql = "SELECT  *  FROM  admins  WHERE  email=%s"
                cursor.execute(sql, (email))
                result = cursor.fetchone()

                return result
        except Exception as e:
            print(e)
            return None
        finally:
            self.connection.close()
Exemplo n.º 7
0
class Author():
    def __init__(self,
                 name="",
                 cpf="",
                 isStudent=0,
                 createdAt="",
                 modifiedAt=""):
        self.name = name
        self.cpf = cpf
        self.isStudent = isStudent
        self.createdAt = createdAt
        self.modifiedAt = modifiedAt
        self.connection = DatabaseFactory().getConnection()

    def create(self):
        try:
            with self.connection.cursor() as cursor:
                sql = "INSERT INTO authors(cpf, name, isStudent, createdAt, modifiedAt) VALUES (%s, %s, %s, %s, %s)"
                cursor.execute(sql, (self.cpf, self.name, self.isStudent,
                                     self.createdAt, self.modifiedAt))
                self.connection.commit()

                return True
        except Exception as e:
            print(e)
            return False
        finally:
            self.connection.close()

    def getAllAuthors(self):
        try:
            with self.connection.cursor() as cursor:
                sql = "SELECT  *  FROM  authors"
                cursor.execute(sql)
                result = cursor.fetchall()

                return result
        except Exception as e:
            print(e)
            return None
        finally:
            self.connection.close()
Exemplo n.º 8
0
class Paper():
    def __init__(self, title="", abstract="", author="", category="", subcategory="", isExposed="", isPresented="", createdAt="", modifiedAt=""):
        self.title = title
        self.abstract = abstract
        self.author = author
        self.category = category
        self.subcategory = subcategory
        self.isExposed = isExposed
        self.isPresented = isPresented
        self.createdAt = createdAt
        self.modifiedAt = modifiedAt
        self.connection = DatabaseFactory().getConnection()

    def create(self):
        try:
          with self.connection.cursor() as cursor:
            sql = "INSERT INTO papers(event, title, abstract, author, category, subcategory, isExposed, isPresented, createdAt, modifiedAt) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)"
            cursor.execute(sql, (1, self.title, self.abstract, self.author, self.category, self.subcategory, self.isExposed, self.isPresented, self.createdAt, self.modifiedAt))
            self.connection.commit()

            return True
        except Exception as e:
            print(e)
            return False
        finally:
          self.connection.close()



    def getAllPapers(self):
        try:
          with self.connection.cursor() as cursor:
            sql = "SELECT  *  FROM  papers"
            cursor.execute(sql)
            result = cursor.fetchall()

            return result
        except Exception as e:
            print(e)
            return None
        finally:
          self.connection.close()
Exemplo n.º 9
0
 def __init__(self):
     self.connection = DatabaseFactory().getConnection()
Exemplo n.º 10
0
 def __init__(self, name="", description=""):
     self.name = name
     self.description = description
     self.connection = DatabaseFactory().getConnection()