source: src/mvc/event.h @ b8a3ad1

qt5
Last change on this file since b8a3ad1 was b8a3ad1, checked in by pavelpa <pavelpa@…>, 13 years ago

implemented NOW tab

  • Property mode set to 100644
File size: 3.1 KB
Line 
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*/
13class NoSuchEventException
14{
15};
16
17class Event : public OrmRecord<Event>
18{
19public:
20    static const QSqlRecord sColumns;
21    static QString const sTableName;
22public:
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
28public:
29    int id() const { return value("id").toInt(); }
30    int conferenceId() const { return value("xid_conference").toInt(); }
31    QDateTime start() const { return value("start").toDateTime(); }
32    int duration() const { return value("duration").toInt(); }
33    int trackId() const { return value("xid_track").toInt(); }
34    QString type() const { return value("type").toString(); }
35    QString language() const { return value("language").toString(); }
36    bool isFavourite() const { return value("favourite").toBool(); }
37    bool hasAlarm() const { return value("alarm").toBool(); }
38    bool hasTimeConflict() const { return true; /*return value("warning").toBool()*/; } //TODO
39    QString tag() const { return value("tag").toString(); }
40    QString title() const { return value("title").toString(); }
41    QString subtitle() const { return value("subtitle").toString(); }
42    QString abstract() const { return value("abstract").toString(); }
43    QString description() const { return value("description").toString(); }
44    // records from other tables associated with 'id'
45    QString room() const;
46    QStringList persons() const;
47
48    void setId(int id) { setValue("id", id); }
49    void setConferenceId(int conferenceId) { setValue("xid_conference", conferenceId); }
50    void setStart(const QDateTime & start) { setValue("start", start); }
51    void setDuration(int duration) { setValue("duration", duration); }
52    void setTrackId(int trackId) { setValue("xid_track", trackId); }
53    void setType(const QString & type) { setValue("type", type); }
54    void setLanguage(const QString & language) { setValue("language", language); }
55    void setFavourite(bool favourite) { setValue("favourite", (int)((favourite))); }
56    void setHasAlarm(bool alarm) { setValue("alarm", (int)((alarm))); }
57    void setTag(const QString& tag) { setValue("tag", tag); }
58    void setTitle(const QString& title) { setValue("title", title); }
59    void setSubtitle(const QString& subtitle) { setValue("subtitle", subtitle); }
60    void setAbstract(const QString& abstract) { setValue("abstract", abstract); }
61    void setDescription(const QString& description) { setValue("description", description); }
62    // records from other tables associated with 'id'
63    void setRoom(const QString& room);
64    void setPersons(const QStringList &persons);
65
66friend class EventTest;
67};
68
69#endif // EVENT_H
70
Note: See TracBrowser for help on using the repository browser.