Oscar jinxed

This commit is contained in:
2024-12-11 15:08:16 +01:00
parent 7c61b2a532
commit 9a8be0409a
6 changed files with 55 additions and 9 deletions

View File

@@ -23,6 +23,7 @@ GridLayout
id: title id: title
Layout.fillWidth: true Layout.fillWidth: true
editable: false editable: false
model: ["Herr", "Frau"]
} }
Label Label
{ {
@@ -82,6 +83,18 @@ GridLayout
id: telephonecontact id: telephonecontact
Layout.fillWidth: true Layout.fillWidth: true
} }
Label
{
text: qsTr("Handy")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
TextField
{
property string name: "cellphone"
id: cellphone
Layout.fillWidth: true
}
Label Label
{ {
text: qsTr("Geburtsdatum") text: qsTr("Geburtsdatum")
@@ -105,6 +118,7 @@ GridLayout
id: rank id: rank
Layout.fillWidth: true Layout.fillWidth: true
editable: false editable: false
model: ["Nein", "Ja"]
} }
Label Label
{ {

View File

@@ -131,6 +131,18 @@ ColumnLayout
Layout.fillWidth: true Layout.fillWidth: true
} }
Label
{
text: qsTr("Handy")
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
}
TextField
{
property string name: "cellphone"
id: cellphone
Layout.fillWidth: true
}
Label Label
{ {
text: qsTr("E-Mail") text: qsTr("E-Mail")
@@ -241,8 +253,8 @@ ColumnLayout
if (!checkAddContact.checked) if (!checkAddContact.checked)
{ {
new_business = JsLib.addBusiness(businessGrid) new_business = JsLib.addBusiness(businessGrid)
bm.addBusiness(new_business) business_model.addBusiness(new_business)
appLoader.source = "CustomerTables.qml" appLoader.source = "CustomerTable.qml"
} }
else else
{ {
@@ -252,9 +264,9 @@ ColumnLayout
var new_contact = JsLib.addBusiness(addContactLayout) var new_contact = JsLib.addBusiness(addContactLayout)
// bm.setContact(new_contact, contact_id) // bm.setContact(new_contact, contact_id)
// bm.addBusiness(new_business, contact_id) // bm.addBusiness(new_business, contact_id)
contact_model.getContacts() contact_id = contact_model.addContact(new_contact)
console.log(contact_id)
appLoader.source = "CustomerTables.qml" appLoader.source = "CustomerTable.qml"
} }
} }

View File

@@ -7,6 +7,6 @@ class BTypeDAO:
self.__cur = self.__con.cursor() self.__cur = self.__con.cursor()
def getBType(self): def getBType(self):
self.__cur.callproc("getBType") self.__cur.callproc("getBtype", (None, None, ))
data = self.__cur.fetchall() data = self.__cur.fetchall()
return(data) return(data)

View File

@@ -15,7 +15,7 @@ class BusinessDAO:
def addBusiness(self, data): def addBusiness(self, data):
try: try:
print(data)
self.__cur.callproc("addBusiness", (json.dumps(data),)) self.__cur.callproc("addBusiness", (json.dumps(data),))
self.__con.commit() self.__con.commit()

View File

@@ -11,3 +11,15 @@ class ContactDAO:
def getContacts(self): def getContacts(self):
print(f"*** File: {__file__}, getContacts()") print(f"*** File: {__file__}, getContacts()")
def addContact(self, contact):
try:
contact_id = self.__cur.callproc("addContactPerson", (contact, 0, ))
self.__con.commit()
return contact_id[1]
#except mariadb.Error as e:
#print(str (e))
except Exception as e:
print(str (e))

View File

@@ -1,8 +1,9 @@
from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot, QObject
from .ContactDAO import ContactDAO from .ContactDAO import ContactDAO
import logging import logging
import json
class ContactModel: class ContactModel(QObject):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
#self.logger = logging.getLogger() #self.logger = logging.getLogger()
@@ -18,3 +19,10 @@ class ContactModel:
print(f"*** File: {__file__}, __getData()") print(f"*** File: {__file__}, __getData()")
ContactDAO().getContacts() ContactDAO().getContacts()
@Slot(dict)
def addContact(self, contact):
addC = ContactDAO()
j = json.dumps(contact)
a = addC.addContact(j)
return a