00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __TIMESLOT_ITEM_H
00021 #define __TIMESLOT_ITEM_H
00022
00023 #include "RootItem.h"
00024
00025 #include "TimeSlot.h"
00026
00027 class TimeSlotItem : public RootItem
00028 {
00029 public:
00030 enum Columns {COL_WIDGET=0, COL_INSTITUTE, COL_DOW, COL_START_TIME, COL_FINISH_TIME, COL_DURATION};
00031 private:
00032 int semester;
00033 public:
00034 TimeSlotItem(TimeSlot * TSlotObj, RootItem *parent = 0, int cc = 0);
00035 ~TimeSlotItem(){};
00036
00037 inline virtual TimeSlot * getItemData()const {return static_cast<TimeSlot * >(itemData);}
00038 inline TimeSlot * getTimeSlot() {return getItemData();}
00039 inline Institute * getInstitute() {return getItemData()->getInstitute();}
00040 inline QString getDescription()const{return itemData->getDescription();}
00041 inline QString getInstName()const {return getItemData()->getInstName();}
00042 QVariant data(int column) const;
00043
00044 bool setData(int column, const QVariant & value);
00045
00046 inline void dbSave();
00047 inline void dbDelete();
00048 };
00049
00050 void TimeSlotItem::dbSave()
00051 {
00052 getItemData()->save(TimeSlot::insertSQL, TimeSlot::updateSQL, TimeSlot::errorSQL);
00053 }
00054
00055 void TimeSlotItem::dbDelete()
00056 {
00057 getItemData()->remove(TimeSlot::deleteSQL, TimeSlot::errorSQL);
00058 }
00059
00060 #endif