Count Lines in Pages

Contents of Page: DraftBoardSetUp.asp Number of Lines: 160 Last Modified: 3/20/2024 9:29:18 AM
0001: <% @Language = "VBScript" %>
0002: <!-- #include FILE="include/adovbs.inc" -->
0003: <!-- #include FILE="include/constants.inc" -->
0004: <%
0005: '
0006: ' Remove Old Results
0007: '
0008: GroupID = Request.Querystring("GroupID")
0009:  
0010:    Set cn = Server.CreateObject("ADODB.Connection")
0011: 	cn.Open conn
0012: 	sqlString = "DELETE FROM mmdraftpicks " & _
0013: 							"WHERE Season = " & season & _
0014: 							" AND GroupID = '" & GroupID & "'"
0015: 
0016: Response.Write("<BR>" & Sqlstring)
0017: 	cn.Execute sqlString, lngRecs, adExecuteNoRecords
0018: 	cn.Close
0019: 	Set cn = Nothing
0020: 
0021:    Set cn = Server.CreateObject("ADODB.Connection")
0022: 	cn.Open conn
0023: 	sqlString = "DELETE FROM mmdraftorder " & _
0024: 							"WHERE Season = " & season & _
0025: 							" AND GroupID = '" & GroupID & "'"
0026: 
0027: Response.Write("<BR>" & Sqlstring)
0028: 	cn.Execute sqlString, lngRecs, adExecuteNoRecords
0029: 	cn.Close
0030: 	Set cn = Nothing
0031: 
0032: 
0033: Set rsTeams = Server.CreateObject("ADODB.Recordset")
0034: 	sqlString = "SELECT * FROM mmresults WHERE Season = " & season
0035: 	
0036: Response.Write("<BR>" & Sqlstring)	
0037: 	rsTeams.Open sqlString, conn, adOpenStatic, adLockReadOnly, adCmdText
0038: 
0039: 	Do Until RsTeams.EOF
0040: 	
0041: ID = rsTeams("ID").Value
0042: 
0043: Seed = Right(ID,2)
0044: Seed = CInt(Seed)
0045: 
0046:  Set rsResults = Server.CreateObject("ADODB.Recordset")
0047: 
0048: 
0049: 		rsResults.Open "mmdraftpicks", conn, adOpenDynamic, adLockOptimistic, adCmdTable
0050: 		rsResults.AddNew
0051: 		rsResults("Season").Value = season
0052: 		rsResults("GroupID").Value = GroupID
0053: 		rsResults("RegNumber").Value = "0"		
0054: 	    rsResults("TeamName").Value = rsTeams("Name").Value
0055:        rsResults("TeamID").Value = ID
0056:        rsResults("Seed").Value = Seed
0057: 
0058:        rsResults.Update
0059:        rsResults.Close
0060:        Set rsResults = Nothing
0061: 
0062:    rsTeams.MoveNext
0063:    Loop
0064: 	rsTeams.Close
0065: 	Set rsTeams = Nothing
0066: 
0067: 
0068: '===================================================================================
0069: 
0070: 
0071: Dim Members(10)
0072: Dim Picks(200)
0073: Participants = 0
0074: 
0075: 		Set rsc = Server.CreateObject("ADODB.Recordset")
0076: 
0077:     	sqlString = "SELECT * FROM mmdraft WHERE GroupID = '" & GroupID & "' AND Season = " & season & " ORDER BY DraftOrder"
0078: 	Response.Write("<BR>" & Sqlstring)					
0079: 		rsc.Open sqlString, conn, adOpenStatic, adLockReadOnly, adCmdText
0080: 
0081: 		Do Until rsc.EOF
0082: 
0083: 			RegNumber = rsc("RegNumber").Value
0084: 			Participants = Participants + 1
0085: 			Members(Participants) = RegNumber
0086: 	    
0087: 		rsc.MoveNext
0088: 		Loop
0089: 
0090: 		rsc.Close
0091: 		Set rsc = Nothing
0092: 
0093: 		Response.Write("<br>=" & Participants)
0094: 
0095: 
0096: 		Rounds = 64 / Participants
0097: 		Rounds = Rounds - .5
0098: 		Rounds = CInt(Rounds)
0099: 
0100:         Pick = 0
0101: 		For r = 1 To Rounds
0102:           Even = r Mod 2
0103: 		  If Even = 1 Then
0104: 			For p = 1 To Participants
0105: 				Pick = Pick + 1
0106: 				Picks(Pick) = Members(p)
0107: 			Next
0108: 		  Else
0109: 			For p = Participants To 1 Step -1
0110: 				Pick = Pick + 1
0111: 				Picks(Pick) = Members(p)
0112: 			Next
0113: 		  End If
0114: 		Next
0115: 		Response.Write("<br>Rounds=" & Rounds)
0116: 		For I = 1 To 64
0117: 		Response.Write("<br>" & I & " = " & Picks(I))
0118: 
0119:         If Picks(I) <> "" Then
0120:  Set rsd = Server.CreateObject("ADODB.Recordset")
0121: 
0122: 
0123: 		rsd.Open "mmdraftorder", conn, adOpenDynamic, adLockOptimistic, adCmdTable
0124: 		rsd.AddNew
0125: 		rsd("Season").Value = season
0126: 		rsd("GroupID").Value = GroupID
0127: 	    rsd("DraftPick").Value = I
0128:        rsd("RegNumber").Value = Picks(I)
0129: 
0130:        rsd.Update
0131:        rsd.Close
0132:        Set rsd = Nothing
0133: 
0134: 	   End IF
0135: 
0136: 	   		Next
0137: 
0138: 
0139: 
0140: '===================================================================================
0141: 
0142: 	Response.Write("Draft Board for GroupID '" & GroupID & "' Reset")
0143: 
0144:  Response.Redirect("DraftSelectPicks.asp?GroupID=" & GroupID)
0145: 
0146: %>
0147: 
0148: 
0149: <html>
0150: 
0151: <head>
0152: <title>Create Results Table</title>
0153: <meta name="GENERATOR" content="Microsoft FrontPage 3.0">
0154: </head>
0155: <table>
0156: 	<tr><td class="norm">&nbsp;<br><br><br><BIG><BIG><a href="displaymenu.asp?parent=90"><b>Return to Menu</b></a><br><br>
0157: </table>
0158: <body>
0159: </body>
0160: </html>