% Dim CalendarHeader, CalendarRows Dim Style_ClickForEdit, Style_HowToEdit, Style_HowToEditTop Dim Style_AddDate, Style_EditDate Dim nMonth, nMonthStr, MonthArray, bLoggedIn bLoggedIn = IsLoggedIn() If bLoggedIn Then Style_ClickForEdit = " style=""display:none""" Style_HowToEdit = " style=""display:block""" Style_HowToEditTop = " style=""display:block""" Else Style_ClickForEdit = " style=""display:block""" Style_HowToEdit = " style=""display:none""" End If Style_AddDate = " style=""display:block""" Style_EditDate = " style=""display:none""" Select Case Request.Form("action") Case "Add" AddTourDate Case "Edit" If Request.Form("Go") Then EditTourDate Else SelectTourDate Style_AddDate = " style=""display:none""" Style_EditDate = " style=""display:block""" Style_HowToEditTop = " style=""display:none""" End If Case "Delete" DeleteTourDate End Select CalendarHeader = GetTableHeader() CalendarRows = GetTourRowsHTML() MonthArray = Array("January", "February", "March", "April", "May", "June", "July", "August", _ "September", "October", "November", "December") nMonth = Month(Now) Mod 12 ' 0 based nMonthStr = MonthArray(nMonth) nMonth = nMonth + 1 ' --------------------------------------------- Check Login Status --------------------------------------------- Function IsLoggedIn ' makes logging in unnecessary IsLoggedIn = True '''''''''''''''''''''''''''''''''''''''''' ' If Session("UserName") = "demo" Then ' IsLoggedIn = True ' Else ' IsLoggedIn = False ' End If '''''''''''''''''''''''''''''''''''''''''' End Function ' ------------------------------- Insert a new tour date into the calendar ------------------------------------- Function GetStartTime GetStartTime = Request.Form("StartHour") & ":" & Request.Form("StartMin") & " " & Request.Form("AMPM") End Function Sub AddTourDate Dim dbConn, strSQL, lngRecs ''' On Error Resume Next Set dbConn = GetConnection() ShowADOErrors dbConn strSQL = "INSERT INTO Tour VALUES (" strSQL = strSQL & "'" & Session.SessionID & "'," strSQL = strSQL & "'" & SQLEncode(Request.Form("MonthField")) & "'," strSQL = strSQL & "'" & SQLEncode(Request.Form("DayField")) & "'," strSQL = strSQL & "'" & SQLEncode(GetStartTime()) & "'," strSQL = strSQL & "'" & SQLEncode(Request.Form("Venue")) & "'," strSQL = strSQL & "'" & SQLEncode(Request.Form("StreetAddress")) & "'," strSQL = strSQL & "'" & SQLEncode(Request.Form("City")) & "'," strSQL = strSQL & "'" & SQLEncode(Request.Form("State")) & "'," strSQL = strSQL & "'" & SQLEncode(Request.Form("VenueLink")) & "')" dbConn.Execute strSQL, lngRecs, adCmdText + adExecuteNoRecords ShowADOErrors dbConn dbConn.Close Set dbConn = Nothing End Sub ' ------------------------------------ Get the info for a tour date in the database ----------------------------------- Sub SelectTourDate Dim strSQL, rs, field Dim tempArray1, tempArray2 strSQL = "SELECT * From Tour WHERE BandId = '" & Request.Form("BandId") & "' AND " & _ "MonthField= " & Request.Form("MonthField") & " AND " & _ "DayField = " & Request.Form("DayField") & " AND " & _ "StartTime = CDate('" & Request.Form("StartTime") & "')" ' Query the database Set dbConn = GetConnection() ShowADOErrors dbConn Set rs = dbConn.Execute(strSQL) ShowADOErrors dbConn ' Save the row in the session variable If Not rs.EOF Then For Each field In rs.Fields Session("fld_" & field.Name) = field.Value If field.Name = "StartTime" Then tempArray1 = Split(field.Value, " ") Session("fld_AMPM") = tempArray1(1) tempArray2 = Split(tempArray1(0), ":") Session("fld_StartHour") = tempArray2(0) Session("fld_StartMin") = tempArray2(1) End If Next End If Set rs = Nothing dbConn.Close Set dbConn = Nothing End Sub ' ------------------------------------ Edit a tour date in the database ----------------------------------- Sub EditTourDate Dim strSQL, field, strTime strSQL = "UPDATE Tour SET " strSQL = strSQL & "MonthField='" & SQLEncode(Request.Form("MonthField")) & "', " strSQL = strSQL & "DayField='" & SQLEncode(Request.Form("DayField")) & "', " strSQL = strSQL & "StartTime='" & SQLEncode(GetStartTime()) & "', " strSQL = strSQL & "Venue='" & SQLEncode(Request.Form("Venue")) & "', " strSQL = strSQL & "StreetAddress='" & SQLEncode(Request.Form("StreetAddress")) & "', " strSQL = strSQL & "City='" & SQLEncode(Request.Form("City")) & "', " strSQL = strSQL & "State='" & SQLEncode(Request.Form("State")) & "', " strSQL = strSQL & "VenueLink='" & SQLEncode(Request.Form("VenueLink")) & "'" strSQL = strSQL & " WHERE BandId='" & Request.Form("old_BandId") & "' AND " & _ "MonthField = " & Request.Form("old_MonthField") & " AND " & _ "DayField = " & Request.Form("old_DayField") & " AND " & _ "StartTime = CDate('" & Request.Form("old_StartTime") & "')" ' Query the database Set dbConn = GetConnection() ShowADOErrors dbConn dbConn.Execute(strSQL) ShowADOErrors dbConn dbConn.Close Set dbConn = Nothing End Sub ' ----------------------------------------- Delete a tour date from the database --------------------------------- Sub DeleteTourDate Dim strSQL strSQL = "DELETE From Tour WHERE BandId = '" & Request.Form("BandId") & "' AND " & _ "MonthField= " & Request.Form("MonthField") & " AND " & _ "DayField = " & Request.Form("DayField") & " AND " & _ "StartTime = CDate('" & Request.Form("StartTime") & "')" ' Send the delete query to the database Set dbConn = GetConnection() ShowADOErrors dbConn Set rs = dbConn.Execute(strSQL) ShowADOErrors dbConn dbConn.Close Set dbConn = Nothing End Sub ' ------------------------------------------------ Lookup state name --------------------------------------------- Function LookupState(code) Select Case code Case "AL" LookupState = "Alabama" Case "AK" LookupState = "Alaska" Case "AZ" LookupState = "Arizona" Case "AR" LookupState = "Arkansas" Case "CA" LookupState = "California" Case "CO" LookupState = "Colorado" Case "CT" LookupState = "Connecticut" Case "DE" LookupState = "Delaware" Case "DC" LookupState = "District of Columbia" Case "FL" LookupState = "Florida" Case "GA" LookupState = "Georgia" Case "GU" LookupState = "Guam" Case "HI" LookupState = "Hawaii" Case "ID" LookupState = "Idaho" Case "IL" LookupState = "Illinois" Case "IN" LookupState = "Indiana" Case "IA" LookupState = "Iowa" Case "KS" LookupState = "Kansas" Case "KY" LookupState = "Kentucky" Case "LA" LookupState = "Louisiana" Case "ME" LookupState = "Maine" Case "MD" LookupState = "Maryland" Case "MA" LookupState = "Massachusetts" Case "MI" LookupState = "Michigan" Case "MN" LookupState = "Minnesota" Case "MS" LookupState = "Mississippi" Case "MO" LookupState = "Missouri" Case "MT" LookupState = "Montana" Case "NE" LookupState = "Nebraska" Case "NV" LookupState = "Nevada" Case "NH" LookupState = "New Hampshire" Case "NJ" LookupState = "New Jersey" Case "NM" LookupState = "New Mexico" Case "NY" LookupState = "New York" Case "NC" LookupState = "North Carolina" Case "ND" LookupState = "North Dakota" Case "OH" LookupState = "Ohio" Case "OK" LookupState = "Oklahoma" Case "OR" LookupState = "Oregon" Case "PA" LookupState = "Pennsylvania" Case "RI" LookupState = "Rhode Island" Case "SC" LookupState = "South Carolina" Case "SD" LookupState = "South Dakota" Case "TN" LookupState = "Tennessee" Case "TX" LookupState = "Texas" Case "UT" LookupState = "Utah" Case "VT" LookupState = "Vermont" Case "VA" LookupState = "Virginia" Case "WA" LookupState = "Washington" Case "WV" LookupState = "West Virginia" Case "WI" LookupState = "Wisconsin" Case "WY" LookupState = "Wyoming" Case Else LookupState = "" End Select End Function ' --------------------------------------------- HTML table header rows ------------------------------------------- Function GetTableHeader GetTableHeader = "" & _ "
Address
" & _ "
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||