.计划
估计此任务需要5-7天
.开发
.需求分析
用户故事:作为一个赛事管理人员,我希望知道每场比赛队伍得分和积分情况,以便给每队进行排名。
.设计文档
从分析用户故事可知,可分为选择队伍和统计积分给队伍进行排名。
.设计复审
打算让同学进行复审
.代码规范
根据Visual Studio 2010规范。
.具体设计
<connectionStrings>
<add name="constr" connectionString="server=.;database=itcast;Integrated Security=True"/>
</connectionStrings>
public static class SqlHelper
{
private static readonly string constr = ConfigurationManager.ConnectionStrings["ball"].ConnectionString;
public static int ExecuteNonQuery(string sql, params SqlParameter[] pms)
{
using (SqlConnection con = new SqlConnection(strConn))
{
using (SqlCommand cmd = new SqlCommand(sql, con))
{
if (pms != null)
{
cmd.Parameters.AddRange(pms);
}
con.Open();
return cmd.ExecuteNonQuery();
public static object ExecuteScalar(string sql, params SqlParameter[] pms)
{
using (SqlConnection con = new SqlConnection(constr))
{ using (SqlCommand cmd = new SqlCommand(sql, con))
{ if (pms != null)
{
cmd.Parameters.AddRange(pms);
}
con.Open();
return cmd.ExecuteScalar();
}
}
}
public static DataTable ExecuteDataTable(string sql, params SqlParameter[] pms)
{
DataTable dt = new DataTable();
using (SqlDataAdapter adapter = new SqlDataAdapter(sql, constr))
{
if (pms != null)
{
adapter.SelectCommand.Parameters.AddRange(pms);
}
adapter.Fill(dt);
}
return dt;
}
}
private void button1_Click(object sender, EventArgs e)
{
if (txtduiming1.Text == "" || txtduiming1.Text == null)
{MessageBox.Show("队伍名");}
if (dyj.Text == "" && txtduiming1.Text != "")
{if (int.Parse(dyc1.Text) < 25)
{int a = int.Parse(dyc1.Text);
a++;
dyc1.Text = a.ToString();
int c = int.Parse(dyc2.Text);
if (a == 25 && a - 1 > c)
{MessageBox.Show("一局" + button1.Text);
dyj.Text = button1.Text;
int b = int.Parse(cnibf1.Text);
b++;
changneibifen1.Text = b.ToString();}
}
else
{int a = int.Parse(dyc1.Text);
a++;
dyc1.Text = a.ToString();
int c = int.Parse(dyc2.Text);
if (a - 1 > c)
{MessageBox.Show("一局" + button1.Text);
diyiju.Text = button1.Text;
int b = int.Parse(cnbf1.Text);
b++;
cnbf1.Text = b.ToString();
}}}
else if (dej.Text == "" && txtduiwu1.Text != "")
{if (int.Parse(dec1.Text) < 25)
{int a=int.Parse(dec1.Text);
a++;
dec1.Text =a.ToString();