%@ Language=VBScript %>
<% Response.Buffer = True %>
<%
If ValidCount Then
ChangeToUndecided
Response.Clear
Response.Redirect "accdec.asp"
Response.End
End If
%>
<%
Function ChangeToUndecided()
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' FUNCTION CHANGES THE STATUS OF A USER TO 'U' FOR
' EACH COMMITTEE THEY HAVE SELECTED...
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Error Resume Next
Dim strSQL
Dim message
set fso = Server.CreateObject("scripting.FileSystemObject")
set myFile = fso.OpenTextFile("C:\test.txt", 8)
strCOMIDs = ""
For i = 1 To Request.Form("selDecided").Count
'Response.Write "Value = " + Cstr(Request.Form("selDecided")(i)) + "
"
strSQL = "Delete From [Nominated] WHERE [USER_ID] = "
strSQL = strSQL + Cstr(Session.Contents("USER_ID")) + " AND [NOM_ID] = "
strSQL = strSQL + Cstr(Session.Contents("USER_ID")) + " AND [COMID] = "
strSQL = strSQL + Cstr(Request.Form("selDecided")(i))
dbNVS.Open
Set rsNom = Server.CreateObject("ADODB.Command")
rsNom.ActiveConnection = dbNVS
rsNom.CommandText = strSQL
dbNVS.BeginTrans
rsNom.Execute
myFile.WriteLine(NOW() & " accdec " & strSQL)
If Err.Number <> 0 then
dbNVS.RollBack
message = "System Error!
An error has occurred in the ChangeToUndecided() function.
Please contact the Faculty Nominations and Voting Committee to resolve this problem.
Please click the BACK button."
Response.Clear
Response.Redirect "error.asp?mess=" + Server.URLEncode(message)
Response.End
myFile.WriteLine(NOW() & " " & message)
End if
dbNVS.CommitTrans
'clean up objects...
dbNVS.Close
'Set dbNVS = Nothing
Set rsNom = Nothing
Next
End Function
%>
<%
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Function ValidCount()
ValidCount = False
Dim Count
Dim message
Count = 0
For i = 1 To Request.Form("selDecided").Count
'This is in case the user selected some values that
'do not mean anything, like the empty space or the text "Nominees"
If Request.Form("selDecided")(i) <> "0" then
Count = Count + 1
End If
Next
If Clng(Count) <= 0 then
message = "Please select a committee you wish to change back to 'undecided'.
Please click the BACK button to return to the accept/decline nominations screen."
Response.Clear
Response.Redirect "error.asp?mess=" + Server.URLEncode(message)
Response.End
End If
ValidCount = True
End Function
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%>