source: src/mvc/event.cpp @ 8860ff4

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

just some directory renaming

  • renamed 'model' to 'mvc' (Model-View-Controller), since it contains also 'delegate' and 'view'
  • Property mode set to 100644
File size: 1.1 KB
Line 
1#include "event.h"
2
3QSqlRecord const Event::sColumns = Event::toRecord(QList<QSqlField>()
4    << QSqlField("id", QVariant::Int)
5    << QSqlField("xid_conference", QVariant::Int)
6    << QSqlField("start", QVariant::DateTime)
7    << QSqlField("duration", QVariant::Int)
8    << QSqlField("xid_activity", QVariant::Int)
9    << QSqlField("type", QVariant::String)
10    << QSqlField("language", QVariant::String));
11
12QString const Event::sTableName = QString("event");
13
14Event Event::getById(int id, int conferenceId)
15{
16    QSqlQuery query;
17    query.prepare(selectQuery() + "WHERE id = :id AND xid_conference = :conf");
18    query.bindValue(":id", id);
19    query.bindValue(":conf", conferenceId);
20    return loadOne(query);
21}
22
23QList<Event> Event::getByDate(const QDate& date, int conferenceId)
24{
25    QSqlQuery query;
26    query.prepare(selectQuery() + "WHERE xid_conference = :conf AND start >= :start AND start < :end ORDER BY start");
27    query.bindValue(":conf", conferenceId);
28    query.bindValue(":start", convertToDb(date, QVariant::DateTime));
29    query.bindValue(":end", convertToDb(date.addDays(1), QVariant::DateTime));
30
31    return load(query);
32}
Note: See TracBrowser for help on using the repository browser.