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 __Institute_H 00022 #define __Institute_H 00023 00024 #include "DataClass.h" 00025 00026 class Institute : public DataClass 00027 { 00028 private: // Properties 00029 QString name; 00030 QString abbrev; 00031 00032 protected: // Properties 00033 friend class InstItem; 00034 static int insertSQL; 00035 static int updateSQL; 00036 static int deleteSQL; 00037 static int uniqueNameSQL; 00038 static int uniqueAbbrevSQL; 00039 static int errorSQL; 00040 00041 public: // Constants 00042 00043 public: // Methods 00044 // Constructor 00045 Institute(); 00046 Institute(int pID, QString name, QString abbrev); 00047 static void PrepareSQL(sql * dbConn); 00048 // Get Methods 00049 inline virtual QString getDescription()const{return getName();} 00050 inline QString getName()const{return name;} 00051 inline QString getAbbrev()const{return abbrev;} 00052 // Set Methods 00053 inline bool setName(QString pName){name = pName; return true;} 00054 inline bool setAbbrev(QString pAbbrev){abbrev = pAbbrev; return true;} 00055 00056 // Methods to determine if the field is unique 00057 static bool uniqueName(QString name, int parentID); 00058 static bool uniqueAbbrev(QString abbrev, int parentID); 00059 00060 protected: // Methods 00061 virtual void bindValues(int preparedSQL, int start); 00062 }; 00063 00064 #endif