Fixing qml connection to save business with a new contact - some

database modifications
This commit is contained in:
2024-12-14 15:32:10 +01:00
parent 59e5fadd26
commit 559ad1b882
7 changed files with 54 additions and 22 deletions

View File

@@ -1,15 +1,18 @@
from .DbManager import DbManager
import json
import mariadb
from PySide6.QtCore import QObject, Signal
class BusinessDAO:
class BusinessDAO(QObject):
newBusinessAdded = Signal()
def __init__(self):
super().__init__()
self.__con = DbManager().getConnection()
self.__cur = self.__con.cursor()
def getBusiness(self, criterion = "Alle"):
self.__cur.callproc("getCustomerView", (criterion,))
def getBusiness(self, enc_key, criterion = "Alle"):
self.__cur.callproc("getCustomerView", (enc_key, criterion,))
self.__all_cols = [desc[0] for desc in self.__cur.description]
return self.__cur.fetchall(), self.__all_cols
@@ -17,6 +20,7 @@ class BusinessDAO:
try:
self.__cur.callproc("addBusiness", (json.dumps(data), contact_id))
self.__con.commit()
self.newBusinessAdded.emit()
except mariadb.Error as e:
print(str(e))