[e5bc908] | 1 | #ifndef EVENT_H |
---|
| 2 | #define EVENT_H |
---|
| 3 | |
---|
| 4 | #include <QDateTime> |
---|
[5a73d27] | 5 | #include <QVector> |
---|
| 6 | #include <QStringList> |
---|
[e5bc908] | 7 | |
---|
[5a73d27] | 8 | #include <ormrecord.h> |
---|
| 9 | |
---|
| 10 | /** |
---|
| 11 | NoSuchEventException is thrown when required event does not exist. |
---|
| 12 | */ |
---|
| 13 | class NoSuchEventException |
---|
| 14 | { |
---|
| 15 | }; |
---|
| 16 | |
---|
[20a6010] | 17 | class Event : public OrmRecord<Event> |
---|
[e5bc908] | 18 | { |
---|
| 19 | public: |
---|
[20a6010] | 20 | static QSqlRecord const sColumns; |
---|
[c790268] | 21 | //static QString const sTableName; |
---|
| 22 | static QString const sTable1Name; |
---|
| 23 | static QString const sTable2Name; |
---|
| 24 | static int const sTable1ColCount; |
---|
| 25 | static int const sTable2ColCount; |
---|
[5a73d27] | 26 | |
---|
| 27 | public: |
---|
[20a6010] | 28 | static Event getById(int id, int conferenceId); |
---|
[d0d0a66] | 29 | static QList<Event> getByDate(const QDate& date, int conferenceId); |
---|
[6f39595] | 30 | static QList<Event> getFavByDate(const QDate& date, int conferenceId); // get Favourities by Date |
---|
[e5bc908] | 31 | |
---|
| 32 | public: |
---|
[c790268] | 33 | // Table 1 |
---|
[20a6010] | 34 | int id() const { return value("id").toInt(); } |
---|
| 35 | int conferenceId() const { return value("xid_conference").toInt(); } |
---|
| 36 | QDateTime start() const { return value("start").toDateTime(); } |
---|
| 37 | int duration() const { return value("duration").toInt(); } |
---|
| 38 | int activityId() const { return value("xid_activity").toInt(); } |
---|
[489f262] | 39 | QString type() const { return value("type").toString(); } |
---|
| 40 | QString language() const { return value("language").toString(); } |
---|
[680a4da] | 41 | bool isFavourite() const { return value("favourite").toBool(); } |
---|
[c790268] | 42 | // Table 2 : virtual table for FTS (Full Text Search) |
---|
| 43 | QString tag() const { return value("tag").toString(); } |
---|
| 44 | QString title() const { return value("title").toString(); } |
---|
| 45 | QString subtitle() const { return value("subtitle").toString(); } |
---|
| 46 | QString abstract() const { return value("abstract").toString(); } |
---|
| 47 | QString description() const { return value("description").toString(); } |
---|
[20a6010] | 48 | |
---|
[c790268] | 49 | // Table 1 |
---|
[20a6010] | 50 | void setId(int id) { setValue("id", id); } |
---|
| 51 | void setConferenceId(int conferenceId) { setValue("xid_conference", conferenceId); } |
---|
| 52 | void setStart(const QDateTime& start) { setValue("start", start); } |
---|
| 53 | void setDuration(int duration) { setValue("duration", duration); } |
---|
| 54 | void setActivityId(int activityId) { setValue("xid_activity", activityId); } |
---|
[489f262] | 55 | void setType(const QString& type) { setValue("type", type); } |
---|
| 56 | void setLanguage(const QString& language) { setValue("language", language); } |
---|
[6f39595] | 57 | void setFavourite(bool favourite) { setValue("favourite", (int)favourite); } |
---|
[c790268] | 58 | // Table 2 : virtual table for FTS (Full Text Search) |
---|
| 59 | void setTag(const QString& tag) { setValue("tag", tag); } |
---|
| 60 | void setTitle(const QString& title) { setValue("title", title); } |
---|
| 61 | void setSubtitle(const QString& subtitle) { setValue("subtitle", subtitle); } |
---|
| 62 | void setAbstract(const QString& abstract) { setValue("abstract", abstract); } |
---|
| 63 | void setDescription(const QString& description) { setValue("description", description); } |
---|
[20a6010] | 64 | |
---|
| 65 | friend class EventTest; |
---|
[e5bc908] | 66 | }; |
---|
| 67 | |
---|
| 68 | #endif // EVENT_H |
---|
[680a4da] | 69 | |
---|