In recent days, the school arrangement, the choice of the topic is hotel management system, just get hands feel quite simple, not simply come to stay, realize login, change password on the line? But the quiet of the heart to an analysis, not to think of their own so simple, really is a little complicated, forced by the time relationship, just realized a small part of the function, and so busy, in addition to other functions. Let's take a look at the system interface.
1. Login interface (admin and customer)
Can realize the administrator and the customer to log in separately. In addition, the registration function has been added to customers who do not have an account and are used for booking. The registration interface diagram shows:
2, customer landing system.
Due to the time rush, the customer interface is simply to view the current room status, they can book those rooms, selected rooms can be booked. As shown in the following:
The customer can view the current room status, the room which I provided by default is vacant, the room which has been booked is not shown.
Another feature is the ability to modify your current registration information.
After all, is the class set, and again the function is too single, it shows a few pictures, Baidu when.
Client is a simple function, many have no time to achieve, such as winter vacation good to do.
3. Administrator interface
Let's take a look at the main interface. Not very good, in order to avoid the blank, I put a picture, or not ideal
Let's take a look at the business management-----Front Desk Center
Can be implemented by criteria to query, check the room status, room floor distribution, whether it is a single room, double room, deluxe suite and so on.
In fact, in the final analysis, this class is a simple database connection, there is nothing too complicated things. The operation of the database is simply a simple increase, delete, change, check, has been repeated operations. As long as the database will be, basically no problem, the interface is not important, talking about the interface, it is not difficult, it may be a bit difficult as a beginner, hey, I am also a novice, learning Qt less than a few months, think of himself at that time also want to make the interface to do some beautiful, so on the internet all kinds of Baidu, Inadvertently found a blog is said, using style sheet can be very convenient and quick to set the skin style of the interface, he saw his article, imitate his writing and writing. Thanks again for Liudianwu. The style sheet is used in the hotel management system, the buttons are displayed, the table data controls, and the borders are set.
A simple style sheet can be written like this:
qdialog#logindialog,qdialog#roompicdialog{
border:1px solid #1B89CA;
border-radius:0px;
}
Other effects can be set up similarly. To apply your own style sheet, you can write this:
QFile file (QString (":/image/%1.css"). Arg (stylename)); File.Open (qfile::readonly); QString QSS = qlatin1string (File.readall ()); Qapp->setstylesheet (QSS); Qapp->setpalette (Qpalette (Qcolor ("#F0F0F0"));
This allows you to apply your own style sheet to the entire system.
Some of the other features are relatively simple and do not go out of place. In fact, there is a database backup function, used to be used Sqllite database, backup is very simple, Copy your own database files. db, this time with MySQL, do not know how to back up, Baidu, the original, MySQL backup is mysqldump. In fact, it is not difficult, but also a few lines of code:
/* Function function: Back Up Database */void backupdatanasedialog::on_pbnok_clicked () { QString pathname = Ui->lineedit->text (); QString CMD = QString ("Mysqldump.exe--add-drop-table-u%1-p%2 Hotel"). Arg ("root", "123456"); QString Path = QString ("%1"). Arg (pathname); Qprocess *poc=new qprocess; Poc->setstandardoutputfile (Path); Poc->start (CMD); for (int i = 0;i<5000;i++) { ui->labelbackinfo->settext (tr ("Backing up ...)"); for (int j = 0;j<2000;j++) { ui->progressbar->setvalue (i); } Ui->labelbackinfo->settext (TR ("Backup Complete")); Ui->pbnok->settooltip (TR ("Already backed up completed"));} }
The program is called Mysqldump to implement the backup. Of course, you can also use commands to back up. Open Run, enter cmd, enter open cmd to enter the bin directory of the database, execute command: mysqldump-uroot-p BACKUP database name > new name. sql
A DOS window is used to back up the default in the current Bin directory. I can select my own backup directory in the program:
A progress bar is added to show the current backup process.
Well, that's all, the function is not much, but, oneself also busy for a while, finally is a certain result and harvest.
QT Hotel Management System