00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __STAFF_ITEM_H
00021 #define __STAFF_ITEM_H
00022
00023 #include "RootItem.h"
00024
00025 #include "Staff.h"
00026
00027 class StaffItem : public RootItem
00028 {
00029 public:
00030 enum Columns {COL_FIRST_NAME =0, COL_LAST_NAME, COL_DEPT, COL_FACULTY, COL_INSTITUTE};
00031 public:
00032 StaffItem(Staff * StaffObj, RootItem *parent = 0, int cc =0);
00033 StaffItem(StaffItem& si);
00034
00035 inline virtual Staff * getItemData()const {return static_cast<Staff * >(itemData);}
00036 inline Institute * getInstitute() {return getItemData()->getInstitute();}
00037 inline Faculty * getFaculty() {return getItemData()->getFaculty();}
00038 inline Department * getDept() {return getItemData()->getDepartment();}
00039 inline Staff * getStaff() {return getItemData();}
00040 inline QString getInstName()const {return getItemData()->getInstName();}
00041 inline QString getFacName()const {return getItemData()->getFacName();}
00042 inline QString getDeptName()const {return getItemData()->getDeptName();}
00043 inline QString getDescription()const{return getItemData()->getDescription();}
00044 inline QString getStaffFName()const{return getItemData()->getFName();}
00045 inline QString getStaffLName()const{return getItemData()->getLName();}
00046 QVariant data(int column) const;
00047
00048 inline bool setStaffFName(QString name){return getItemData()->setFName(name);}
00049 inline bool setStaffLName(QString abbrev){return getItemData()->setLName(abbrev);}
00050 bool setData(int column, const QVariant & value);
00051
00052 inline void dbSave();
00053 inline void dbDelete();
00054 };
00055
00056 void StaffItem::dbSave()
00057 {
00058 getItemData()->save(Staff::insertSQL, Staff::updateSQL, Staff::errorSQL);
00059 }
00060
00061 void StaffItem::dbDelete()
00062 {
00063 getItemData()->remove(Staff::deleteSQL, Staff::errorSQL);
00064 }
00065
00066 #endif