You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
2.6 KiB
97 lines
2.6 KiB
#include "cellstatus.h"
|
|
#include "ui_cellstatus.h"
|
|
|
|
|
|
cellstatus::cellstatus(QWidget *parent) :
|
|
QWidget(parent),
|
|
ui(new Ui::cellstatus)
|
|
{
|
|
ui->setupUi(this);
|
|
ui->pushButton->setStyleSheet("border:2px groove gray;background-color: rgb(0, 0, 0,30);color: rgb(255, 255, 255);"
|
|
"border-radius:5px;");
|
|
ui->pushButton_2->setStyleSheet("border:2px groove gray;background-color: rgb(0, 0, 0,30);color: rgb(255, 255, 255);"
|
|
"border-radius:5px;");
|
|
|
|
|
|
ui->pushButton->setFixedSize(25,25);
|
|
ui->pushButton_2->setFixedSize(25,25);
|
|
ui->gridLayout->setMargin(5);
|
|
ui->pushButton->setEnabled(true);
|
|
ui->pushButton_2->setEnabled(false);
|
|
m_order = new orderoom();
|
|
connect(m_order,&orderoom::ordersuccess,this,&cellstatus::onordersuccess);
|
|
}
|
|
|
|
cellstatus::~cellstatus()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void cellstatus::setisused(bool i){
|
|
isused = i;
|
|
}
|
|
|
|
void cellstatus::setbtn(){
|
|
ui->pushButton->setEnabled(!isused);
|
|
ui->pushButton_2->setEnabled(isused);
|
|
}
|
|
|
|
void cellstatus::setcbtn(checkbtn* cbtn){
|
|
this->cbtn = cbtn;
|
|
}
|
|
|
|
void cellstatus::setroomNum(int roomNum)
|
|
{
|
|
this->roomNum = roomNum;
|
|
}
|
|
|
|
void cellstatus::setDB(QSqlDatabase db)
|
|
{
|
|
this->db = db;
|
|
}
|
|
|
|
void cellstatus::on_pushButton_clicked()
|
|
{
|
|
m_order->setroomNum(roomNum);
|
|
m_order->setDB(db);
|
|
m_order->show();
|
|
}
|
|
|
|
void cellstatus::on_pushButton_2_clicked()
|
|
{
|
|
QSqlQuery query;
|
|
query.prepare("select * from customer where room_num like :num;");
|
|
query.bindValue(":str",roomNum);
|
|
query.exec();
|
|
QString account = query.value(0).toString();
|
|
query.prepare("UPDATE customer set room_num=NULL where account = :a");
|
|
query.bindValue(":a",account);
|
|
query.exec();
|
|
query.prepare("UPDATE room set status=:QS where room_num = :num");
|
|
query.bindValue(":QS","空闲");
|
|
query.bindValue(":num",roomNum);
|
|
query.exec();
|
|
query.prepare("UPDATE room set checkout_time=NULL where room_num = :num");
|
|
query.bindValue(":num",roomNum);
|
|
query.exec();
|
|
query.prepare("UPDATE room set customer_id=NULL where room_num = :num");
|
|
query.bindValue(":num",roomNum);
|
|
query.exec();
|
|
QMessageBox::information(this," 预定信息 "," 退房成功 ");
|
|
ui->pushButton->setEnabled(true);
|
|
ui->pushButton_2->setEnabled(false);
|
|
cbtn->setisused(false);
|
|
cbtn->setbtn();
|
|
emit flash();
|
|
}
|
|
|
|
void cellstatus::onordersuccess()
|
|
{
|
|
QMessageBox::information(this,"预定信息","订房成功");
|
|
ui->pushButton->setEnabled(false);
|
|
ui->pushButton_2->setEnabled(true);
|
|
cbtn->setisused(true);
|
|
cbtn->setbtn();
|
|
emit flash();
|
|
}
|