1 | #ifndef EVENT_H |
---|
2 | #define EVENT_H |
---|
3 | |
---|
4 | #include <QDateTime> |
---|
5 | #include <QVector> |
---|
6 | #include <QStringList> |
---|
7 | |
---|
8 | #include <ormrecord.h> |
---|
9 | |
---|
10 | /** |
---|
11 | NoSuchEventException is thrown when required event does not exist. |
---|
12 | */ |
---|
13 | class NoSuchEventException |
---|
14 | { |
---|
15 | }; |
---|
16 | |
---|
17 | class Event : public OrmRecord<Event> |
---|
18 | { |
---|
19 | public: |
---|
20 | static const QSqlRecord sColumns; |
---|
21 | static QString const sTableName; |
---|
22 | public: |
---|
23 | static Event getById(int id, int conferenceId); |
---|
24 | static QList<Event> getByDate(const QDate & date, int conferenceId, QString orderBy); |
---|
25 | static QList<Event> getFavByDate(const QDate & date, int conferenceId); // get Favourities by Date |
---|
26 | static QList<Event> getSearchResultByDate(const QDate& date, int conferenceId, QString orderBy); |
---|
27 | static QList<Event> nowEvents(int conferenceId, QString orderBy); // get events scheduled NOW |
---|
28 | static QList<Event> getByTrack(int id); |
---|
29 | static QList<Event> getByDateAndRoom(const QDate& date, int conferenceId); |
---|
30 | public: |
---|
31 | int id() const { return value("id").toInt(); } |
---|
32 | int conferenceId() const { return value("xid_conference").toInt(); } |
---|
33 | QDateTime start() const { return value("start").toDateTime(); } |
---|
34 | int duration() const { return value("duration").toInt(); } |
---|
35 | int trackId() const { return value("xid_track").toInt(); } |
---|
36 | QString type() const { return value("type").toString(); } |
---|
37 | QString language() const { return value("language").toString(); } |
---|
38 | bool isFavourite() const { return value("favourite").toBool(); } |
---|
39 | bool hasAlarm() const { return value("alarm").toBool(); } |
---|
40 | bool hasTimeConflict() const { return true; /*return value("warning").toBool()*/; } //TODO |
---|
41 | QString tag() const { return value("tag").toString(); } |
---|
42 | QString title() const { return value("title").toString(); } |
---|
43 | QString subtitle() const { return value("subtitle").toString(); } |
---|
44 | QString abstract() const { return value("abstract").toString(); } |
---|
45 | QString description() const { return value("description").toString(); } |
---|
46 | // records from other tables associated with 'id' |
---|
47 | QString room() const; |
---|
48 | int roomId() const; |
---|
49 | QStringList persons() const; |
---|
50 | |
---|
51 | void setId(int id) { setValue("id", id); } |
---|
52 | void setConferenceId(int conferenceId) { setValue("xid_conference", conferenceId); } |
---|
53 | void setStart(const QDateTime & start) { setValue("start", start); } |
---|
54 | void setDuration(int duration) { setValue("duration", duration); } |
---|
55 | void setTrackId(int trackId) { setValue("xid_track", trackId); } |
---|
56 | void setType(const QString & type) { setValue("type", type); } |
---|
57 | void setLanguage(const QString & language) { setValue("language", language); } |
---|
58 | void setFavourite(bool favourite) { setValue("favourite", (int)((favourite))); } |
---|
59 | void setHasAlarm(bool alarm) { setValue("alarm", (int)((alarm))); } |
---|
60 | void setTag(const QString& tag) { setValue("tag", tag); } |
---|
61 | void setTitle(const QString& title) { setValue("title", title); } |
---|
62 | void setSubtitle(const QString& subtitle) { setValue("subtitle", subtitle); } |
---|
63 | void setAbstract(const QString& abstract) { setValue("abstract", abstract); } |
---|
64 | void setDescription(const QString& description) { setValue("description", description); } |
---|
65 | // records from other tables associated with 'id' |
---|
66 | void setRoom(const QString& room); |
---|
67 | void setPersons(const QStringList &persons); |
---|
68 | |
---|
69 | friend class EventTest; |
---|
70 | }; |
---|
71 | |
---|
72 | #endif // EVENT_H |
---|
73 | |
---|