% '/////////////////////////////////////////////////////////////////// '/// FILE: calender/event_maint.asp '/// '/// PURPOSE: handles all funcitons related to creating and '/// editing a event record. '/// '/// HISTORY: '///--------------------------------------------------------------- '/// 01.11.2002 HEPFERM Created. '/////////////////////////////////////////////////////////////////// ' declare varables. dim objRSTemp Dim lb_validData Dim ll_return Dim event_id Dim ls_name Dim li_start_dt_month Dim li_start_dt_day Dim li_start_dt_year Dim li_start_time_hour Dim li_start_time_minute Dim ls_start_time_half Dim li_end_dt_month Dim li_end_dt_day Dim li_end_dt_year Dim li_end_time_hour Dim li_end_time_minute Dim ls_end_time_half Dim ls_location Dim ls_description Dim ll_temp Dim lt_time Dim ld_start_dt Dim ld_end_dt ' start writing the html document With Response .Write "" .Write "
" .Write ""
.Write "Return to the Calender"
.Write ""
.Write ""
.End ' all done, bye bye.
Else
.Write "An error occurred while saving the record
"
.Write "Please make note of the error message and contact
"
.Write "the webmaster." & "
Error # " & ll_return & "
"
'End ' we'll let them have another go at it.
End If
End With
End If
' If were here, then we failed validation or had db errors.
' load the form data back into the form variables so we can try again.
With Request
event_id = .Form("event_id")
ls_name = .Form("ls_name")
li_start_dt_month = .Form("li_start_dt_month")
li_start_dt_day = .Form("li_start_dt_day")
li_start_dt_year = .Form("li_start_dt_year")
li_start_time_hour = .Form("li_start_time_hour")
li_start_time_minute = .Form("li_start_time_minute")
ls_start_time_half = .Form("ls_start_time_half")
li_end_dt_month = .Form("li_end_dt_month")
li_end_dt_day = .Form("li_end_dt_day")
li_end_dt_year = .Form("li_end_dt_year")
li_end_time_hour = .Form("li_end_time_hour")
li_end_time_minute = .Form("li_end_time_minute" )
ls_end_time_half = .Form("ls_end_time_half")
ls_location = .Form("ls_location")
ls_description = .Form("ls_description")
End With
Else ' try to pull up the record from the UID
event_id=request("event_id") ' get the event id
If event_id <> "" Then ' pull up the event_id's record
' get the record from the database
open_calender_connection() ' open the database object
Set objRSTemp = Server.CreateObject("ADODB.Recordset") ' create the object
ls_sql="select * from calender_event where event_id=" & event_id
set objRSTemp=connCalender.execute(ls_sql) ' execute the querry
' put the recordset's values into local variables
If not objRSTemp.EOF Then
' read in the strings
ls_name = objRSTemp( "name" )
ls_location = objRSTemp( "location" )
ls_description = objRSTemp( "description" )
' split the start date up into an array
ld_start_dt = objRSTemp( "start_dt" )
li_start_dt_month = month( ld_start_dt )
li_start_dt_day = day( ld_start_dt )
li_start_dt_year = year( ld_start_dt )
' split the start time up into variables
lt_time = objRSTemp( "start_time" )
li_start_time_hour = hour( lt_time )
If li_start_time_hour > 12 then
li_start_time_hour = li_start_time_hour - 12
End If
li_start_time_minute = minute( lt_time )
If hour( lt_time ) < 12 then
ls_start_time_half = "AM"
Else
ls_start_time_half = "PM"
End If
' split the end date up into an array
ld_end_dt = objRSTemp( "end_dt" )
li_end_dt_month = month( ld_end_dt )
li_end_dt_day = day( ld_end_dt )
li_end_dt_year = year( ld_end_dt )
' split the end time up into variables
lt_time = objRSTemp( "end_time" )
li_end_time_hour = hour( lt_time )
If li_end_time_hour > 12 then
li_end_time_hour = li_end_time_hour - 12
End If
li_end_time_minute = minute( lt_time )
If hour( lt_time ) < 12 then
ls_end_time_half = "AM"
Else
ls_end_time_half = "PM"
End If
End If
Set objRSTemp = nothing
close_calender_connection()
End if
End If
' Write out the form
With Response
' start writing out the form
.Write "