def submitComplaintButtonClicked(self):
#submit the complaint to database
restaurant = self.complaintInfoList[0].get().split(',')[0]
self.cursor.execute("SELECT rid FROM restaurant WHERE name = %s", restaurant)
restaurantID = self.cursor.fetchone()[0]
phone = self.complaintInfoList[4].get()
cdate = self.complaintInfoList[1].get()
customerFirstName = self.complaintInfoList[2].get()
customerLastName = self.complaintInfoList[3].get()
'''
address = self.complaintInfoList[0].get().split(', ', 1)[1]
print("address: " + address)
self.cursor.execute("SELECT email FROM restaurant WHERE name = %s", restaurant)
operatorEmail = self.cursor.fetchone()[0]
print("email: " + operatorEmail)
self.cursor.execute("SELECT firstname, lastname FROM operatorowner WHERE email = %s", operatorEmail)
nameTuple = self.cursor.fetchall()
operatorName = nameTuple[0][0] + ' ' + nameTuple[0][1]
print(operatorName)
self.cursor.execute("SELECT totalscore FROM inspection WHERE rid = %s ORDER BY idate DESC", restaurantID)
score = self.cursor.fetchone()[0]
print("score: " + str(score))
'''
complaint = self.complaintInfoList[-1].get()
result = self.cursor.execute("SELECT * FROM customer WHERE phone = %s", phone)
if not result:
self.cursor.execute("INSERT INTO customer (phone, firstname, lastname) VALUES (%s, %s, %s)",
(phone, customerFirstName, customerLastName))
self.db.commit()
self.cursor.execute("INSERT INTO complaint (rid, phone, cdate, description) VALUES (%s, %s, %s, %s)",
(restaurantID, phone, cdate, complaint))
self.db.commit()
messagebox.showwarning("Submission Successful!", "Your complaint has been submitted.")
self.fileComplaintWindow.withdraw()
self.guestMenuWindow.deiconify()
Guest.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录