排球计分程序
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了排球计分程序相关的知识,希望对你有一定的参考价值。
计划
|
time |
估计这个任务需要多长时间 | 480min |
开发 | |
需求分析 | 60min |
生成设计文档 | 30min |
代码复审 | 55min |
具体设计 | 50min |
具体编码 | 130min |
代码复审 | 60min |
测试 | 30min |
报告 | |
测试报告 | 15min |
计算工作量 | 20min |
代码部分:
public class Match
{
public int id;
public int h1F;
public int h2F;
public int h3F;
public int l1F;
public int l2F;
public int l3F;
}
public class dal
{
public Match Select(int id)
{
string strCon = "server=.;database=pqMatch;integrated security=true";
SqlConnection con = new SqlConnection(strCon);
string sql = "select * from Match where id="+id;
SqlCommand comm = new SqlCommand(sql, con);
con.Open();
Match mc = null;
SqlDataReader reader = comm.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
mc = new Match();
mc.id = 1;
mc.h1j =(int) reader["h1F"];
mc.h2j = (int)reader["h2F"];
mc.h3j = (int)reader["h3F"];
mc.l1j = (int)reader["l1F"];
mc.l2j = (int)reader["l2F"];
mc.l3j = (int)reader["l3F"];
}
}
reader.Close();
con.Close();
return mc;
}
}
public class bll
{
private dal dl = new dal();
public Match Select(int id)
{
return dl.Select(id);
}
}
private bll bl1 = new bll();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
if (!IsPostBack)
{
txt1h.Text = "";
txt2h.Text = "";
txt3h.Text = "";
txt1l.Text = "";
txt2l.Text = "";
txt3l.Text = "";
}
else
{
string id = Label1.Text.Trim();
Match mc = bl1.Select(Convert.ToInt32(id));
txt1h.Text = mc.h1F.ToString();
txt2h.Text = mc.h2F.ToString();
txt3h.Text = mc.h3F.ToString();
txt1l.Text = mc.l1F.ToString();
txt2l.Text = mc.l2F.ToString();
txt3l.Text = mc.l3F.ToString();
}
int ah=Convert.ToInt32(txt1h.Text);
int bh = Convert.ToInt32(txt2h.Text);
int ch = Convert.ToInt32(txt3h.Text);
int al = Convert.ToInt32(txt1l.Text);
int bl = Convert.ToInt32(txt2l.Text);
int cl = Convert.ToInt32(txt3l.Text);
int zfh = 0;
int zfl = 0;
if (ah > al)
{
zfh++;
}
else
{
zfl++;
}
if (bh > bl)
{
zfh++;
}
else
{
zfl++;
}
if (ch > cl)
{
zfh++;
}
else
{
zfl++;
}
if (dh > dl)
{
zfh++;
}
else
{
zfl++;
}
if (eh > el)
{
zfh++;
}
else
{
zfl++;
}
以上是关于排球计分程序的主要内容,如果未能解决你的问题,请参考以下文章