代码改变世界

排球比赛记分规则

2017-03-17 22:11  太阳女神  阅读(291)  评论(0编辑  收藏  举报

计划 

    ·估计这个人任务需要1-2周

开发

    ·需求分析

用户故事:作为一名现场记分员,我希望详细记录比赛现场比分增长情况,以便观众及运动员、教练员及时掌握比赛状况。

   ·生成设计文档

在运行的界面中可以看到中国队与塞尔维亚对的比分,点击加分和减分会在文本框中出现对应的数字。

    ·设计复审:对于这个需求目前做的还不算太完善,下周对下面的进行完善。

    ·代码规范:使用VS2010对代码进行规范。

    ·具体设计

   ·具体编码:

protected void Button1_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina2hao.Text);
a = a + 1;
txtchina2hao.Text = a.ToString();
}

protected void Button18_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina2hao.Text);
if (a > 0)
{
a = a - 1;
}
else if(a==0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtchina2hao.Text = a.ToString();
}

protected void Button2_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina9hao.Text);
a = a + 1;
txtchina9hao.Text = a.ToString();
}

protected void Button7_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina9hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtchina9hao.Text = a.ToString();
}

protected void Button3_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina12hao.Text);
a = a + 1;
txtchina12hao.Text = a.ToString();
}

protected void Button8_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina12hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtchina12hao.Text = a.ToString();
}

protected void Button4_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina10hao.Text);
a = a + 1;
txtchina10hao.Text = a.ToString();
}

protected void Button9_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina10hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtchina10hao.Text = a.ToString();
}

protected void Button5_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina1hao.Text);
a = a + 1;
txtchina1hao.Text = a.ToString();
}

protected void Button10_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina1hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtchina1hao.Text = a.ToString();
}

protected void Button6_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina10hao.Text);
a = a + 1;
txtchina10hao.Text = a.ToString();
}

protected void Button11_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina17hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtchina17hao.Text = a.ToString();
}

protected void Button12_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina11hao.Text);
a = a + 1;
txtchina11hao.Text = a.ToString();
}

protected void Button13_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina11hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtchina11hao.Text = a.ToString();
}

protected void Button14_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina6hao.Text);
a = a + 1;
txtchina6hao.Text = a.ToString();
}

protected void Button15_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina6hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtchina6hao.Text = a.ToString();
}

protected void Button16_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina3hao.Text);
a = a + 1;
txtchina3hao.Text = a.ToString();
}

protected void Button17_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina3hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtchina3hao.Text = a.ToString();
}

protected void Button19_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina7hao.Text);
a = a + 1;
txtchina7hao.Text = a.ToString();
}

protected void Button20_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina7hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtchina7hao.Text = a.ToString();
}

protected void Button21_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina16hao.Text);
a = a + 1;
txtchina16hao.Text = a.ToString();
}

protected void Button22_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina16hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtchina16hao.Text = a.ToString();
}

protected void Button23_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina15hao.Text);
a = a + 1;
txtchina15hao.Text = a.ToString();
}

protected void Button24_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtchina15hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtchina15hao.Text = a.ToString();
}

protected void Button27_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy10hao.Text);
a = a + 1;
txtsewy10hao.Text = a.ToString();
}

protected void Button28_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy10hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtsewy10hao.Text = a.ToString();
}

protected void Button29_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy19hao.Text);
a = a + 1;
txtsewy19hao.Text = a.ToString();
}

protected void Button30_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy19hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtsewy19hao.Text = a.ToString();
}

protected void Button31_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy9hao.Text);
a = a + 1;
txtsewy9hao.Text = a.ToString();
}

protected void Button32_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy9hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtsewy9hao.Text = a.ToString();
}

protected void Button35_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy5hao.Text);
a = a + 1;
txtsewy5hao.Text = a.ToString();
}

protected void Button36_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy5hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtsewy5hao.Text = a.ToString();
}

protected void Button37_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy4hao.Text);
a = a + 1;
txtsewy4hao.Text = a.ToString();
}

protected void Button38_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy4hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtsewy4hao.Text = a.ToString();
}

protected void Button39_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy6hao.Text);
a = a + 1;
txtsewy6hao.Text = a.ToString();
}

protected void Button40_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy6hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtsewy6hao.Text = a.ToString();
}

protected void Button41_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy2hao.Text);
a = a + 1;
txtsewy2hao.Text = a.ToString();
}

protected void Button42_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy2hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtsewy2hao.Text = a.ToString();
}

protected void Button43_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy16hao.Text);
a = a + 1;
txtsewy16hao.Text = a.ToString();
}

protected void Button44_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy16hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtsewy16hao.Text = a.ToString();
}

protected void Button45_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy1hao.Text);
a = a + 1;
txtsewy1hao.Text = a.ToString();
}

protected void Button46_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy1hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtsewy1hao.Text = a.ToString();
}

protected void Button47_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy15hao.Text);
a = a + 1;
txtsewy15hao.Text = a.ToString();
}

protected void Button48_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy15hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtsewy15hao.Text = a.ToString();
}

protected void Button49_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy17hao.Text);
a = a + 1;
txtsewy17hao.Text = a.ToString();
}

protected void Button50_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy17hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtsewy17hao.Text = a.ToString();
}

protected void Button51_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy8hao.Text);
a = a + 1;
txtsewy8hao.Text = a.ToString();
}

protected void Button52_Click(object sender, EventArgs e)
{
int a = Int32.Parse(txtsewy8hao.Text);
if (a > 0)
{
a = a - 1;
}
else if (a == 0)
{
Response.Write("<script>alert('该对分值为零不能进行减分')</script>");
}
txtsewy8hao.Text = a.ToString();
}

   ·测试:接下来对代码进行测试。