%@ Language=VBScript %>
<% Response.Buffer = True %>
<%
If ValidCount() Then
ChangeToUndecided
If Request.Form("clickedself") <> "True" Then
AccDecBtn
End If
Response.Clear
Response.Redirect "mainmenu.asp"
Response.End
End If
%>
<%
Function ChangeToUndecided()
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Bennett Giesler
' Deletes the A/D entries in the database
' NOTE That "U" in the database means nominated.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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("selToDecide").Count
'Response.Write "Value = " + Cstr(Request.Form("selToDecide")(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("selToDecide")(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 AccDecBtn()
'**********************************************
' Function Changes the status of a nomination to accepted
' or declined...
'**********************************************
' BENNETT GIESLER added "U" support to this function, simply added the elseif statement below.
On Error Resume Next
Dim strSQL
Dim strstat
Dim message
strstat = ""
If Request.Form("btnAccept") = "Accept" Then '*****Accept Button
strstat = "A"
Else If Request.Form("btnDecline") = "Decline" Then '*****Decline Button
strstat = "D"
Else If Request.Form("btnUndecided") = "Undecided" Then 'Undecided Button
strstat = "U"
Else
message = "You have clicked an invalid button.
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
End If
End if
End If
strCOMIDs = ""
For i = 1 to Request.Form("selToDecide").Count
Response.Write "Value = " + Cstr(Request.Form("selToDecide")(i)) + "
"
If Clng(Request.Form("selToDecide")(i)) <> 0 then
'***********************************
If strstat = "A" Then
strSQL = "Insert Into [Nominated] ([USER_ID], [COMID], [NOM_ID], [STATUS]) "
strSQL = strSQL + "VALUES( " + Cstr(Session.Contents("USER_ID")) + ", "
strSQL = strSQL + Cstr(Request.Form("selToDecide")(i)) + ", "
strSQL = strSQL + Cstr(Session.Contents("USER_ID")) + ", 'A')"
Else 'gonna do a decline
strSQL = "Insert Into [Nominated] ([USER_ID], [COMID], [NOM_ID], [STATUS]) "
strSQL = strSQL + "VALUES( " + Cstr(Session.Contents("USER_ID")) + ", "
strSQL = strSQL + Cstr(Request.Form("selToDecide")(i)) + ", "
strSQL = strSQL + Cstr(Session.Contents("USER_ID")) + ", 'D')"
End If
IF strstat = "U" Then
' Bennett Giesler 3-1-2006
' We Do Nothing, because it already deleted at the top
End If
'NOW we fire the database
dbNVS.Open
Set rsNom = Server.CreateObject("ADODB.Command")
rsNom.ActiveConnection = dbNVS
rsNom.CommandText = strSQL
dbNVS.BeginTrans
rsNom.Execute
If Err.Number <> 0 then
dbNVS.RollBack
message = "An error has occurred in the AcceptDeclineClick() 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
End if
dbNVS.CommitTrans
'clean up objects...
dbNVS.Close
'et dbNVS = Nothing
Set rsNom = Nothing
End If
Next
End Function
%>
<%
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Function ValidCount()
ValidCount = False
Dim Count
Dim message
Count = 0
For i = 1 To Request.Form("selToDecide").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("selToDecide")(i) <> "0" then
Count = Count + 1
End If
Next
If Clng(Count) <= 0 then
message = "Please select a committee you wish to accept or decline.
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
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%>