Exemplo n.º 1
0
    def load_employee_size(self, identifier: int):
        dbsession = None
        try:
            dbsession = DBConnection().getsession()
            employee_size: COEmployee = dbsession.query(COEmployee).get(identifier)

            if employee_size is None:
                message = COMLEmployee.MSG_EMPLOYEE_VALUE_NOT_FOUND + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    identifier)
                self.get_logger().error(message)
                raise CFException(ValueError(message), message, status_code=CFException.HTTP_404_NOT_FOUND)

            self.get_logger().info(
                COMLEmployee.MSG_EMPLOYEE_VALUE_LOAD_SUCCESS + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    employee_size.identifier))

        except CFException:
            raise
        except Exception:
            message = COMLEmployee.MSG_EMPLOYEE_VALUE_LOAD_FAILED + COStringLiteral.STR_SEPARATOR_PIPE + str(
                identifier)
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
        return employee_size
Exemplo n.º 2
0
    def update_job_level(self, job_level: COJobLevel):
        dbsession = None
        try:

            if not isinstance(job_level, COJobLevel):
                message = COMLJobLevel.MSG_JOB_LEVEL_NOT_VALID + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    job_level.identifier)
                self.get_logger().error(message)
                raise CFException(ValueError(message),
                                  message,
                                  status_code=CFException.HTTP_400_BAD_REQUEST)

            dbsession = DBConnection().getsession()
            db_job_level: COJobLevel = dbsession.query(COJobLevel).get(
                job_level.identifier)
            db_job_level.identifier = job_level.identifier
            db_job_level.name = job_level.name

            dbsession.commit()

            self.get_logger().info(COMLJobLevel.MSG_JOB_LEVEL_UPDATE_SUCCESS +
                                   COStringLiteral.STR_SEPARATOR_PIPE +
                                   str(job_level.identifier))

        except CFException:
            dbsession.rollback()
            raise
        except Exception:
            dbsession.rollback()
            message = COMLJobLevel.MSG_JOB_LEVEL_UPDATE_FAILED + COStringLiteral.STR_SEPARATOR_PIPE + str(
                job_level.identifier)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
Exemplo n.º 3
0
    def load_all(self):
        dbsession = None
        employee_size = dict()
        try:
            dbsession = DBConnection().getsession()
            employee_size_list = dbsession.query(COEmployee).all()

            if employee_size_list is None:
                message = COMLEmployee.MSG_EMPLOYEE_VALUES_NOT_FOUND
                self.get_logger().error(message)
                raise CFException(ValueError(message), message, status_code=CFException.HTTP_404_NOT_FOUND)

            for ct in employee_size_list:
                employee_size[ct.get_key()] = ct

            self.get_logger().info(COMLEmployee.MSG_EMPLOYEE_VALUES_LOAD_SUCCESS)

        except CFException:
            raise
        except Exception:
            message = COMLEmployee.MSG_EMPLOYEE_VALUES_LOAD_FAILED
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
        return employee_size
Exemplo n.º 4
0
    def load_industry(self, identifier: int):
        dbsession = None
        try:
            dbsession = DBConnection().getsession()
            industry: COIndustry = dbsession.query(COIndustry).get(identifier)

            if industry is None:
                message = COMLIndustry.MSG_INDUSTRY_NOT_FOUND + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    identifier)
                self.get_logger().error(message)
                raise CFException(ValueError(message), message, status_code=CFException.HTTP_404_NOT_FOUND)

            self.get_logger().info(
                COMLIndustry.MSG_INDUSTRY_LOAD_SUCCESS + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    industry.identifier))

        except CFException:
            raise
        except Exception:
            message = COMLIndustry.MSG_INDUSTRY_LOAD_FAILED + COStringLiteral.STR_SEPARATOR_PIPE + str(
                identifier)
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
        return industry
Exemplo n.º 5
0
    def update_employee_size(self, employee_size: COEmployee):
        dbsession = None
        try:

            if not isinstance(employee_size, COEmployee):
                message = COMLEmployee.MSG_EMPLOYEE_VALUE_NOT_VALID + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    employee_size.identifier)
                self.get_logger().error(message)
                raise CFException(ValueError(message), message, status_code=CFException.HTTP_400_BAD_REQUEST)

            dbsession = DBConnection().getsession()
            db_employee_size: COEmployee = dbsession.query(COEmployee).get(employee_size.identifier)
            db_employee_size.identifier = employee_size.identifier
            db_employee_size.name = employee_size.name

            dbsession.commit()

            self.get_logger().info(
                COMLEmployee.MSG_EMPLOYEE_VALUE_UPDATE_SUCCESS + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    employee_size.identifier))

        except CFException:
            dbsession.rollback()
            raise
        except Exception:
            dbsession.rollback()
            message = COMLEmployee.MSG_EMPLOYEE_VALUE_UPDATE_FAILED + COStringLiteral.STR_SEPARATOR_PIPE + str(
                employee_size.identifier)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
Exemplo n.º 6
0
    def update_revenue_range(self, revenue_range: CORevenue):
        dbsession = None
        try:

            if not isinstance(revenue_range, CORevenue):
                message = COMLRevenue.MSG_REVENUE_RANGE_NOT_VALID + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    revenue_range.identifier)
                self.get_logger().error(message)
                raise CFException(ValueError(message),
                                  message,
                                  status_code=CFException.HTTP_400_BAD_REQUEST)

            dbsession = DBConnection().getsession()
            db_revenue_range: CORevenue = dbsession.query(CORevenue).get(
                revenue_range.identifier)
            db_revenue_range.identifier = revenue_range.identifier
            db_revenue_range.name = revenue_range.name

            dbsession.commit()

            self.get_logger().info(
                COMLRevenue.MSG_REVENUE_RANGE_UPDATE_SUCCESS +
                COStringLiteral.STR_SEPARATOR_PIPE +
                str(revenue_range.identifier))

        except CFException:
            dbsession.rollback()
            raise
        except Exception:
            dbsession.rollback()
            message = COMLRevenue.MSG_REVENUE_RANGE_UPDATE_FAILED + COStringLiteral.STR_SEPARATOR_PIPE + str(
                revenue_range.identifier)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
Exemplo n.º 7
0
    def load_job_level(self, identifier: int):
        dbsession = None
        try:
            dbsession = DBConnection().getsession()
            job_level: COJobLevel = dbsession.query(COJobLevel).get(identifier)

            if job_level is None:
                message = COMLJobLevel.MSG_JOB_LEVEL_NOT_FOUND + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    identifier)
                self.get_logger().error(message)
                raise CFException(ValueError(message),
                                  message,
                                  status_code=CFException.HTTP_404_NOT_FOUND)

            self.get_logger().info(COMLJobLevel.MSG_JOB_LEVEL_LOAD_SUCCESS +
                                   COStringLiteral.STR_SEPARATOR_PIPE +
                                   str(job_level.identifier))

        except CFException:
            raise
        except Exception:
            message = COMLJobLevel.MSG_JOB_LEVEL_LOAD_FAILED + COStringLiteral.STR_SEPARATOR_PIPE + str(
                identifier)
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
        return job_level
Exemplo n.º 8
0
    def load_all(self):
        dbsession = None
        industry_dict = dict()
        try:
            dbsession = DBConnection().getsession()

            industry_list = dbsession.query(COIndustry).all()

            if industry_list is None:
                message = COMLIndustry.MSG_INDUSTRIES_NOT_FOUND
                self.get_logger().error(message)
                raise CFException(ValueError(message), message, status_code=CFException.HTTP_404_NOT_FOUND)

            try:
                for ct in industry_list:
                    for cts in ct:
                        industry_dict[cts.get_key()] = cts
            except TypeError:
                for ct in industry_list:
                    industry_dict[ct.get_key()] = ct

            self.get_logger().info(COMLIndustry.MSG_INDUSTRIES_LOAD_SUCCESS)

        except CFException:
            raise
        except Exception:
            message = COMLIndustry.MSG_INDUSTRIES_LOAD_FAILED
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
        return industry_dict
Exemplo n.º 9
0
    def update_industry(self, industry: COIndustry):
        dbsession = None
        try:

            if not isinstance(industry, COIndustry):
                message = COMLIndustry.MSG_INDUSTRY_NOT_VALID + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    industry.identifier)
                self.get_logger().error(message)
                raise CFException(ValueError(message), message, status_code=CFException.HTTP_400_BAD_REQUEST)

            dbsession = DBConnection().getsession()
            db_industry: COIndustry = dbsession.query(COIndustry).get(industry.identifier)
            db_industry.identifier = industry.identifier
            db_industry.name = industry.name

            dbsession.commit()

            self.get_logger().info(
                COMLIndustry.MSG_INDUSTRY_UPDATE_SUCCESS + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    industry.identifier))

        except CFException:
            dbsession.rollback()
            raise
        except Exception:
            dbsession.rollback()
            message = COMLIndustry.MSG_INDUSTRY_UPDATE_FAILED + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    industry.identifier)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
Exemplo n.º 10
0
    def login_user(self, mail: str, password: str):
        dbsession = None
        byonic_users = dict()
        try:
            dbsession = DBConnection().getsession()
            password = hashlib.sha512(password.encode("utf-8")).hexdigest()
            byonic_user_list = dbsession.query(COByonicUser).filter(COByonicUser.col_mail
                                                                    == mail). \
                filter(COByonicUser.col_password == password).all()

            if byonic_user_list is None:
                message = COMLByonicUser.MSG_BYONIC_USERS_NOT_FOUND
                self.get_logger().error(message)
                raise CFException(ValueError(message), message, status_code=CFException.HTTP_404_NOT_FOUND)

            for ct in byonic_user_list:
                byonic_users[ct.get_key()] = ct

            self.get_logger().info(COMLByonicUser.MSG_BYONIC_USERS_LOAD_SUCCESS)

        except CFException:
            raise
        except Exception:
            message = COMLByonicUser.MSG_BYONIC_USERS_LOAD_FAILED
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
        return byonic_users
Exemplo n.º 11
0
    def filter_user(self, org_id: int):
        dbsession = None
        global user_list
        byonic_users = dict()
        try:
            dbsession = DBConnection().getsession()
            byonic_user_list = dbsession.query(COByonicUser)
            print(type(org_id))
            if org_id == str(1):
                byonic_user_list = byonic_user_list

            else:
                byonic_user_list = byonic_user_list.filter(COByonicUser.col_org_id == org_id)

            byonic_user_list = byonic_user_list.all()

            if byonic_user_list is None:
                message = COMLByonicUser.MSG_BYONIC_USERS_NOT_FOUND
                self.get_logger().error(message)
                raise CFException(ValueError(message), message, status_code=CFException.HTTP_404_NOT_FOUND)
            print(byonic_user_list)
            for ct in byonic_user_list:
                byonic_users[ct.get_key()] = ct

            self.get_logger().info(COMLByonicUser.MSG_BYONIC_USERS_LOAD_SUCCESS)

        except CFException:
            raise
        except Exception:
            message = COMLByonicUser.MSG_BYONIC_USERS_LOAD_FAILED
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
        return byonic_users
Exemplo n.º 12
0
    def load_byonic_user(self, identifier: int):
        dbsession = None
        try:
            dbsession = DBConnection().getsession()
            byonic_user: COByonicUser = dbsession.query(COByonicUser).get(identifier)

            if byonic_user is None:
                message = COMLByonicUser.MSG_BYONIC_USER_NOT_FOUND + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    identifier)
                self.get_logger().error(message)
                raise CFException(ValueError(message), message, status_code=CFException.HTTP_404_NOT_FOUND)

            self.get_logger().info(
                COMLByonicUser.MSG_BYONIC_USER_LOAD_SUCCESS + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    byonic_user.identifier))

        except CFException:
            raise
        except Exception:
            message = COMLByonicUser.MSG_BYONIC_USER_LOAD_FAILED + COStringLiteral.STR_SEPARATOR_PIPE + str(
                identifier)
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
        return byonic_user
Exemplo n.º 13
0
    def load_all(self):
        dbsession = None
        byonic_users = dict()
        try:
            dbsession = DBConnection().getsession()
            byonic_user_list = dbsession.query(COByonicUser).all()
            if byonic_user_list is None:
                message = COMLByonicUser.MSG_BYONIC_USERS_NOT_FOUND
                self.get_logger().error(message)
                raise CFException(ValueError(message), message, status_code=CFException.HTTP_404_NOT_FOUND)

            for ct in byonic_user_list:
                byonic_users[ct.get_key()] = ct

            self.get_logger().info(COMLByonicUser.MSG_BYONIC_USERS_LOAD_SUCCESS)

        except CFException:
            raise
        except Exception:
            message = COMLByonicUser.MSG_BYONIC_USERS_LOAD_FAILED
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
        return byonic_users
Exemplo n.º 14
0
    def load_all(self):
        dbsession = None
        job_level = dict()
        try:
            dbsession = DBConnection().getsession()
            job_level_list = dbsession.query(COJobLevel).all()

            if job_level_list is None:
                message = COMLJobLevel.MSG_JOB_LEVELS_NOT_FOUND
                self.get_logger().error(message)
                raise CFException(ValueError(message),
                                  message,
                                  status_code=CFException.HTTP_404_NOT_FOUND)

            for ct in job_level_list:
                job_level[ct.get_key()] = ct

            self.get_logger().info(COMLJobLevel.MSG_JOB_LEVELS_LOAD_SUCCESS)

        except CFException:
            raise
        except Exception:
            message = COMLJobLevel.MSG_JOB_LEVELS_LOAD_FAILED
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
        return job_level
Exemplo n.º 15
0
    def load_revenue_range(self, identifier: int):
        dbsession = None
        try:
            dbsession = DBConnection().getsession()
            revenue_range: CORevenue = dbsession.query(CORevenue).get(
                identifier)

            if revenue_range is None:
                message = COMLRevenue.MSG_REVENUE_RANGE_NOT_FOUND + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    identifier)
                self.get_logger().error(message)
                raise CFException(ValueError(message),
                                  message,
                                  status_code=CFException.HTTP_404_NOT_FOUND)

            self.get_logger().info(COMLRevenue.MSG_REVENUE_RANGE_LOAD_SUCCESS +
                                   COStringLiteral.STR_SEPARATOR_PIPE +
                                   str(revenue_range.identifier))

        except CFException:
            raise
        except Exception:
            message = COMLRevenue.MSG_REVENUE_RANGE_LOAD_FAILED + COStringLiteral.STR_SEPARATOR_PIPE + str(
                identifier)
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
        return revenue_range
Exemplo n.º 16
0
    def load_all(self):
        dbsession = None
        revenue_range_dict = dict()
        try:
            dbsession = DBConnection().getsession()

            revenue_range_list = dbsession.query(CORevenue).all()

            if revenue_range_list is None:
                message = COMLRevenue.MSG_REVENUE_RANGES_NOT_FOUND
                self.get_logger().error(message)
                raise CFException(ValueError(message),
                                  message,
                                  status_code=CFException.HTTP_404_NOT_FOUND)

            try:
                for ct in revenue_range_list:
                    for cts in ct:
                        revenue_range_dict[cts.get_key()] = cts

            except TypeError:
                for ct in revenue_range_list:
                    revenue_range_dict[ct.get_key()] = ct

            self.get_logger().info(COMLRevenue.MSG_REVENUE_RANGES_LOAD_SUCCESS)

        except CFException:
            raise
        except Exception:
            message = COMLRevenue.MSG_REVENUE_RANGES_LOAD_FAILED
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
        return revenue_range_dict
Exemplo n.º 17
0
 def load_all_domain(self):
     Dictionary = dict()
     dataAccess = DBConnection().getsession()
     db_query = dataAccess.query(CODomain_filter)
     if self.req_topic is not None:
         if len(self.req_topic) != 0:
             db_query = db_query.filter(CODomain_filter.col_topic_name.in_(self.req_topic))
     if self.req_country is not None:
         if len(self.req_country) != 0:
             db_query = db_query.filter(CODomain_filter.col_country_name.in_(self.req_country))
     if self.req_employee is not None:
         if len(self.req_employee) != 0:
             db_query = db_query.filter(CODomain_filter.col_employee_size.in_(self.req_employee))
     # if self.req_job is not None:
     #     if len(self.req_job) != 0:
     #         db_query = db_query.filter(CODomain_filter.col_employee_size.in_(self.req_job))
     if self.req_industry is not None:
         if len(self.req_industry) != 0:
             db_query = db_query.filter(CODomain_filter.col_industry_name.in_(self.req_industry))
     if self.req_revenue is not None:
         if len(self.req_revenue) != 0:
             db_query = db_query.filter(CODomain_filter.col_revenue_range.in_(self.req_revenue))
     if self.req_intentgrade is not None:
         if len(self.req_intentgrade) != 0:
             db_query = db_query.filter(CODomain_filter.col_composite_score >= self.req_intentgrade[0]).\
                 filter(CODomain_filter.col_composite_score <= self.req_intentgrade[1])
     # if self.req_domain is not None:
     #     if len(self.req_domain) != 0:
     #         db_query = db_query.filter(CODomain_filter.col_domain_name.notin_(self.req_domain))
     if self.req_domainEx is not None:
         if len(self.req_domainEx) != 0:
             db_query = db_query.filter(CODomain_filter.col_domain_name.notin_(self.req_domainEx))
     if self.req_domainIn is not None:
         if len(self.req_domainIn) != 0:
             db_query = db_query.filter(CODomain_filter.col_domain_name.in_(self.req_domainIn))
     db_query = db_query.order_by(CODomain_filter.col_surge_score.desc())
     # db_query = db_query.limit(10000).all()
     try:
         for ct in db_query:
             Dictionary[ct.get_key()] = ct
         domains = [Dictionary[domain_key].serialize for domain_key in Dictionary]
         print(domains)
         return {'Domains': domains}
     except:
         print('not working')
Exemplo n.º 18
0
    def update_byonic_user(self, byonic_user: COByonicUser):
        dbsession = None
        try:

            if not isinstance(byonic_user, COByonicUser):
                message = COMLByonicUser.MSG_BYONIC_USER_NOT_VALID + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    byonic_user.identifier)
                self.get_logger().error(message)
                raise CFException(ValueError(message), message, status_code=CFException.HTTP_400_BAD_REQUEST)

            dbsession = DBConnection().getsession()
            db_byonic_user: COByonicUser = dbsession.query(COByonicUser).get(byonic_user.identifier)
            db_byonic_user.identifier = byonic_user.identifier
            db_byonic_user.reset = byonic_user.reset
            db_byonic_user.user_first_name = byonic_user.user_first_name
            db_byonic_user.user_last_name = byonic_user.user_last_name
            db_byonic_user.email = byonic_user.email
            db_byonic_user.password = hashlib.sha512(byonic_user.password.encode("utf-8")).hexdigest()
            db_byonic_user.organisation_id = byonic_user.organisation_id
            db_byonic_user.role_id = byonic_user.role_id
            db_byonic_user.status = byonic_user.status

            dbsession.commit()

            self.get_logger().info(
                COMLByonicUser.MSG_BYONIC_USER_UPDATE_SUCCESS + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    byonic_user.identifier))

        except CFException:
            dbsession.rollback()
            raise
        except Exception:
            dbsession.rollback()
            message = COMLByonicUser.MSG_BYONIC_USER_UPDATE_FAILED + COStringLiteral.STR_SEPARATOR_PIPE + str(
                byonic_user.identifier)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
Exemplo n.º 19
0
    def delete_byonic_user(self, identifier: int):
        dbsession = None
        try:
            dbsession = DBConnection().getsession()
            db_byonic_user: COByonicUser = dbsession.query(COByonicUser).get(identifier)
            dbsession.delete(db_byonic_user)
            dbsession.commit()

            self.get_logger().info(
                COMLByonicUser.MSG_BYONIC_USER_DELETE_SUCCESS + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    identifier))

        except CFException:
            dbsession.rollback()
            raise
        except Exception:
            dbsession.rollback()
            message = COMLByonicUser.MSG_BYONIC_USER_DELETE_FAILED + COStringLiteral.STR_SEPARATOR_PIPE + str(
                identifier)
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
Exemplo n.º 20
0
    def delete_industry(self, identifier: int):
        dbsession = None
        try:
            dbsession = DBConnection().getsession()
            db_industry: COIndustry = dbsession.query(COIndustry).get(identifier)
            dbsession.delete(db_industry)
            dbsession.commit()

            self.get_logger().info(
                COMLIndustry.MSG_INDUSTRY_DELETE_SUCCESS + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    identifier))

        except CFException:
            dbsession.rollback()
            raise
        except Exception:
            dbsession.rollback()
            message = COMLIndustry.MSG_INDUSTRY_DELETE_FAILED + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    identifier)
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
Exemplo n.º 21
0
    def delete_employee_size(self, identifier: int):
        dbsession = None
        try:
            dbsession = DBConnection().getsession()
            db_employee_size: COEmployee = dbsession.query(COEmployee).get(identifier)
            dbsession.delete(db_employee_size)
            dbsession.commit()

            self.get_logger().info(
                COMLEmployee.MSG_EMPLOYEE_VALUE_DELETE_SUCCESS + COStringLiteral.STR_SEPARATOR_PIPE + str(
                    identifier))

        except CFException:
            dbsession.rollback()
            raise
        except Exception:
            dbsession.rollback()
            message = COMLEmployee.MSG_EMPLOYEE_VALUE_DELETE_FAILED + COStringLiteral.STR_SEPARATOR_PIPE + str(
                identifier)
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
Exemplo n.º 22
0
    def delete_revenue_range(self, identifier: int):
        dbsession = None
        try:
            dbsession = DBConnection().getsession()
            db_revenue_range: CORevenue = dbsession.query(CORevenue).get(
                identifier)
            dbsession.delete(db_revenue_range)
            dbsession.commit()

            self.get_logger().info(
                COMLRevenue.MSG_REVENUE_RANGE_DELETE_SUCCESS +
                COStringLiteral.STR_SEPARATOR_PIPE + str(identifier))

        except CFException:
            dbsession.rollback()
            raise
        except Exception:
            dbsession.rollback()
            message = COMLRevenue.MSG_REVENUE_RANGE_DELETE_FAILED + COStringLiteral.STR_SEPARATOR_PIPE + str(
                identifier)
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
Exemplo n.º 23
0
    def load_all_user():
        data = DBConnection().getsession()
        user = data.query(COUser.col_user_id, COUser.col_user_first_name,
                          COUser.col_user_last_name, COUser.col_user_email,
                          COUser.col_user_password,
                          COUser.col_user_organisation_id,
                          COUser.col_user_role_id, COUser.col_Status,
                          COUser.col_reset, COUser.col_last_login).all()

        values = [
            'id', 'firstname', 'lastname', 'email_addr', 'password', 'org_id',
            'role_id', 'Status', 'reset', 'last_login'
        ]
        dictionary = []
        for i in range(len(user)):
            files = dict(zip(values, user[i]))
            dictionary.append(files)
        print(dictionary)

        def edit_user():
            pass

        def delete_user():
            pass
Exemplo n.º 24
0
    def delete_job_level(self, identifier: int):
        dbsession = None
        try:
            dbsession = DBConnection().getsession()
            db_job_level: COJobLevel = dbsession.query(COJobLevel).get(
                identifier)
            dbsession.delete(db_job_level)
            dbsession.commit()

            self.get_logger().info(COMLJobLevel.MSG_JOB_LEVEL_DELETE_SUCCESS +
                                   COStringLiteral.STR_SEPARATOR_PIPE +
                                   str(identifier))

        except CFException:
            dbsession.rollback()
            raise
        except Exception:
            dbsession.rollback()
            message = COMLJobLevel.MSG_JOB_LEVEL_DELETE_FAILED + COStringLiteral.STR_SEPARATOR_PIPE + str(
                identifier)
            self.get_logger().error(message)
            raise CFException(Exception(message), message)
        finally:
            dbsession.close()
Exemplo n.º 25
0
 def load_all_user_roles():
     data = DBConnection().getsession()
     user_roles = data.query(COUserRoles.col_user_role).all()
     print(user_roles)