00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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:
00033 enum days {Invalid = -1, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};
00034 private:
00035
00036 days day;
00037 int duration;
00038 QTime startTime;
00039
00040 protected:
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:
00050
00051 public:
00052
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
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:
00078 virtual void bindValues(int preparedSQL, int start);
00079 virtual int remove (int deleteSQL, int errorSQL);
00080 };
00081
00082
00083 #endif