Changeset d0d0a66 for src/model


Ignore:
Timestamp:
01/02/10 22:14:10 (13 years ago)
Author:
komarma <komarma@…>
Branches:
master, qt5
Children:
9bbb44e
Parents:
489f262
Message:

Creating EventModel? class

Location:
src/model
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/model/event.cpp

    r489f262 rd0d0a66  
    1414Event Event::getById(int id, int conferenceId)
    1515{
    16     QString query = selectQuery() + "WHERE id = :id AND xid_conference = :conf";
     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}
    1722
    18     QSqlQuery q;
    19     q.prepare(query);
    20     q.bindValue(":id", id);
    21     q.bindValue(":conf", conferenceId);
    22     return loadOne(q);
     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);
    2332}
  • src/model/event.h

    r489f262 rd0d0a66  
    2424public:
    2525    static Event getById(int id, int conferenceId);
     26    static QList<Event> getByDate(const QDate& date, int conferenceId);
    2627
    2728public:
  • src/model/model.pro

    r489f262 rd0d0a66  
    1111TARGETDEPS += $$DESTDIR/liborm.a
    1212
    13 HEADERS += event.h
    14 SOURCES += event.cpp
     13HEADERS += \
     14    event.h \
     15    eventmodel.h
     16SOURCES += \
     17    event.cpp \
     18    eventmodel.cpp
    1519
Note: See TracChangeset for help on using the changeset viewer.