#include "seasonservice.h" #include "core-odb.hxx" SeasonService::SeasonService() { } QSharedPointer SeasonService::active() { QList > seasons = all("active = 1"); if (seasons.count() > 0) { return seasons[0]; } return QSharedPointer(); } void SeasonService::activate(QSharedPointer season) { Transaction tx; foreach (QSharedPointer ses, all()) { ses->setActive(false); update(ses); } season->setActive(true); update(season); tx.commit(); }