标签:界面 tns tar utf-8 计时 pms param put char
排球比赛计分,现场工作人员
1. 估计时间:一周左右。
2. 开发
需求分析:
作为一个排球比赛的现场工作人员,我需要统计每一名
队员的得分及技术统计,以便颁发每场比赛的最有价值球员奖,
以及确定赛会的最佳阵容。
设计文档:
在界面通过队球员信息进行操作,可以同步到数据库中。查询分数和统计。从数据库中获取运动员分数
设计复审:
自己。
代码规范:
c#对设计进行具体操作;
具体设计:
Dal层
public int regist(TeamInfo team)
{
string strcom = "insert into Team(Team,Number,Name)
values(@team,@number,@name);";
SqlParameter[] pms = { new SqlParameter("@team",team.Team ), new
SqlParameter("@number", team.Number), new
SqlParameter("@name", team.Name)};
return SqlHelper.ExecuteNonQuery(strcom, pms);
}
public bool updateScore(ScoreInfo score)
{
string strcom = "update Score set score=@score,reason=@reason where
name=@name;";
SqlParameter p = new SqlParameter("@name", score.Name);
SqlParameter p1 = new SqlParameter("@score", score.Score);
SqlParameter p2 = new SqlParameter("@reason", score.Reason);
int i = SqlHelper.ExecuteNonQuery(strcom, p, p1, p2);
return i > 0;
}
public List<ScoreInfo> search(string where)
{
string strcom = "select * from Score " + where;
using (SqlDataReader dr = SqlHelper.ExecuteReader(strcom, null))
{
if (dr.HasRows)
{
List<ScoreInfo> students = new List<ScoreInfo>();
while (dr.Read())
{
ScoreInfo student = new ScoreInfo(dr[0].ToString(),dr[1].GetHashCode(),
dr[2].ToString());
students.Add(student);
}
return students;
}
else
{ return null; }
}
}
bll 层
public
bool updateStudent(ScoreInfo score)
{
return scoreinfo.updateScore(score);
}
public List<ScoreInfo> search(string where)
{
return scoreinfo.search(where);
}
public bool regist(TeamInfo stu)
{
return scoreinfo.regist(stu) > 0;
}
表现层
<script language="javascript">
function one() {
var v = document.getElementById(‘one‘);
if (v.style.display == "none") {
v.style.display = "block";
}
else if( v.style.display="block"){
v.style.display = "none";
}
}
</script>
<style type="text/css">
#mian
{
height: 227px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div id="mian">
<div class="Center">
<table>
<tr>
<td>
<asp:DropDownList ID="DropDownListA" runat="server"
CausesValidation="True">
</asp:DropDownList>
</td><td>
<asp:DropDownList ID="DropDownListB" runat="server"
CausesValidation="True">
</asp:DropDownList>
</td>
</tr><tr><td colspan="2">
<a href="javascript:one()">如果没有你需要队伍名称请添加^</a>
<div id="one">
<asp:TextBox ID="TeamName"
runat="server"></asp:TextBox>
<asp:Button ID="btnSaveName" runat="server" Text="保存名称"
onclick="btnSaveName_Click" /></td>
</tr>
</div>
<tr><td colspan="2">
<asp:Button ID="btnEnter" runat="server" Text="进入比赛" onclick="btnSave_Click"
/>
</td>></tr>
</table>
</div>
</div>
</form>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type"
content="text/html;charset=UTF-8">
<title>排球记分员</title>
<style type="text/css">
body
{
}
#Mian table
{
margin: 100px auto auto auto;
text-align: center;
color: Red;
font-size:28px;
font-family:微软雅黑 Light;
width:1000px;
}
#TeamData table
{
margin: 100px auto auto auto;
text-align: center;
color: Red;
font-size:20px;
font-family:微软雅黑 Light;
}
#TeamData table td{ width:240px;}
</style>
<script>
var h=0;
var t=0;
function insRow(var1)
{
h=h+1;
var n=document.getElementById(‘myTable‘).rows.length;
console.log(n);
var x=document.getElementById(‘myTable‘).insertRow(n);
var y=x.insertCell(0);
var z=x.insertCell(1);
var v=x.insertCell(2);
var f=x.insertCell(3);
y.innerHTML="";
z.innerHTML="";
v.innerHTML=var1;
f.innerHTML=h;
}
function addRow(var1)
{
t=t+1;
var n=document.getElementById(‘myTable‘).rows.length;
console.log(n);
var x=document.getElementById(‘myTable‘).insertRow(n);
var y=x.insertCell(0);
var z=x.insertCell(1);
var v=x.insertCell(2);
var f=x.insertCell(3);
v.innerHTML="";
f.innerHTML="";
y.innerHTML=var1;
z.innerHTML=t;
}
function delRow()
{
var n=document.getElementById(‘myTable‘).rows.length-1;
document.getElementById(‘myTable‘).deleteRow(n);
}
function Erra()
{
h=h+1;
var n=document.getElementById(‘myTable‘).rows.length;
var x=document.getElementById(‘myTable‘).insertRow(n);
var y=x.insertCell(0);
var z=x.insertCell(1);
var v=x.insertCell(2);
var f=x.insertCell(3);
v.innerHTML="";
f.innerHTML=h;
y.innerHTML="";
z.innerHTML="失误";
}
function Errb()
{
t=t+1;
var n=document.getElementById(‘myTable‘).rows.length;
var x=document.getElementById(‘myTable‘).insertRow(n);
var y=x.insertCell(0);
var z=x.insertCell(1);
var v=x.insertCell(2);
var f=x.insertCell(3);
v.innerHTML="";
f.innerHTML="失误";
y.innerHTML="";
z.innerHTML=t;
}
</script>
</head>
<body>
<div id="Mian">
<table id="sum" border="0">
<tbody>
<tr>
<td><input type="button" value="2"
onClick="addRow(value)"></td>
<td><input type="button" value="9"
onClick="addRow(value)"></td>
<td>中 国</td>
<td>:</td>
<td>塞尔维亚</td>
<td><input type="button" value="10"
onClick="insRow(value)"></td>
<td><input type="button" value="19"
onClick="insRow(value)"></td>
</tr>
<tr>
<td><input type="button" value="12"
onClick="addRow(value)"></td>
<td><input type="button" value="10"
onClick="addRow(value)"></td>
<td rowspan="3">03</td>
<td rowspan="3">:</td>
<td rowspan="3">04</td>
<td><input type="button" value="9"
onClick="insRow(value)"></td>
<td><input type="button" value="6"
onClick="insRow(value)"></td>
</tr>
<tr>
<td><input type="button" value="1"
onClick="addRow(value)"></td>
<td><input type="button" value="17"
onClick="addRow(value)"></td>
<td><input type="button" value="16"
onClick="insRow(value)"></td>
<td><input type="button" value="15"
onClick="insRow(value)"></td>
</tr>
<tr>
<td><input type="button" value="11"
onClick="addRow(value)"></td>
<td><input type="button" value="6"
onClick="addRow(value)"></td>
<td><input type="button" value="17"
onClick="insRow(value)"></td>
<td><input type="button" value="3"
onClick="insRow(value)"></td>
</tr>
<tr>
<td><input type="button" value="3"
onClick="addRow(value)"></td>
<td><input type="button" value="7"
onClick="addRow(value)"></td>
<td>0</td>
<td>:</td>
<td>0</td>
<td><input type="button" value="2"
onClick="insRow(value)"></td>
<td><input type="button" value="8" onClick="insRow(value)"></td>
</tr>
<tr>
<td><input type="button" value="16"
onClick="addRow(value)"></td>
<td><input type="button" value="5"
onClick="addRow(value)"></td>
<td><button onClick="delRow()">误判减分</button> <input
type="button" value="失误" onClick="Erra()"></td>
<td></td>
<td><button onClick="addRow()">误判减分</button> <input
type="button" value="失误" onClick="Errb()"></td>
<td><input type="button" value="1"
onClick="insRow(value)"></td>
<td><input type="button" value="13"
onClick="insRow(value)"></td>
</tr>
</tbody>
</table>
</div>
<div id="TeamData">
<table id="myTable" border="1">
<tr><td colspan="2">A队</td><td colspan="2">B队</td></tr>
<tr><td>中国队员 </td><td>累计得分</td><td>塞尔维亚队员</td><td>累计得分</td></tr>
</div>
</body>
</html>
代码复审:
测试:
工作量统计:
事后总结:
对于三层架构不能熟练使用。具体功能的实现要多于其他人交流。以上就是这次的总结。
标签:界面 tns tar utf-8 计时 pms param put char
原文地址:http://www.cnblogs.com/wuhao123/p/6569011.html