%@ Language=VBScript%>
<%Response.Buffer = True%>
<%
'Begin server-side code
'we must get the committee ID from the request object
Dim ComID, strSQL
If request.QueryString("thisCom") then
ComID = request.QueryString("thisCom")
Else
Response.Write("There was with the committee id. Please contact the system administrator or try again.")
Response.End
end if
'if we're still here, all is well
'strSQL = "DELETE * FROM VRES WHERE ComID = " + Cstr(ComID)
'PerformExecute(strSQL) 'clean out last year's vote results
ClearOldResults ComID
set thisrs = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM VRES, FACULTY WHERE VRES.UserID = FACULTY.USER_ID AND ComID = " + CStr(ComID) + " AND VoteDate <= " + Cstr(Year(Date())) + " ORDER BY VoteDay"
StHeader
PerformQuery strSQL, thisrs
Response.End
Function PerformQuery(mySQL, thisrs)%>
<%
'set thisrs = Server.CreateObject("ADODB.Recordset")
dbNVS.Open
thisrs.ActiveConnection = dbNVS
thisrs.Open mySQL, dbNVS
If not thisrs.EOF then
While NOT thisrs.EOF
%>| <%=CStr(thisrs.Fields("VoteDay").Value) + " -- " + CStr(thisrs.Fields("L_NAME").Value) + ", " + CStr(thisrs.Fields("F_NAME").Value) + " -- " + CStr(thisrs.Fields("Votes"))%> |
<%thisrs.MoveNext
Wend
%><%
else
%>| There are no committee results to display |
<%
end if
set thisrs = Nothing
dbNVS.Close
PerformQuery = True
End Function
Function PerformExecute(mystr)%>
<%
PerformExecute = false
Dim CmdObj
Dim message
dbNVS.Open
Set CmdObj = Server.CreateObject("ADODB.Command")
CmdObj.ActiveConnection = dbNVS
CmdObj.CommandText = Cstr(mystr)
CmdObj.Execute
message = "Error in performing committee maintenace. Please contact system administrator
"
'error checking
If Err.Number > 0 then
dbNVS.rollback
Response.Clear
Response.Redirect "error.asp?" + Server.URLEncode(message)
Response.End
end if
dbNVS.Close
Set CmdObj = Nothing
Set dbNVS = Nothing
PerformExecute = true
End Function
Function StHeader
Dim mystr
mystr = ""
Response.Write(mystr)
mystr = "Election Results: |
Below are the election results for the specified committee for the last year. These results will be overwritten when the next election for this committee arrives.
Election Date -- Faculty Name -- Recorded Number of Votes
|
"
Response.Write(mystr)
StHeader = true
End Function
Function ClearOldResults(MyCom)%>
<%
ClearOldResults = false
Dim CmdObj, strSQL, dttoday
dttoday = Date
strSQL = "DELETE * FROM VRES WHERE VoteDate < " + CStr(Year(dttoday)) + " AND ComID = " + CStr(MyCom)
dbNVS.Open
Set CmdObj = Server.CreateObject("ADODB.Command")
CmdObj.ActiveConnection = dbNVS
CmdObj.CommandText = strSQL
cmdObj.Execute
message = "Error in deleting old election results. Please contact system administrator
"
'error checking
If Err.Number <> 0 then
dbNVS.rollback
Response.Clear
Response.Redirect "error.asp?" + Server.URLEncode(message)
Response.End
end if
dbNVS.Close
set CmdObj = Nothing
Set dbNVS = Nothing
ClearOldResults = true
End Function
%>