source: src/mvc/event.cpp @ 680a4da

qt5
Last change on this file since 680a4da was 680a4da, checked in by pavelpa <pavelpa@…>, 12 years ago

work on favourite

  • created 'favourite' column in EVENT table
  • modified 'ormrecord' for setting record's elements
  • favourities view not implemented
  • Property mode set to 100644
File size: 1.2 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    << QSqlField("favourite", QVariant::Bool));
12
13QString const Event::sTableName = QString("event");
14
15Event Event::getById(int id, int conferenceId)
16{
17    QSqlQuery query;
18    query.prepare(selectQuery() + "WHERE id = :id AND xid_conference = :conf");
19    query.bindValue(":id", id);
20    query.bindValue(":conf", conferenceId);
21    return loadOne(query);
22}
23
24QList<Event> Event::getByDate(const QDate& date, int conferenceId)
25{
26    QSqlQuery query;
27    query.prepare(selectQuery() + "WHERE xid_conference = :conf AND start >= :start AND start < :end ORDER BY start");
28    query.bindValue(":conf", conferenceId);
29    query.bindValue(":start", convertToDb(date, QVariant::DateTime));
30    query.bindValue(":end", convertToDb(date.addDays(1), QVariant::DateTime));
31
32    return load(query);
33}
34
Note: See TracBrowser for help on using the repository browser.