def delete(id):

        try:

            con = open_connection()
            cur = con.cursor(buffered=True)

            sql = '''
                DELETE FROM demande WHERE _id = %s
            '''

            cur.execute(sql, [id])
            con.commit()

        except Exception as e:
            print('Error: ', e)
        finally:
            close_connection(con, cur)
    def afficher_tous():

        try:

            con = open_connection()
            cur = con.cursor(buffered=True)

            sql = '''
             SELECT demande._id, utilisateur.nom,utilisateur.prenom ,offre_emploi.poste,demande.date_creation FROM `demande`,`candidat`,`utilisateur`,`offre_emploi` WHERE candidat._id = demande._id_candidat AND demande._id_offre_emploi=offre_emploi._id AND utilisateur._id=candidat._id_utilisateur '''

            cur.execute(sql)

            demande_emploi = cur.fetchall()
            return demande_emploi

        except Exception as e:
            print('Error: ', e)
        finally:
            close_connection(con, cur)
    def afficher_tous():

        try:

            con = open_connection()
            cur = con.cursor(buffered=True)

            sql = '''
                SELECT * FROM offre_emploi ORDER BY date_creation DESC
            '''

            cur.execute(sql)

            offre_emploi = cur.fetchall()
            return offre_emploi

        except Exception as e:
            print('Error: ', e)
        finally:
            close_connection(con, cur)
    def new(poste, type_contrat, date_fin_offre, salaire,
            niveau_d_etude, experiences, description_poste, exigences, avantages):

        try:

            con = open_connection()
            cur = con.cursor(buffered=True)

            sql = '''
                INSERT INTO demande(poste, utilisateur_id,offre_emploi_id, niveau_d_etude, experiences, description, formations,competences) 
                VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s)
            '''

            cur.execute(sql, [poste, _id_utilisateur,_id_offre_emploi, niveau_d_etude, experiences, description, formations,competences])

            con.commit()

        except Exception as e:
            print('Error: ', e)
        finally:
            close_connection(con, cur)
Beispiel #5
0
    def create(nom, prenom, adresse, tel, email, mot_de_passe, role):

        try:

            con = open_connection()
            cur = con.cursor()

            id_utilisateur = Utilisateur.create(nom, prenom, adresse, tel, email, mot_de_passe, role)
            
            sql = '''
                    INSERT INTO recruteur(_id_utilisateur)
                    VALUES(%s)
                    '''

            cur.execute(sql, [id_utilisateur])

            con.commit()

        except Exception as e:
            print(e)
        finally:
            close_connection(con, cur)
Beispiel #6
0
    def authentification(email, mot_d_passe):

        try:

            con = open_connection()
            cur = con.cursor(buffered=True)

            sql = '''
                SELECT * FROM utilisateur WHERE email = %s AND mot_de_passe = %s
            '''

            cur.execute(sql, [email, mot_d_passe])

            if cur.rowcount > 0:
                utilisateur = cur.fetchone()
                return utilisateur

            return None

        except Exception as e:
            print('Error: ', e)
        finally:
            close_connection(con, cur)
Beispiel #7
0
    def create(nom, prenom, adresse, tel, email, mot_de_passe, role):

        try:

   
            con = open_connection()
            cur = con.cursor(buffered=True)

            sql = '''
                    INSERT INTO utilisateur(nom, prenom, adresse, tel, email, mot_de_passe, role)
                    VALUES(%s, %s, %s, %s, %s, %s, %s)
                    
                    '''

            cur.execute(sql, [nom, prenom, adresse, tel, email, mot_de_passe, role])

            con.commit()

           

        except Exception as e:
            print(e)
        finally:
            close_connection(con, cur)
Beispiel #8
0
from config import open_connection, close_connection
from models.recruteur import Recruteur

con = open_connection()
cur = con.cursor()

# drop tables
# drop_tables = [
#     ''' DROP TABLE IF EXISTS demande ''',
#     ''' DROP TABLE IF EXISTS experiences''',
#     ''' DROP TABLE IF EXISTS formations''',
#     ''' DROP TABLE IF EXISTS competances''',
#     ''' DROP TABLE IF EXISTS stagiaire ''',
#     ''' DROP TABLE IF not EXISTS offre_emploi ''',
#     ''' DROP TABLE IF EXISTS candidat ''',
#     ''' DROP TABLE IF EXISTS recruteur ''',
#     ''' DROP TABLE IF EXISTS utilisateur ''']

# for drop in drop_tables:
#     cur.execute(drop)
#     con.commit()

# create tables
create_tables = [
    ''' CREATE TABLE offre_emploi(
        _id SERIAL PRIMARY KEY,
        poste VARCHAR(255),
        type_contrat VARCHAR(255),
        date_creation TIMESTAMP,
        date_fin_offre DATE,
        salaire VARCHAR(50),