From 5d2f6bb6bb4a50d0c44d18ce1f62d968f77c9306 Mon Sep 17 00:00:00 2001 From: HOJI Date: Tue, 12 Sep 2023 13:33:31 +0800 Subject: [PATCH] fixed bugs --- Hotel_Management.pro.user | 3 ++- customer.cpp | 11 +++++++++-- login.cpp | 1 + orderoom.cpp | 2 +- resetmessage.cpp | 13 ++++++++++++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Hotel_Management.pro.user b/Hotel_Management.pro.user index dc57382..147d6cf 100644 --- a/Hotel_Management.pro.user +++ b/Hotel_Management.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -243,6 +243,7 @@ true false true + F:/git/Hotel_Management/build-Hotel_Management-Desktop_Qt_5_15_2_MinGW_64_bit-Debug 1 diff --git a/customer.cpp b/customer.cpp index 8e6277a..cd2c27b 100644 --- a/customer.cpp +++ b/customer.cpp @@ -6,8 +6,6 @@ customer::customer(QWidget *parent) : ui(new Ui::customer) { init(); - ResetMessage *RM = new ResetMessage; - RM->getid(id);//将id传过去 } @@ -56,6 +54,14 @@ void customer::init()//初始化 完成 void customer::setid(QString str) { id = str; + QSqlQuery query; + query.prepare("select * from customer where account like :id"); + query.exec(); + if(query.value(5)!=NULL){ + account_roomaccount = 1; + }else{ + account_roomaccount = 0; + } } void customer::setmousehand()//鼠标小手 完成 @@ -159,6 +165,7 @@ void customer::on_Reservation1_clicked()//订房 完成 void customer::on_pushButton_clicked()//显示修改密码界面 完成 { + rm->getid(id);//将id传过去 rm->show(); } diff --git a/login.cpp b/login.cpp index 11da9fa..dc8a6f9 100644 --- a/login.cpp +++ b/login.cpp @@ -71,6 +71,7 @@ void login::on_btn_login_clicked() qDebug("login succeed"); isfind=true; customer *cus = new customer; + cus->setid(ui->lineEdit_account->text()); this->hide(); cus->show(); break; diff --git a/orderoom.cpp b/orderoom.cpp index 36973c0..32b3831 100644 --- a/orderoom.cpp +++ b/orderoom.cpp @@ -83,7 +83,7 @@ void orderoom::on_btn_order_clicked() { if(findcustomer){ QDate date = QDate::currentDate(); - int account = ui->tableWidget->model()->index(0,0).data().toString().toInt(); + QString account = ui->tableWidget->model()->index(0,0).data().toString(); QString sql1 = QString("UPDATE room set customer_id = %1 where room_num = %2").arg(account).arg(roomNum); QString sql2 = QString("UPDATE room set status='使用' where room_num = %1").arg(roomNum); QString sql3 = QString("UPDATE customer set room_num=%1 where account = %2").arg(roomNum).arg(ui->tableWidget->model()->index(0,0).data().toString()); diff --git a/resetmessage.cpp b/resetmessage.cpp index dff2247..5d176a2 100644 --- a/resetmessage.cpp +++ b/resetmessage.cpp @@ -111,10 +111,21 @@ void ResetMessage::sign_in(){ }else{ gender = "女"; } - QSqlQuery query; query.prepare("UPDATE customer set password = :p where account = :a"); query.bindValue(":p",ui->code->text()); query.bindValue(":a",id); query.exec(); + query.prepare("UPDATE customer set name = :n where account = :a"); + query.bindValue(":n",ui->name->text()); + query.bindValue(":a",id); + query.exec(); + query.prepare("UPDATE customer set gender = :g where account = :a"); + query.bindValue(":g",gender); + query.bindValue(":a",id); + query.exec(); + query.prepare("UPDATE customer set id = :id where account = :a"); + query.bindValue(":id",ui->ID_card->text()); + query.bindValue(":a",id); + query.exec(); }