Changeset 7620de0 for src/mvc/event.cpp


Ignore:
Timestamp:
01/25/10 13:52:01 (12 years ago)
Author:
korrco <korrco@…>
Branches:
master, qt5
Children:
c7b58d4
Parents:
7b70507
Message:

room view added - need to test it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/event.cpp

    r7b70507 r7620de0  
    11#include "event.h"
     2#include "room.h"
    23
    34QString const Event::sTableName = QString("event");
     
    4041}
    4142
     43QList<Event> Event::getByDateAndRoom(const QDate& date, int conferenceId)
     44{
     45    QSqlQuery query;
     46    QString aliasEvent("E");
     47    QString aliasEventRoom("R");
     48    query.prepare(QString("SELECT %1 FROM %2 %3, %4 %5 WHERE %3.xid_conference = :conf AND %3.start >= :start AND %3.start < :end AND %3.id = R.xid_event ORDER BY %5.xid_room, %3.start").arg(
     49                    columnsForSelect(aliasEvent), Event::sTableName, aliasEvent, "EVENT_ROOM", aliasEventRoom));
     50    query.bindValue(":conf", conferenceId);
     51    query.bindValue(":start", convertToDb(date, QVariant::DateTime));
     52    query.bindValue(":end", convertToDb(date.addDays(1), QVariant::DateTime));
     53
     54    return load(query);
     55}
     56
    4257QList<Event> Event::nowEvents(int conferenceId, QString orderBy)
    4358{
     
    6580}
    6681
    67 QList<Event> Event::getByTrack(int trackId)
    68 {
    69     QSqlQuery query;
    70     query.prepare(selectQuery() + QString("WHERE xid_track = :trackId ORDER BY start"));
    71     query.bindValue(":trackId", trackId);
    72 
    73     return load(query);
    74 }
    75 
    7682QString Event::room() const
    7783{
     
    8793    else
    8894        return QString("not-available");
     95}
     96
     97int Event::roomId() const
     98{
     99    QSqlQuery query;
     100    query.prepare("SELECT xid_room FROM event_room WHERE xid_event = :id");
     101    query.bindValue(":id", id());
     102    if (!query.isActive())
     103        if (!query.exec())
     104            throw OrmSqlException(query.lastError().text());
     105    if (!query.next())
     106        throw OrmNoObjectException();
     107    return query.record().value("xid_room").toInt();
    89108}
    90109
Note: See TracChangeset for help on using the changeset viewer.