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

TimeSlot.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 __TIME_SLOT_H
00022 #define __TIME_SLOT_H
00023 
00024 #include "DataClass.h"
00025 #include "Institute.h"
00026 
00027 class DailyTimeSlotItem;
00028 class TimeSlotItem;
00029 
00030 class TimeSlot : public DataClass
00031 {
00032 public: //enums
00033         enum days {Invalid = -1, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};
00034 private: // Properties
00035 //      Institute * instObj;
00036         days day;
00037         int duration;
00038         QTime startTime;
00039         
00040 protected: // Properties
00041         friend class TimeSlotPageWidget;
00042         friend class DailyTimeSlotItem;
00043         friend class TimeSlotItem;
00044         static int insertSQL;
00045         static int updateSQL;
00046         static int deleteSQL;
00047         static int errorSQL;
00048         
00049 public: // Constants
00050         
00051 public: // Methods
00052         // Constructor
00053         TimeSlot();
00054         TimeSlot(int onDB
00055                 ,Institute * inst
00056                 ,days theDay
00057                 ,int duration
00058                 ,QTime startTime);
00059         static void PrepareSQL(sql * dbConn);
00060         // Get Methods
00061         inline virtual QString getDescription()const {return getDOW() 
00062                                                 + " From: " + startTime.toString("H:mm")
00063                                                 + " To: "
00064                                                 + (startTime.addSecs(duration*60)).toString("H:mm")
00065                                                 + " " + static_cast<Institute *>(parent)->getDescription() ;}
00066         QString getDOW()const;
00067         days getDays(){return day;}
00068         static days getDays(QString);
00069         Institute * getInstitute() {return static_cast<Institute *>(parent);}
00070         QString     getInstName(){return getInstitute()->getName();}
00071         QString getTimeRange();
00072         QTime   getStartTime() {return startTime;}
00073         QTime   getFinishTime(){return startTime.addSecs(duration*60);}
00074         QString getStartTimeName() {return startTime.toString("H:mm");}
00075         QString getFinishTimeName(){return startTime.addSecs(duration*60).toString("H:mm");}
00076         virtual QString getSortValue();
00077 protected: // Methods
00078         virtual void bindValues(int preparedSQL, int start);
00079         virtual int remove  (int deleteSQL, int errorSQL);
00080 };
00081 
00082 
00083 #endif

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