var dateTimeStamp = Now();
var cacheType = getCacheType();
var cacheStatus = getEventCacheStatus();
var futureYears = getCacheMaxFutureYears();
var pastYears = getCacheMaxPastYears();
var pastMonths = 0;
var futureMonths = 0;
var startCacheDate = "";
var endCacheDate = "";
// Calculate the Cache start and enddates
if ( IsNumeric(pastYears) AND pastYears GT 0 )
{
pastMonths = Round(pastYears * 12);
startCacheDate = DateFormat(DateAdd("m",-(pastMonths),dateTimeStamp),"YYYY-MM-DD");
}
if ( IsNumeric(futureYears) AND futureYears GT 0 )
{
futureMonths = Round(futureYears * 12);
endCacheDate = DateFormat(DateAdd("m",futureMonths,dateTimeStamp),"YYYY-MM-DD");
}
// 1) Reset the ptCalendarCache application Struct
application.ptCalendarCache = StructNew();
// 2) Build the Events Cache
buildEventsCache(startDate=startCacheDate,endDate=endCacheDate);
// 3) Intialize Update ptCalendarCache Vars
application.ptCalendarCache.eventsCacheUpdateDateTime = "";
// 4) Set the Cache Type (memory, database, file)
application.ptCalendarCache.cacheType = cacheType;
// 5) Set the Cache Status
application.ptCalendarCache.cacheStatus = cacheStatus;
// 6) Set the Cache Status
if ( LEN(TRIM(startCacheDate)) AND application.ptCalendar.date.IsRealDate(startCacheDate) )
application.ptCalendarCache.cacheStartDate = startCacheDate;
// 7) Set the Cache Status
if ( LEN(TRIM(endCacheDate)) AND application.ptCalendar.date.IsRealDate(endCacheDate) )
application.ptCalendarCache.cacheEndDate = endCacheDate;
// 8) Set the Cache Source Info
//application.ptCalendarCache.cacheSource = StructNew();
if ( cacheType EQ "database" )
application.ptCalendarCache.cacheSourceDSN = getCacheDataSource();
else if ( cacheType EQ "file" )
application.ptCalendarCache.cacheSourceFilePath = application.ptCalendar.calEventsCacheFileDAO.getEventsCacheFilePath();
return cacheStatus;
var retStruct = StructNew();
var retStr = "";
var dateTimeStamp = Now();
var cacheType = getCacheType();
//var cacheStatus = getEventCacheStatus();
//if ( LEN(TRIM(arguments.startDate)) )
//if ( LEN(TRIM(arguments.endDate)) )
// Determine which type of cache to build
switch(cacheType) {
case "file":
retStr = application.ptCalendar.calEventsCacheFileDAO.buildEventsCacheFile(
startDate=arguments.startDate
,endDate=arguments.endDate
);
break;
case "database":
retStr = application.ptCalendar.calEventsCacheDatabaseDAO.buildEventsCacheTable(
startDate=arguments.startDate
,endDate=arguments.endDate
);
break;
default: // "memory"
retStr = application.ptCalendar.calEventsCacheMemoryDAO.buildEventsCacheMemory(
startDate=arguments.startDate
,endDate=arguments.endDate
);
}
if ( NOT StructKeyExists(application,"ptCalendarCache") )
application.ptCalendarCache = StructNew();
// set cache created the timestamp
application.ptCalendarCache.eventsCacheBuildDateTime = dateTimeStamp;
// set the return struct
retStruct.status = retStr;
return retStruct;
var dataQry = QueryNew("temp");
var cacheType = getCacheType();
// Determine which type of cache to build
switch(cacheType) {
case "file":
dataQry = application.ptCalendar.calEventsCacheFileDAO.getEventsQuery();
break;
case "database":
dataQry = application.ptCalendar.calEventsCacheDatabaseDAO.getEventsQuery();
break;
default: // "memory"
dataQry = application.ptCalendar.calEventsCacheMemoryDAO.getEventsQuery();
}
// Make sure the dataQry value is actually a query
if ( NOT IsQuery(dataQry) )
dataQry = QueryNew("temp");
SELECT *
FROM dataQry
WHERE 1=1
AND calEventID =
AND dateTimeID =
AND dtHashID =
AND CAST( eventDate AS DATE )
BETWEEN CAST( AS DATE )
AND CAST( AS DATE )
AND CAST( eventDate AS DATE ) >= CAST( AS DATE )
ORDER BY eventDate, AllDay DESC, StartTime
return getEvents(startDate=arguments.startdate,enddate=arguments.enddate);
return getEvents(eventID=TRIM(arguments.eventID));
return getEvents(dateTimeID=TRIM(arguments.dateTimeID));
return getEvents(hashID=arguments.hashID);
var retData = StructNew();
var retStr = "";
// Determine which type of cache processing to do
switch(arguments.process) {
case "add":
retData = addEventCacheRecord(eventID=arguments.eventID);
break;
case "update":
retData = updateEventCacheRecord(eventID=arguments.eventID);
break;
case "delete":
retData = deleteEventCacheRecord(eventID=arguments.eventID);
break;
}
// determine if the process was successful or not
// and return the process status to the ajax call
if ( StructKeyExists(retData,"status") )
retStr = retData.status;
return true;
var dateTimeStamp = Now();
var retStruct = StructNew();
var retStr = "";
var cacheType = getCacheType();
// Determine which type of cache to build
switch(cacheType) {
case "file": /* TODO: file caching not complete */
retStr = application.ptCalendar.calEventsCacheFileDAO.addEventCacheRecord(
eventID=arguments.eventID
);
break;
case "database":
retStr = variables.calEventsCacheDatabaseDAO.addEventCacheRecord(
eventID=arguments.eventID
);
break;
default: // "memory"
retStr = application.ptCalendar.calEventsCacheMemoryDAO.addEventCacheRecord(
eventID=arguments.eventID
);
}
// set the return struct
retStruct.status = retStr;
// TODO: Move eventCacheUpdate to the lower level functions
//if ( NOT StructKeyExists(application,"ptCalendarCache") )
// application.ptCalendarCache = StructNew();
//application.ptCalendarCache.calendarCacheUpdateDateTime = dateTimeStamp;
//application.ptCalendarCache.eventsCacheUpdateDateTime = dateTimeStamp;
return retStruct;
var retStruct = StructNew();
var retStr = "";
var cacheType = getCacheType();
// Determine which type of cache to build
switch(cacheType) {
case "file": /* TODO: file caching not complete */
retStr = variables.calEventsCacheFileDAO.updateEventCacheRecord(
eventID=arguments.eventID
);
break;
case "database":
retStr = variables.calEventsCacheDatabaseDAO.updateEventCacheRecord(
eventID=arguments.eventID
);
break;
default: // "memory"
retStr = variables.calEventsCacheMemoryDAO.updateEventCacheRecord(
eventID=arguments.eventID
);
}
// set the return struct
retStruct.status = retStr;
return retStruct;
var retStruct = StructNew();
var retStr = "";
var cacheType = getCacheType();
// Determine which type of cache to build
switch(cacheType) {
case "file": /* TODO: file caching not complete */
retStr = application.ptCalendar.calEventsCacheFileDAO.deleteEventCacheRecord(
eventID=arguments.eventID
);
break;
case "database":
retStr = variables.calEventsCacheDatabaseDAO.deleteEventCacheRecord(
eventID=arguments.eventID
);
break;
default: // "memory"
retStr = application.ptCalendar.calEventsCacheMemoryDAO.deleteEventCacheRecord(
eventID=arguments.eventID
);
}
// set the return struct
retStruct.status = retStr;
return retStruct;
var retStruct = StructNew();
var retStr = "";
var cacheType = getCacheType();
// Determine which type of cache to build
switch(cacheType) {
case "file":
retStr = application.ptCalendar.calEventsCacheFileDAO.deleteEventCache();
break;
case "database":
retStr = variables.calEventsCacheDatabaseDAO.deleteEventCache();
break;
default: // "memory"
retStr = application.ptCalendar.calEventsCacheMemoryDAO.deleteEventCache();
}
// RUN application.ptCalendarCache cleanup
if ( StructKeyExists(application,"ptCalendarCache") )
StructDelete(application,"ptCalendarCache");
// set the return struct
retStruct.status = retStr;
return retStruct;