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 00021 #ifndef __MODULE_LECTURER_ALLOCATED_H 00022 #define __MODULE_LECTURER_ALLOCATED_H 00023 00024 #include "DataClass.h" 00025 #include "Module.h" 00026 #include "Staff.h" 00027 00028 class ModLecAlloc : public DataClass 00029 { 00030 private: // Properties 00031 Module * modObj; 00032 Staff * lecObj; 00033 int hours; 00034 int semester; 00035 int class_size; 00036 int groups; 00037 int lab_hours; 00038 int lab_groups; 00039 00040 protected: // Properties 00041 friend class MLAllocItem; 00042 friend class MLEnrolItem; 00043 static int insertSQL; 00044 static int updateSQL; 00045 static int deleteSQL; 00046 static int addClassSizeSQL; 00047 static int addGroupsSQL; 00048 static int addLabHoursSQL; 00049 static int addLabGroupsSQL; 00050 static int idSQL; 00051 static int errorSQL; 00052 00053 public: // Constants 00054 00055 public: // Methods 00056 // Constructor 00057 ModLecAlloc(); 00058 ModLecAlloc(int onDB 00059 ,Module * mod 00060 ,Staff * lec 00061 ,int hrs 00062 ,int sem=0 00063 ,int c_size=0 00064 ,int c_groups=1 00065 ,int l_hours=0 00066 ,int l_groups=0); 00067 static void PrepareSQL(sql * dbConn); 00068 // Get Methods 00069 inline virtual QString getDescription()const {return lecObj->getDescription() + ": " + modObj->getDescription();} 00070 inline QString getModuleDesc() const{return modObj->getDescription();} 00071 inline QString getLecturerDesc() const{return lecObj->getDescription();} 00072 inline QString getHoursDesc() const{return QString::number(hours);} 00073 inline QString getSemesterDesc() const{return QString::number(semester);} 00074 inline QString getClassSizeDesc() const {return QString::number(class_size);} 00075 inline QString getGroupsDesc() const {return QString::number(groups);} 00076 inline QString getLabHoursDesc() const {return QString::number(lab_hours);} 00077 inline QString getLabGroupsDesc() const {return QString::number(lab_groups);} 00078 inline int getSem(){return semester;} 00079 Programme * getProg(){return dynamic_cast<Programme *>(modObj->getParent());} 00080 Module * getModule(){return modObj;} 00081 Staff * getStaff(){return lecObj;} 00082 // Set Methods 00083 void updateClassSizeonDB(int classSize); 00084 inline void setClassSize(int classSize){class_size = classSize;} 00085 void updateGroupsonDB(int classGroups); 00086 inline void setGroups(int classGroups){groups = classGroups;} 00087 void updateLabHoursonDB(int labHours); 00088 inline void setLabHours(int labHours){lab_hours = labHours;} 00089 void updateLabGroupsonDB(int labGroups); 00090 inline void setLabGroups(int labGroups){lab_groups = labGroups;} 00091 00092 protected: // Methods 00093 virtual int bindPKey(int preparedSQL); 00094 virtual void bindValues(int preparedSQL, int start); 00095 00096 }; 00097 00098 00099 #endif