<%@ Language=VBScript %> <% Response.Buffer = True %> <% If ValidCount() Then AccDecBtn Response.Clear Response.Redirect "accdec.asp" Response.End End If %> <% Function AccDecBtn() '********************************************** ' Function Changes the status of a nomination to accepted ' or declined... '********************************************** 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 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 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 '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 '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %>