File: D:/HostingSpaces/EBos/ellen-paragnost.nl/wwwroot/asp/includes/ac_calendar.asp
<%
Class cls_Calendar
public iId,sName,dCreatedTS,iCustomerID,secure,sTemplate,sFontFamily,sBGColor
sub class_initialize
secure=true
end sub
public function pick(id)
if isNumeriek(id) then
dim sql
sql="select * from tblCalendar where iId=" & left(id,9)
if secure then
sql=sql& " and iCustomerID=" & cId
end if
set rs=db.execute(sql)
if not rs.eof then
iId = rs("iId")
sName = rs("sName")
dCreatedTS = rs("dCreatedTS")
iCustomerID = rs("iCustomerID")
sFontFamily = rs("sFontFamily")
sBGColor = rs("sBGColor")
end if
set rs=nothing
end if
end function
public function check()
check=true
if isLeeg(sName) then
message.addError("err_mandatory")
check=false
end if
end function
public function save()
save=check
if not save then exit function
set rs = db.GetDynamicRS
if isLeeg(iId) then
rs.Open "select * from tblCalendar where 1=2"
rs.AddNew
rs("dCreatedTS")=now()
else
rs.Open "select * from tblCalendar where iId="& iId
end if
rs("sName") = sName
rs("sBGColor") = sBGColor
rs("sFontFamily") = sFontFamily
rs("iCustomerID") = cId
rs.Update
iId = convertGetal(rs("iId"))
rs.close
Set rs = nothing
end function
public function delete
set rs=db.execute("delete from tblCalendarBooking where iCalendarID="& convertGetal(iId))
set rs=nothing
set rs=db.execute("delete from tblCalendar where iId="& convertGetal(iId))
set rs=nothing
end function
public function mycals
set mycals=server.createObject("scripting.dictionary")
dim rs,ccal
set rs=db.execute("select iId from tblCalendar where iCustomerID="& cId & " order by sName")
while not rs.eof
set ccal=new cls_calendar
ccal.pick(rs(0))
mycals.Add ccal.iId,ccal
set ccal=nothing
rs.movenext
wend
set rs=nothing
end function
public function calenderlist(selected)
dim copyCals,cc
set copyCals=myCals
for each cc in copyCals
calenderlist=calenderlist& "<option value=""" & cc & """"
if convertStr(selected)=convertStr(cc) then
calenderlist=calenderlist& " selected=""selected"""
end if
calenderlist=calenderlist & ">" & quotrep(copyCals(cc).sName) & "</option>"
next
set copyCals=nothing
end function
public function bookings
set bookings=server.createobject("scripting.dictionary")
dim rs, sql,booking
sql="select iId from tblCalendarBooking where iCalendarID="& convertGetal(iId) & " order by dStartdate desc"
set rs=db.execute(sql)
while not rs.eof
set booking=new cls_calendarbooking
booking.pick(rs(0))
bookings.add booking.iId, booking
set booking=nothing
rs.movenext
wend
set rs=nothing
end function
end Class
%>