duhuskermeg
08-27-2001, 11:42 PM
Hi!!
I have some problems with a function...
The functions purpose is to check for free time in a given period.
function freetime(FromDate, ToDate, FromTime, ToTime) : true/false
The question is: how do I make the best routine for checking this? There might be more the one appointments each day, so the check has to check for all appointments, and also consider that the appointment might run over days.
I thought about registering all appointments thats already registeres in a table, but what is the best way to do this?
//
// Example:
//
// Defintions
Number_Appointments = 0;
AppointmentTable = new Array();
function appointmet(FromDate, ToDate, FromTime, ToTime)
{
this.FromDate = FromDate;
this.ToDate = ToDate;
this.FromTime = FromTime;
this.ToTime = ToTime;
}
execute_function_read_registered_appointments_to_t able;
//
// use of table
//
if (freetime(FromDate, ToDate, FromTime, ToTime))
{
AppointmentTable[Number_Appointments + 1] = new appointment(FromDate, ToDate, FromTime, ToTime);
} else {
goto busy;
}
//
PS: Last I have to say that I dont think this will contain as much data as it may seem at first. The calendar will contain appointments for 1-6 months, and for some it may be 5 appointments and for others it may be much more, but anyway, It's not as bad as it may seem, in my oppinion.
PPS: If you can solve this, I also need a function similiar to the other one. The return value of the other function must be starting hour for appointments a given date AND the length (hours) for the appointment. Is this possible somehow?
TranceMore
I have some problems with a function...
The functions purpose is to check for free time in a given period.
function freetime(FromDate, ToDate, FromTime, ToTime) : true/false
The question is: how do I make the best routine for checking this? There might be more the one appointments each day, so the check has to check for all appointments, and also consider that the appointment might run over days.
I thought about registering all appointments thats already registeres in a table, but what is the best way to do this?
//
// Example:
//
// Defintions
Number_Appointments = 0;
AppointmentTable = new Array();
function appointmet(FromDate, ToDate, FromTime, ToTime)
{
this.FromDate = FromDate;
this.ToDate = ToDate;
this.FromTime = FromTime;
this.ToTime = ToTime;
}
execute_function_read_registered_appointments_to_t able;
//
// use of table
//
if (freetime(FromDate, ToDate, FromTime, ToTime))
{
AppointmentTable[Number_Appointments + 1] = new appointment(FromDate, ToDate, FromTime, ToTime);
} else {
goto busy;
}
//
PS: Last I have to say that I dont think this will contain as much data as it may seem at first. The calendar will contain appointments for 1-6 months, and for some it may be 5 appointments and for others it may be much more, but anyway, It's not as bad as it may seem, in my oppinion.
PPS: If you can solve this, I also need a function similiar to the other one. The return value of the other function must be starting hour for appointments a given date AND the length (hours) for the appointment. Is this possible somehow?
TranceMore