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

Staff.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 
00021 #ifndef __STAFF_H
00022 #define __STAFF_H
00023 
00024 #include "DataClass.h"
00025 #include "Department.h"
00026 
00027 class Staff : public DataClass
00028 {
00029 private:
00030         QString fName, lName;
00031         
00032 protected: // Properties
00033         friend class StaffItem;
00034         static int insertSQL;
00035         static int updateSQL;
00036         static int deleteSQL;
00037         static int errorSQL;
00038 
00039 public: // Constructors
00040         Staff();
00041         Staff(int pID, QString fName, QString lName, Department * parent);
00042         static void PrepareSQL(sql * dbConn);
00043         // Get Methods
00044         inline QString getDescription()const {return getFName() + ", " + getLName();}
00045         inline QString getFName()const {return fName;}
00046         inline QString getLName()const {return lName;}
00047         inline Institute * getInstitute();
00048         inline QString getInstName()const;
00049         inline int     getInstID();
00050         inline Faculty * getFaculty();
00051         inline QString getFacName()const;
00052         inline int     getFacID();
00053         inline Department * getDepartment() {return static_cast<Department*>(parent);}
00054         inline QString getDeptName()const;
00055         inline int     getDeptID() {return getParentID();}
00056         // Set Methods
00057         inline bool setFName(QString pName){fName = pName; return true;}
00058         inline bool setLName(QString pLName){lName = pLName; return true;}
00059 protected:
00060         void bindValues(int preparedSQL, int start);
00061 };
00062 
00063 inline QString Staff::getInstName()const
00064 {
00065         if (parent!= 0)
00066                 return static_cast<Department*>(parent)->getInstName();
00067         else
00068                 return QString();
00069 }
00070  
00071 inline int     Staff::getInstID()
00072 {
00073         if (parent!= 0)
00074                 return getDepartment()->getInstID();
00075         else
00076                 return NO_PARENT;
00077 }
00078 
00079 inline Institute * Staff::getInstitute()
00080 {
00081         if (parent!= 0)
00082                 return getDepartment()->getInstitute();
00083         else
00084                 return 0;
00085 }
00086 
00087 inline Faculty * Staff::getFaculty()
00088 {
00089         if (parent!= 0)
00090                 return getDepartment()->getFaculty();
00091         else
00092                 return 0;
00093 }
00094 
00095 inline QString Staff::getFacName()const
00096 {
00097         if (parent!= 0)
00098                 return static_cast<Department*>(parent)->getFacName();
00099         else
00100                 return QString();
00101 }
00102 
00103 inline int     Staff::getFacID()
00104 {
00105         if (parent!= 0)
00106                 return getDepartment()->getFacultyID();
00107         else
00108                 return NO_PARENT;
00109 }
00110 
00111 inline QString Staff::getDeptName()const
00112 {
00113         if (parent!= 0)
00114                 return static_cast<Department*>(parent)->getName();
00115         else
00116                 return QString();
00117 }
00118 
00119 #endif

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