%@ Page debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Drawing" %>
<%
Dim calendar_root_path As String = Server.MapPath(".\")
Dim calendar_db_path As String = ADXCalendar.AdminFunctions.GetProperty(ADXCalendar.AdminFunctions.CalendarProperty.DataConn_ConnectionString, calendar_root_path)
Dim objLog As New ADXCalendar.ADXTrafficStats(calendar_db_path)
objLog.LogPageView(ADXCalendar.ADXTrafficStats.PageNameEnum.EventListSyndicator, DateTime.Now())
objLog.DisposeADXTrafficStatsClass()
objLog = Nothing
adx_res_reader = Application("ADXResourceReader")
ViewEntireMonth = adx_res_reader.GetResource(ADXCalendar.ADXResource.CalendarObject.Syndication, "ViewEntireMonth")
If Not IsNothing(Request.QueryString("category")) And Request.QueryString("category") <> "" Then
catStr = "?category=" & Request.QueryString("category")
Else
catStr = "?category="
End If
If Not IsNothing(Request.QueryString("location")) Then
locStr = "&location=" & Request.QueryString("location")
Else
locStr = ""
End If
If Not IsNothing(Request.QueryString("type")) And Request.QueryString("type") <> "" Then
typeStr = "&type=" & Request.QueryString("type")
End If
If Not IsNothing(Request.QueryString("winmode")) And Request.QueryString("winmode") <> "" Then
winMode = Request.QueryString("winmode")
End If
If Not IsNothing(Request.QueryString("view")) Then
viewStr = "&view=" & Request.QueryString("view")
End If
'Use the query string parameters of month and year unless they are not there
'or they are invalid. If so, use the current month and year
If Not IsNothing(Request.QueryString("month")) And Not IsNothing(Request.QueryString("year")) Then
'This means we are drawing a specific month
dMonth = Convert.ToInt32(Request.QueryString("month"))
dYear = Convert.ToInt32(Request.QueryString("year"))
'Check the month and year params... if cool, use em. If not. use current month/year
Try
Dim dt As New DateTime(dYear, dMonth, 1)
Catch ex As Exception
dMonth = DateTime.Now.Month
dYear = DateTime.Now.Year
End Try
htmlOut = Me.DrowMonthCalendar(dMonth, dYear)
Else
'This means we are not drawing one specific month, but starting on a date and drawing a set number of months
If Not IsNothing(Request.QueryString("numberofmonths")) Then
Try
Dim number As Integer = Convert.ToInt32(Request.QueryString("numberofmonths"))
Dim sd As DateTime
If Date.TryParse(Request.QueryString.Item("startingon"), sd) = False Then
'There was no start date passed default to right now
sd = Date.Now
End If
If Request.QueryString.Item("nextmonth") = "true" Then
'Start rending grids, with the first one being next month
sd = Date.Now.AddMonths(1)
End If
For cnt As Integer = 1 To number
htmlOut &= Me.DrowMonthCalendar(sd.Month, sd.Year) & "
"
sd = sd.AddMonths(1)
Next
'Remove the extra BR if it is there.
If htmlOut.EndsWith("
") Then
htmlOut = htmlOut.Substring(0, htmlOut.Length - 4)
End If
Catch ex As Exception
'If any boo boo, just do the current month
dMonth = DateTime.Now.Month
dYear = DateTime.Now.Year
htmlOut = ""
htmlOut = Me.DrowMonthCalendar(dMonth, dYear)
End Try
Else
'this means we received no parameters
dMonth = DateTime.Now.Month
dYear = DateTime.Now.Year
htmlOut = Me.DrowMonthCalendar(dMonth, dYear)
End If
End If
Response.Write(("document.write ('" & Replace(htmlOut, "'", "'") & "');"))
Response.End()
%>