forked from qangel/EECS-341-Project
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdraft.jsp
More file actions
117 lines (113 loc) · 4.07 KB
/
draft.jsp
File metadata and controls
117 lines (113 loc) · 4.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<%
String player=null, pos=null;
if(request.getParameter("player") != null) {
player = request.getParameter("player");
pos = request.getParameter(player);
command = "{call draft(?,?,?)}";
cs = conn.prepareCall(command);
cs.setString(1, user);
cs.setString(2, player);
cs.setString(3, pos);
cs.executeQuery();
}
String needsQB = "";
String needsRB = "";
String needsWR = "";
String needsTE = "";
String needsDEF = "";
String needsK = "";
String needsBN = "";
query = "select t.* from user u, teamroster t where u.username = '"
+user+"' and u.teamname = t.teamname";
rs = srs.executeQuery(query);
rs.next();
if(rs.getString("QB") == null) needsQB = "QB";
if(rs.getString("RB1") == null) needsRB = "RB1";
else if(rs.getString("RB2") == null) needsRB = "RB2";
if(rs.getString("WR1") == null) needsWR = "WR1";
else if(rs.getString("WR2") == null) needsWR = "WR2";
else if(rs.getString("WR3") == null) needsWR = "WR3";
if(rs.getString("TE") == null) needsTE = "TE";
if(rs.getString("DEF") == null) needsDEF = "DEF";
if(rs.getString("K") == null) needsK = "K";
if(rs.getString("BN1") == null) needsBN = "BN1";
else if(rs.getString("BN2") == null) needsBN = "BN2";
else if(rs.getString("BN3") == null) needsBN = "BN3";
else if(rs.getString("BN4") == null) needsBN = "BN4";
else if(rs.getString("BN5") == null) needsBN = "BN5";
query = "select t.* from teamroster t where t.teamname="+
"(select u.teamname from user u where u.username='"+user+"');";
rs = srs.executeQuery(query);
rsmd = rs.getMetaData();
%>
<tr>
<td align="center" colspan="<%= rsmd.getColumnCount() %>">
<b>My Roster</b>
</td>
</tr>
<% rs.next();%>
<% for(int i=2; i <= rsmd.getColumnCount(); ++i) { %>
<tr>
<td />
<td><%= rsmd.getColumnName(i) %></td>
<td colspan=2><%= rs.getString(i) == null ? "" : rs.getString(i) %></td>
</tr>
<% } %>
<%
query = "select name, nflteam, position from players where availability=0;";
rs = srs.executeQuery(query);
rsmd = rs.getMetaData();
%>
<tr><td><br /></td></tr>
<tr>
<td align="center" colspan="<%= rsmd.getColumnCount() %>">
<b>Available Players</b>
</td>
</tr>
<tr>
<% for(int i=1; i <= rsmd.getColumnCount(); ++i) { %>
<td><%= rsmd.getColumnName(i) %></td>
<% } %>
</tr>
<form action="<%=request.getRequestURL()%>" method="post">
<input type=hidden name="show" value="<%=show%>" />
<% while(rs.next()) { %>
<tr>
<% for(int i=1; i <= rsmd.getColumnCount(); ++i) { %>
<td><%= rs.getString(i) %></td>
<% } %>
<td>
<%
if (rs.getString("position").equals("QB") && !needsQB.equals("")) {%>
<input type="hidden" name="<%=rs.getString("name")%>" value="<%=needsQB%>" />
<input type="submit" name="player" value="<%=rs.getString("name")%>" />
<%}
else if (rs.getString("position").equals("RB") && !needsRB.equals("")) {%>
<input type="hidden" name="<%=rs.getString("name")%>" value="<%=needsRB%>" />
<input type="submit" name="player" value="<%=rs.getString("name")%>" />
<%}
else if (rs.getString("position").equals("WR") && !needsWR.equals("")) {%>
<input type="hidden" name="<%=rs.getString("name")%>" value="<%=needsWR%>" />
<input type="submit" name="player" value="<%=rs.getString("name")%>" />
<%}
else if (rs.getString("position").equals("TE") && !needsTE.equals("")) {%>
<input type="hidden" name="<%=rs.getString("name")%>" value="<%=needsTE%>" />
<input type="submit" name="player" value="<%=rs.getString("name")%>" />
<%}
else if (rs.getString("position").equals("DEF") && !needsDEF.equals("")) {%>
<input type="hidden" name="<%=rs.getString("name")%>" value="<%=needsDEF%>" />
<input type="submit" name="player" value="<%=rs.getString("name")%>" />
<%}
else if (rs.getString("position").equals("K") && !needsK.equals("")) {%>
<input type="hidden" name="<%=rs.getString("name")%>" value="<%=needsK%>" />
<input type="submit" name="player" value="<%=rs.getString("name")%>" />
<%}
else if (!needsBN.equals("")) {%>
<input type="hidden" name="<%=rs.getString("name")%>" value="<%=needsBN%>" />
<input type="submit" name="player" value="<%=rs.getString("name")%>" />
<%}
%>
</td>
</tr>
<% } %>
</form>