-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.h
39 lines (34 loc) · 1.22 KB
/
database.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef DATABASE_H
#define DATABASE_H
#include <QString>
#include <QSqlDatabase>
#include <QSqlError>
#include <QSqlQuery>
#include <QDebug>
#include <QLabel>
class Database {
public:
Database();
~Database();
bool testConnection();
bool closeConnection();
bool openDatabase();
void closeDatabase();
bool authenticateUser(const QString &username, const QString &password);//login
bool saveUserInfo(const QString &email, const QString &username, const QString &password);//signup
bool changeUserInfo(const QString &email, const QString &password);//forgot pass
QSqlDatabase getDatabase() const;
bool doesEmailExist(const QString &email);//email duplication check
//Seat Selection
QSqlQuery executeSeatQuery(int showtimeId);
bool updateSeatAvailability(const QString &seatId, int showtimeId);
bool insertBooking(const QString &userId, int showtimeId, const QString &seatId, int &bookingId);
int retrieveLastBookingId();
bool isSeatAvailable(const QString &seatId, int showtimeId);
void updateSeatUI(QLabel *seatLabel, int showtimeId);
void setSeatColor(QLabel *seatLabel, bool isAvailable);
private:
QSqlDatabase dbConnection;
int showtimeId;
};
#endif // DATABASE_H