def check_existence_of_new_location_and_add_it(self, data_location):

        #DB CONNECTION
        db = MyDB()
        location_text = str(self.new_location_box.text)
        location_id = self.ent_jur_button.id_object
        location_exist = db.check_existence_of_new_location_and_add_it_db(data_location,location_text,location_id)

        self.new_location_box.text = ""
        self.location_listbox.location_listview.adapter.data = self.location_listbox.get_location_list()
    def check_existence_of_new_service_and_add_it(self, data_service):

        # DB CONNECTION
        db = MyDB()
        service_text = self.new_service_box.text
        location_id = self.location_button.id_object
        service_exist = db.check_existence_of_new_service_and_add_it_db(data_service, service_text, location_id)

        self.new_service_box.text = ""
        self.service_listbox.service_listview.adapter.data = self.service_listbox.get_service_list()
    def get_ent_jur_list(self):
        
        #DB CONNECTION
        db = MyDB()
        #Execute la requete SQL
        get_all_legal_entities_query = "SELECT *FROM EntiteJuridique;"

        try:
            db.query(get_all_legal_entities_query,[])
            db.commit()
        except:
            db.rollback()
        #On obtient une matrice
        legal_entities_data = db.db_fetchall()

        # Liste d'entite Juridique
        data_ent_jur = ListEntJur(legal_entities_data)
        
        return data_ent_jur
Exemple #4
0
    def check_login(self, *args):
        user_login = self.login_box.text
        user_password = self.password_box.text


        # DB CONNECTION
        db = MyDB()

        login_query = "SELECT * FROM utilisateur WHERE login =%s AND password = %s"

        parameters_query =[user_login,user_password]

        try:
            db.query(login_query,parameters_query)
            db.commit()
        except:
            db.rollback()

        login_data = db.db_fetchall()

        if login_data:

            user_logged = User(user_login)
            self.dispatch('on_right_id')


        else:
            self.login_box.focus = True
            self.remove_widget(self.pan_screen)
            self.error_box.text = "Wrong credentials"
            # create an animation object. This object could be stored
            # and reused each call or reused across different widgets.
            # += is a sequential step, while &= is in parallel
            animation = Animation(x=(0), t='out_bounce')

            # apply the animation on the button, passed in the "instance" argument
            # Notice that default 'click' animation (changing the button
            # color while the mouse is down) is unchanged.
            animation.start(self.login_area)
    def get_module_available(self):

                ###################Looking into Module#####################

        #DB CONNECTION

        db = MyDB()

        modules_query = """SELECT m.intitule, o.intitule
                        FROM module AS m , outil AS o, utilisateur AS u, utilisateuroutil AS uo
                        WHERE u.login =%s AND uo.idUtilisateur = u.idUtilisateur
                        AND uo.idOutil = o.idOutil AND o.idModule = m.idModule"""

        user_logged = User()
        parameters_query =[user_logged.login]
        try:
            db.query(modules_query,parameters_query)
            db.commit()
        except:
            db.rollback()
            
        modules_data = db.db_fetchall()

        return modules_data
 def get_object_list(self):
     db = MyDB()
     data_ent_jur = db.get_all_ent_jur()
     return data_ent_jur
    def get_location_list(self):

        #DB CONNECTION
        db = MyDB()
        data_location = db.get_location_list_db()
        return data_location
    def get_service_list(self):

        # DB CONNECTION
        db = MyDB()
        data_service = db.get_service_list_db()
        return data_service