Count Lines in Pages

Contents of Page: biggestlosercalc.asp Number of Lines: 336 Last Modified: 4/19/2025 10:03:52 AM
0001: <% @Language = "VBScript" %>
0002: 
0003: <!-- #include FILE="include/adovbs.inc" -->
0004: <!-- #include FILE="include/constants.inc" -->
0005: 
0006: <%
0007: 
0008: 	yr = Request.QueryString("yr")
0009: 	If yr = "" Then yr = season
0010: 
0011: 	Function GetPoints(fname, results)
0012: 		Select Case Left(fname, 1)
0013: 				Case "A"
0014: 					Bracket = 1
0015: 				Case "B"
0016: 					Bracket = 2
0017: 				Case "C"
0018: 					Bracket = 3
0019: 				Case "D"
0020: 					Bracket = 4
0021: 			End Select
0022: 			Seed = Int(Right(fname,2))
0023:             GetPoints = results(bracket,seed)
0024: 			If IsNull(GetPoints) = True Then
0025: 			GetPoints = 0
0026: 			End If
0027: 			TotalStillIn = TotalStillIn + StillIn(bracket,seed)
0028: '			Response.Write("<br>Bracket=" & Bracket & " Seed=" & Seed & " Points=" & GetPoints & " StillIn= " & StillIn(bracket,seed))
0029: 	End Function
0030: 
0031: TolStillIn = 0
0032: 		Set rst = Server.CreateObject("ADODB.Recordset")
0033: 	sqlString = "SELECT * FROM mmTeams WHERE Season = '" & yr & "' "
0034: ' Response.Write(sqlString)
0035: 	rst.Open sqlString, conn, adOpenStatic, adLockReadOnly, adCmdText
0036: 
0037:         Dim Scores(64,6)
0038: 		Dim results(4,16)
0039: 		Dim StillIn(4,16)
0040: 		Set rsResults = Server.CreateObject("ADODB.Recordset")
0041: 		sqlString = "SELECT * FROM mmResults WHERE Season = " & yr
0042: 		rsResults.Open sqlString, conn, adOpenDynamic, adLockOptimistic, adCmdText
0043: 		Do Until rsResults.EOF
0044: 			Select Case Left(rsResults("ID").Value, 1)
0045: 				Case "A"
0046: 					Bracket = 1
0047: 				Case "B"
0048: 					Bracket = 2
0049: 				Case "C"
0050: 					Bracket = 3
0051: 				Case "D"
0052: 					Bracket = 4
0053: 			End Select
0054: 			seed = Int(Right(rsResults("ID").Value, 2))
0055: 			RunningScore = RunningScore + rsResults("F64Score").Value
0056: '			Response.Write("<br>F64Score=" & Cint(rsResults("F64Score").Value) & " RC=" & RunningScore & " bracket=" & bracket & " seed=" & seed )
0057: 			results(bracket, seed) = CStr(rsResults("F64Score").Value) + rsResults("F32Score").Value + rsResults("F16Score").Value + rsResults("F8Score").Value + rsResults("F4Score").Value + rsResults("F2Score").Value  '+ rsResults("F1Score").Value
0058: 			If rsResults("F1Pts") = 99 Then
0059: 			   StillIn(Bracket,seed) = 0
0060: 			Else
0061: 			   StillIn(Bracket,seed) = 1
0062: 			End If
0063: 
0064: 			Select Case Left(rsResults("ID").Value, 1)
0065: 				Case "A"
0066: 					pos = 0
0067: 				Case "B"
0068: 					pos = 16
0069: 				Case "C"
0070: 					pos = 32
0071: 				Case "D"
0072: 					pos = 48
0073: 			End Select
0074: 			pos = pos + Int(Right(rsResults("ID").Value, 2))
0075: 			Scores(pos,1) = rsResults("F64Score")	
0076: 			Scores(pos,2) = rsResults("F32Score")
0077: 			Scores(pos,3) = rsResults("F16Score")
0078: 			Scores(pos,4) = rsResults("F8Score")
0079: 			Scores(pos,5) = rsResults("F4Score")
0080: 			Scores(pos,6) = rsResults("F2Score")
0081: 
0082: 
0083: 			rsResults.MoveNext
0084: 		Loop
0085: 		rsResults.Close
0086: 		Set rsResults = Nothing
0087: 		
0088:    pos = 0
0089: 
0090:    
0091: 	Dim Seeds(16)
0092: 	Seeds(1) = "01"
0093: 	Seeds(2) = "02"
0094: 	Seeds(3) = "03"
0095: 	Seeds(4) = "04"
0096: 	Seeds(5) = "05"
0097: 	Seeds(6) = "06"
0098: 	Seeds(7) = "07"
0099: 	Seeds(8) = "08"
0100: 	Seeds(9) = "09"
0101: 	Seeds(10) = "10"
0102: 	Seeds(11) = "11"
0103: 	Seeds(12) = "12"
0104: 	Seeds(13) = "13"
0105: 	Seeds(14) = "14"
0106: 	Seeds(15) = "15"
0107: 	Seeds(16) = "16"
0108: 
0109: 		Set rs = Server.CreateObject("ADODB.Recordset")
0110: 		sqlString = "SELECT * FROM mmBiggestLoser " & _
0111: 								"WHERE Season = " & yr 
0112: 
0113: 		rs.Open sqlString, conn, adOpenDynamic, adLockOptimistic, adCmdText
0114: 	
0115: 		Do Until rs.EOF
0116: 
0117: 		TotalPoints = 0
0118:          p1 = rs("Seed01").Value
0119: 		Points  = GetPoints(p1, results)
0120:  		rs("Seed01Points") = Points
0121: 		TotalPoints = TotalPoints + Cint(Points)
0122:          p2 = rs("Seed02").Value 
0123: 		Points = GetPoints(p2, results)
0124: 		rs("Seed02Points")  = Points
0125: 		TotalPoints = TotalPoints + Cint(Points)
0126:          p3 = rs("Seed03").Value 
0127: 		Points = GetPoints(p3, results)
0128: 		rs("Seed03Points") = Points
0129: 		TotalPoints = TotalPoints + Cint(Points)
0130:          p4 = rs("Seed04").Value 
0131: 		Points = GetPoints(p4, results)
0132: 		rs("Seed04Points")  = Points 
0133: 		TotalPoints = TotalPoints + Cint(Points)
0134:          p5 = rs("Seed05").Value 
0135: 		Points  = GetPoints(p5, results)
0136: 		rs("Seed05Points") = Points
0137: 		TotalPoints = TotalPoints + Cint(Points)
0138:          p6 = rs("Seed06").Value 
0139: 		Points = GetPoints(p6, results)
0140: 		rs("Seed06Points")  = Points
0141: TotalPoints = TotalPoints + Cint(Points)
0142:          p7 = rs("Seed07").Value 
0143: Points = GetPoints(p7, results)
0144: rs("Seed07Points")  = Points
0145: TotalPoints = TotalPoints + Cint(Points)
0146:          p8 = rs("Seed08").Value 
0147: Points = GetPoints(p8, results)
0148: rs("Seed08Points")  = Points
0149: TotalPoints = TotalPoints + Cint(Points)
0150:          p9 = rs("Seed09").Value 
0151: Points = GetPoints(p9, results)
0152: rs("Seed09Points")  = Points
0153: TotalPoints = TotalPoints + Cint(Points)
0154:          p10 = rs("Seed10").Value 
0155: Points = GetPoints(p10, results)
0156: rs("Seed10Points") = Points
0157: TotalPoints = TotalPoints + Cint(Points) 
0158:          p11 = rs("Seed11").Value 
0159: Points  = GetPoints(p11, results)
0160: rs("Seed11Points") = Points
0161: TotalPoints = TotalPoints + Cint(Points)
0162:          p12 = rs("Seed12").Value 
0163: Points = GetPoints(p12, results)
0164: rs("Seed12Points") = Points
0165: TotalPoints = TotalPoints + Cint(Points) 
0166:          p13 = rs("Seed13").Value 
0167: Points = GetPoints(p13, results)
0168: rs("Seed13Points") = Points
0169: TotalPoints = TotalPoints + Cint(Points) 
0170:          p14 = rs("Seed14").Value 
0171: Points  = GetPoints(p14, results)
0172: rs("Seed14Points") = Points
0173: TotalPoints = TotalPoints + Cint(Points)
0174:          p15 = rs("Seed15").Value 
0175: Points  = GetPoints(p15, results)
0176: rs("Seed15Points") = Points
0177: TotalPoints = TotalPoints + Cint(Points)
0178:          p16 = rs("Seed16").Value 
0179: Points = GetPoints(p16, results)
0180: rs("Seed16Points")  = Points
0181: TotalPoints = TotalPoints + Cint(Points)
0182: rs("TotalPoints").Value = TotalPoints
0183: ' Response.Write("<Br>TotalPoints=" & TotalPoints)
0184: 
0185: 
0186: 
0187: S1Name = rst(p1).Value
0188: S2Name = rst(p2).Value
0189: S3Name = rst(p3).Value
0190: S4Name = rst(p4).Value
0191: rs("TeamsLeft").Value = TotalStillIn
0192: 		rs("Seed01TeamName") = S1Name
0193: 		rs("Seed02TeamName") = S2Name
0194: 		rs("Seed03TeamName") = S3Name
0195: 		rs("Seed04TeamName") = S4Name
0196: 
0197: GamesPlayed = 0
0198: TeamsLeft = 0
0199: sd = 0
0200: 		Do Until sd = 16
0201: 		sd = sd + 1
0202: 
0203: SeedField = "Seed" & Seeds(sd)
0204: TID = rs(SeedField).Value
0205: SeedPoints = "Seed" & Seeds(sd) & "Points"
0206: SeedPoints = rs(SeedPoints).Value
0207: TeamName = rst(TID).Value
0208: Select Case Left(TID, 1)
0209: 				Case "A"
0210: 					pos = 0
0211: 					regno = 1
0212: 				Case "B"
0213: 					pos = 16
0214: 					regno = 2
0215: 				Case "C"
0216: 					pos = 32
0217: 					regno = 3
0218: 				Case "D"
0219: 					pos = 48
0220: 					regno = 4
0221: 			End Select
0222: pos = pos + sd
0223: 
0224: TeamsLeft = TeamsLeft + StillIn(RegNo,sd)
0225: 
0226:  If Scores(pos,1) <> 0 Then 
0227: GamesPlayed = GamesPlayed + 1
0228: End If
0229:  If Scores(pos,2) <> 0 Then 
0230: GamesPlayed = GamesPlayed + 1
0231: End If
0232:  If Scores(pos,3) <> 0 Then 
0233: GamesPlayed = GamesPlayed + 1
0234: End If
0235:  If Scores(pos,4) <> 0 Then 
0236: GamesPlayed = GamesPlayed + 1
0237: End If
0238:  If Scores(pos,5) <> 0 Then 
0239: GamesPlayed = GamesPlayed + 1
0240: End If
0241:  If Scores(pos,6) <> 0 Then 
0242: GamesPlayed = GamesPlayed + 1
0243: End If
0244: 
0245: 
0246: 		Loop
0247: 		rs("GamesPlayed").Value = GamesPlayed
0248: 		rs("TeamsLeft").Value = TeamsLeft
0249: 	rs.Update
0250:       		rs.MoveNext
0251: 		Loop
0252: 
0253: 
0254: 		Set cn = Server.CreateObject("ADODB.Connection")
0255: 		cn.Open conn
0256: 		sqlString = "DELETE FROM mmTop10 " & _
0257: 							"WHERE Season = " & yr & " " & _
0258: 							"AND Contest = 'BL'"
0259: 		cn.Execute sqlString, lngRecs, adExecuteNoRecords
0260: 		cn.Close
0261: 		Set cn = Nothing
0262: 
0263: 		Rank = 0
0264: 
0265: 		Set rs = Server.CreateObject("ADODB.Recordset")
0266: 		sqlString = "SELECT * FROM mmBiggestLoser " & _
0267: 								"WHERE Season = " & yr & " ORDER BY GamesPlayed, TotalPoints ASC " 
0268: 		rs.Open sqlString, conn, adOpenDynamic, adLockOptimistic, adCmdText
0269: 		Do Until rs.EOF
0270: 		Rank = Rank + 1
0271: 		RegNumber = rs("RegNumber").Value
0272: 		TotalPoints = rs("TotalPoints").Value
0273: 
0274: 		Set rsm = Server.CreateObject("ADODB.Recordset")
0275: 	sqlString = "SELECT * FROM MY4_Master " & _
0276: 							"WHERE RegNumber = '" & RegNumber & "' " 
0277: 	rsm.Open sqlString, conn2, adOpenDynamic, adLockOptimistic, adCmdText
0278: 	If rsm.EOF Then
0279: 	
0280: 	Else
0281:  			FirstName = rsm("FirstName").Value
0282:  			LastName = rsm("LastName").Value
0283: '		AmountDonatedToCOH =rsm("AmountDonatedToCOH").Value
0284:            EmailAddress = rsm("EmailAddress").Value
0285:  			FullName = FirstName & " " & LastName
0286: 
0287: 		rsm.Close
0288: 		Set rsm = Nothing	
0289:      End If
0290: 
0291: '        rs("Rank").Value = Rank
0292: 
0293: 	Set rsp = Server.CreateObject("ADODB.Recordset")
0294: 	sqlString = "SELECT * FROM mmPrizes " & _
0295: 			"WHERE Season = " & season
0296: 	rsp.Open sqlString, conn, adOpenStatic, adLockReadOnly, adCmdText
0297: 
0298:        If Rank <= 5 Then
0299: 	 	Select Case Rank
0300: 			Case 1
0301: 				TotalAmount = rsp("B1").Value
0302: 			Case 2
0303: 				TotalAmount = rsp("B2").Value
0304: 			Case 3
0305: 				TotalAmount = rsp("B3").Value
0306: 			Case 4
0307: 				TotalAmount = rsp("B4").Value
0308: 			Case 5
0309: 				TotalAmount = rsp("B5").Value
0310: 		End Select
0311: '       Response.Write(Namenew & " = " & Citynew & "-" & topfive & " = " & topten & " = " & totalamt & "<BR>")
0312: 		Set rstopten = Server.CreateObject("ADODB.Recordset")
0313: 		rstopten.Open "mmTop10", conn, adOpenDynamic, adLockOptimistic, adCmdTable
0314: 		rstopten.AddNew
0315: 		rstopten("Season").Value = yr
0316:        rstopten("RegNumber").Value = RegNumber
0317:        rstopten("Rank").Value = Rank
0318:        rstopten("Name").Value = FirstName & " " & LastName
0319: 		rstopten("Contest").Value = "BL"
0320: 		rstopten("TotalAmt").Value = TotalAmount
0321:        rstopten.Update
0322:        rstopten.Close
0323:        Set rstopten = Nothing
0324:        End If
0325: 	   rs.Update
0326: 		rs.MoveNext
0327: 		Loop
0328: 		rs.Close
0329: 		Set rs = Nothing
0330: 
0331: 
0332: 
0333: 	
0334: 	   Response.Redirect("calcpickpoints2nd.asp?yr=" & yr)
0335: 
0336: %>