需求:作为一名现场记分员,我希望详细记录比赛现场比分增长情况,以便观众及运动员、教练员及时掌握比赛状况。(满意条件:每一次比分的改变,都要形成一条记录)。
计划:估计此次工作需要一周的时间。
需求分析: 根据用户需求可知我们此次程序需要做到每次分数变化的时候都要记录。当记分员操作之后就要形成记录。
设计文档:
数据关系图:
Team(队伍表)
|
字段 |
数据类型 |
说明 |
|
Num |
Vchar(10) |
队伍的编号(主键) |
|
Name |
Vchar(50) |
队伍的名称 |
Athlete(队员表)
|
字段 |
数据类型 |
说明 |
|
Num |
Vchar(10) |
运动员的编号(联合主键) |
|
Name |
Vchar(50) |
运动员的名字 |
|
TeamNum |
Vchar(10) |
远动员所属队伍的编号(联合主键) |
根据《2015-2016赛季中国排球联赛竞赛规程》,计分规则如下:
1、目前的排球比赛采用五局三胜制。前四局每局25分,每局比赛完成后交换场地,达到24分时,必须比赛的双方相差2分才能分出胜负;决胜局为15分,比赛的双方任何一方先达到8分时,交换场地继续比赛,当双方同时达到14分时候,也是必须相差两分才能决出胜负。
排球计分的发展历程:1917年规定每局为15分。1918年规定上场运动员每队为6人。1922年规定每方必须在3次以内将球击过网。比赛方法以前采用发球得分制,1998年10月28日国际排联决定改为每球得分制,仍为五局三胜,前四局每局先得25分者为胜,第五局先得15分者为胜,若出现24平或14平时,要继续比赛至某队领先2分才能取胜。
2、每点击一次按钮,分数列表就增加一行。
3、己方失误时。对方增加一分。
代码规范:使用C#语言标准、帕斯卡命名法和骆驼命名法 。
namespace 排球计分
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“paiqiuDataSet.jifen”中。您可以根据需要移动或删除它。
this.jifenTableAdapter.Fill(this.paiqiuDataSet.jifen);
// TODO: 这行代码将数据加载到表“pqjfDataSet.baiqiu”中。您可以根据需要移动或删除它。
// this.baiqiuTableAdapter.Fill(this.pqjfDataSet.baiqiu);
DAta();
}
private void DAta(string sql = "select * from jifen")
{
SqlConnection con = new SqlConnection("server=宋彤彤; Initial Catalog=paiqiu; Integrated Security=true;");
SqlDataAdapter ad = new SqlDataAdapter(sql, con);
DataSet ds = new DataSet();
con.Open();
ad.Fill(ds);
con.Close();
dataGridView1.DataSource = ds.Tables[0];
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
}
}
namespace 排球计分
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
SqlConnection con = new SqlConnection("server=宋彤彤; Initial Catalog=paiqiu; Integrated Security=true;");
Form1 f = new Form1();
private void but1_Click(object sender, EventArgs e)
{
// string sql = string.Format("insert into jifen (dijiqiu,Dname1,Dname2) values ('第{0}局','{1}','{2}')", m, txtd1, txtd2);
string sql = string.Format("insert into jifen (name1) values ('{0}')",1 );
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
int count = cmd.ExecuteNonQuery();
con.Close();
this.Close();
}
private void but2_Click(object sender, EventArgs e)
{
string sql = string.Format("insert into jifen (name) values ('{0}')", 2);
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
int count = cmd.ExecuteNonQuery();
con.Close();
this.Close();
this.Close();
}
private void but3_Click(object sender, EventArgs e)
{
string sql = string.Format("insert into jifen (name) values ('{0}')", 3);
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
int count = cmd.ExecuteNonQuery();
con.Close();
this.Close();
this.Close();
}
private void but4_Click(object sender, EventArgs e)
{
string sql = string.Format("insert into jifen (name) values ('{0}')", 4);
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
int count = cmd.ExecuteNonQuery();
con.Close();
this.Close();
this.Close();
}
private void but5_Click(object sender, EventArgs e)
{
string sql = string.Format("insert into jifen (name) values ('{0}')", 5);
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
int count = cmd.ExecuteNonQuery();
con.Close();
this.Close();
this.Close();
}
private void but6_Click(object sender, EventArgs e)
{
string sql = string.Format("insert into jifen (name) values ('{0}')", 6);
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
int count = cmd.ExecuteNonQuery();
con.Close();
this.Close();
this.Close();
}
private void but7_Click(object sender, EventArgs e)
{
string sql = string.Format("insert into jifen (name) values ('{0}')", 7);
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
int count = cmd.ExecuteNonQuery();
con.Close();
this.Close();
this.Close();
}
private void but8_Click(object sender, EventArgs e)
{
string sql = string.Format("insert into jifen (name) values ('{0}')", 8);
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
int count = cmd.ExecuteNonQuery();
con.Close();
this.Close();
this.Close();
}
private void but9_Click(object sender, EventArgs e)
{
string sql = string.Format("insert into jifen (name) values ('{0}')", 9);
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
int count = cmd.ExecuteNonQuery();
con.Close();
this.Close();
this.Close();
}
private void but10_Click(object sender, EventArgs e)
{
string sql = string.Format("insert into jifen (name) values ('{0}')", 10);
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
int count = cmd.ExecuteNonQuery();
con.Close();
this.Close();
this.Close();
}
private void but11_Click(object sender, EventArgs e)
{
string sql = string.Format("insert into jifen (name) values ('{0}')", 11);
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
int count = cmd.ExecuteNonQuery();
con.Close();
this.Close();
this.Close();
}
private void but12_Click(object sender, EventArgs e)
{
string sql = string.Format("insert into jifen (name) values ('{0}')", 12);
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
int count = cmd.ExecuteNonQuery();
con.Close();
this.Close();
this.Close();
}
private void butt_Click(object sender, EventArgs e)
{
string sql = string.Format("insert into jifen (name) values ('{0}')", "对方失误得分");
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
int count = cmd.ExecuteNonQuery();
con.Close();
this.Close();
this.Close();
}
}
}
代码不能插入