Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

MLAllocItem.h

00001 /***************************************************************************
00002  *   Copyright (C) 2006 by Graeme Foster                                   *
00003  *   email    foster.graeme@gmail.com                                      *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef __ML_ALLOC_ITEM_H
00021 #define __ML_ALLOC_ITEM_H
00022 
00023 
00024 #include "RootItem.h"
00025 #include "ModLecAlloc.h"
00026 
00027 class MLAllocItem : public RootItem
00028 {
00029         public: // Enums
00030                 enum Columns {COL_MODULE =0, COL_LECTURER, COL_HOURS, COL_SEMESTER
00031                              ,COL_CLASS_SIZE, COL_GROUPS, COL_LAB_HOURS, COL_LAB_GROUPS};
00032         public: // Constructor
00033                 MLAllocItem(ModLecAlloc * MLAllocObj, RootItem *parent = 0, int cc =0);
00034                 MLAllocItem(MLAllocItem & mlai);
00035                 ~MLAllocItem(){};
00036         // Get Methods
00037                 inline virtual ModLecAlloc * getItemData()const {return static_cast<ModLecAlloc * >(itemData);}
00038                 Module * getModule();
00039                 inline QString getDescription() const{return itemData->getDescription();}
00040                 inline QString getModuleDesc() const{return getItemData()->getModuleDesc();}
00041                 inline QString getLecturerDesc() const{return getItemData()->getLecturerDesc();}
00042                 inline QString getHoursDesc() const{return getItemData()->getHoursDesc();}
00043                 inline QString getSemesterDesc() const{return getItemData()->getSemesterDesc();}
00044                 inline QString getClassSizeDesc() const{return getItemData()->getClassSizeDesc();}
00045                 inline QString getGroupsDesc() const{return getItemData()->getGroupsDesc();}
00046                 inline QString getLabHoursDesc() const{return getItemData()->getLabHoursDesc();}
00047                 inline QString getLabGroupsDesc() const{return getItemData()->getLabGroupsDesc();}
00048                 QVariant data(int column) const;
00049         // Set Methods
00050                 virtual bool setData(int, const QVariant &) {return true;} // read only item
00051                 inline void updateClassSize(int classSize);
00052                 inline void updateGroups(int groups);
00053                 inline void updateLabHours(int labHours);
00054                 inline void updateLabGroups(int labGroups);
00055         // database manipulation
00056                 inline void dbSave();
00057                 inline void dbDelete();
00058 };
00059 
00060 inline void MLAllocItem::dbSave()
00061 {       getItemData()->save(ModLecAlloc::insertSQL, ModLecAlloc::updateSQL, ModLecAlloc::errorSQL);}
00062 
00063 inline void MLAllocItem::dbDelete()
00064 {       getItemData()->remove(ModLecAlloc::deleteSQL, ModLecAlloc::errorSQL);}
00065 
00066 // These fucntions are provided to allow quick access to database updates
00067 inline void MLAllocItem::updateClassSize(int classSize)
00068 {       getItemData()->updateClassSizeonDB(classSize);}
00069 
00070 inline void MLAllocItem::updateGroups(int groups)
00071 {       getItemData()->updateGroupsonDB(groups);}
00072 
00073 inline void MLAllocItem::updateLabHours(int labHours)
00074 {       getItemData()->updateLabHoursonDB(labHours);}
00075 
00076 inline void MLAllocItem::updateLabGroups(int labGroups)
00077 {       getItemData()->updateLabGroupsonDB(labGroups);}
00078 
00079 #endif

Generated on Thu Apr 6 16:27:17 2006 for time-table by  doxygen 1.4.4