00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __PROG_ITEM_H
00021 #define __PROG_ITEM_H
00022
00023 #include "RootItem.h"
00024
00025 #include "Programme.h"
00026
00027 class ProgItem : public RootItem
00028 {
00029 public:
00030 enum Columns {COL_NAME=0, COL_ABBREV, COL_SEMESTER, COL_INSTITUTE};
00031 private:
00032 int semester;
00033 public:
00034 ProgItem(Programme * ProgObj, RootItem *parent = 0, int cc =0, int sem =0);
00035 ProgItem(ProgItem & pi);
00036 ~ProgItem(){};
00037
00038 inline virtual Programme * getItemData()const {return static_cast<Programme * >(itemData);}
00039 inline Programme * getProgramme() {return getItemData();}
00040 inline Institute * getInstitute() {return getItemData()->getInstitute();}
00041 inline QString getDescription()const{return itemData->getDescription();}
00042 inline QString getInstName()const {return getItemData()->getInstName();}
00043 inline QString getProgName()const {return getItemData()->getName();}
00044 inline QString getProgAbbrev()const {return getItemData()->getAbbrev();}
00045 inline QString getSemDesc()const {return QString::number(semester);}
00046 QVariant data(int column) const;
00047
00048 inline bool setProgName(QString name) {return getItemData()->setName(name);}
00049 inline bool setProgAbbrev(QString abbrev){return getItemData()->setAbbrev(abbrev);}
00050 bool setData(int column, const QVariant & value);
00051
00052 inline void dbSave();
00053 inline void dbDelete();
00054 };
00055
00056 void ProgItem::dbSave()
00057 {
00058 getItemData()->save(Programme::insertSQL, Programme::updateSQL, Programme::errorSQL);
00059 }
00060
00061 void ProgItem::dbDelete()
00062 {
00063 getItemData()->remove(Programme::deleteSQL, Programme::errorSQL);
00064 }
00065
00066 #endif