Use ORM for applicants
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from .DbManager import DbManager
|
||||
import json
|
||||
import mariadb
|
||||
from PySide6.QtCore import QObject, Signal
|
||||
from lib.domain.BaseModel import database
|
||||
|
||||
|
||||
class BusinessDAO(QObject):
|
||||
@@ -12,11 +12,11 @@ class BusinessDAO(QObject):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.__con = DbManager().getConnection()
|
||||
self.__con = database.connection()
|
||||
if self.__con:
|
||||
self.__cur = self.__con.cursor()
|
||||
|
||||
def getBusiness(self, enc_key, criterion = "Alle"):
|
||||
def getBusiness(self, enc_key, criterion="Alle"):
|
||||
try:
|
||||
if self.__cur:
|
||||
self.__cur.callproc("getCustomerView", (enc_key, criterion,))
|
||||
@@ -27,14 +27,14 @@ class BusinessDAO(QObject):
|
||||
except mariadb.Error as e:
|
||||
print(str(e))
|
||||
|
||||
def getOneBusiness(self, business_id, enc_key = None):
|
||||
def getOneBusiness(self, business_id, enc_key=None):
|
||||
try:
|
||||
if self.__cur:
|
||||
self.__cur.callproc("getCustomer", (business_id, enc_key,))
|
||||
#self.__all_cols = [desc[0] for desc in self.__cur.description]
|
||||
return self.__cur.fetchall() #, self.__all_cols
|
||||
# self.__all_cols = [desc[0] for desc in self.__cur.description]
|
||||
return self.__cur.fetchall() # , self.__all_cols
|
||||
else:
|
||||
return None #, None
|
||||
return None # , None
|
||||
except mariadb.Error as e:
|
||||
print(str(e))
|
||||
|
||||
@@ -47,10 +47,3 @@ class BusinessDAO(QObject):
|
||||
|
||||
except mariadb.Error as e:
|
||||
print(str(e))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user