最終衝刺總結

排球計分程序-現場工做人員界面sql

1.計劃數據庫

經過對用戶故事估計這個任務須要3~5days。數據庫設計

2.開發ide

2.1需求分析測試

做爲一個排球比賽的現場工做人員,我須要統計每一名ui

隊員的得分及技術統計,以便頒發每場比賽的最有價值球員獎,this

以及肯定賽會的最佳陣容。編碼

2.2生成設計文檔spa

1.>界面功能:進入現場工做人員界面,當運動員得分時,經過datagridview控件增長或者更新數據,而且即時更新到數據庫中,而後經過查詢按鈕進入比賽結束後運動員的總分及技術統計界面。設計

2.>數據庫功能:從數據庫中獲取全部運動員的總分,而後按照降序的方法進行排序,獲取第一行的第一個數據,將得分最高的運動員的名字現實到文本框中,得出MVP。

一樣的方法依次找出發球,扣球,攔網,一傳,二傳,自由人最佳的技術運動員,將此顯示到文本框中。

3.>活動圖:

 

 

2.3設計複審

設計文檔暫時由本身複審。

2.4代碼規範

根據設計文檔制定出合適的規範,對程序須要實現的功能

做出合理的劃分,以便於提升各個部分功能的可用性。

2.5具體設計

1.>界面設計

 

 

 

2.>數據庫設計

2.6具體編碼

using System.Data.OleDb;
namespace 工做人員統計
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
OleDbConnection conn;//聲明一個OleDbConnection變量
OleDbDataAdapter adapter;//聲明一個OleDbAdapter
DataSet ds = null;

private void Form1_Load(object sender, EventArgs e)
{
// TODO: 這行代碼將數據加載到表「統計表DataSet.Allathlete」中。您能夠根據須要移動或刪除它。
this.allathleteTableAdapter1.Fill(this.統計表DataSet.Allathlete);
// TODO: 這行代碼將數據加載到表「workersDataSet1.Allathlete」中。您能夠根據須要移動或刪除它。
// this.allathleteTableAdapter.Fill(this.workersDataSet1.Allathlete);
// TODO: 這行代碼將數據加載到表「workers.Allathletes」中。您能夠根據須要移動或刪除它。

//
conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Administrator\Desktop\統計表.mdb");
adapter = new OleDbDataAdapter("select * from Allathlete", conn);
ds = new DataSet();
adapter.Fill(ds, "Allathlete");
dataGridView1.DataSource = ds.Tables[0];
dataGridView1.RowHeadersVisible = false;

}

private void button1_Click(object sender, EventArgs e)
{
//鏈接數據庫
conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Administrator\Desktop\統計表.mdb");
adapter = new OleDbDataAdapter("select * from Allathlete", conn);
ds = new DataSet();
adapter.Fill(ds,"Allathlete");
dataGridView1.DataSource = ds.Tables[0];
dataGridView1.RowHeadersVisible = false;

//創建一個DataTable類型的方法

}
private DataTable dbcon(string strOleDb)
{
conn.Open();
this.adapter = new OleDbDataAdapter(strOleDb,conn);
DataTable dtSelect = new DataTable();
int rnt = this.adapter.Fill(dtSelect);
conn.Close();
return dtSelect;
}

private void button2_Click(object sender, EventArgs e)
{
if (dbUpdate())
{
MessageBox.Show("更新成功");
}
}
private Boolean dbUpdate()
{
string strOleDb = "select * from Allathlete";
DataTable dtUpdate = new DataTable();
dtUpdate = this.dbcon(strOleDb);
dtUpdate.Rows.Clear();
DataTable dtShow = new DataTable();
dtShow = (DataTable)this.dataGridView1.DataSource;
for (int i = 0; i < dtShow.Rows.Count; i++)//循環遍歷
{
dtUpdate.ImportRow(dtShow.Rows[i]);

}
try
{
this.conn.Open();
OleDbCommandBuilder cb = new OleDbCommandBuilder(this.adapter);
this.adapter.Update(dtUpdate);
this.conn.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
return false;
}
dtUpdate.AcceptChanges();
return true;
}

private void button3_Click(object sender, EventArgs e)
{
Form2 a = new Form2();
a.Show();
this.Hide();
}


}
}

using System.Data.OleDb;

namespace 工做人員統計
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

private void Form2_Load(object sender, EventArgs e)
{
// TODO: 這行代碼將數據加載到表「統計表DataSet3.Allathlete」中。您能夠根據須要移動或刪除它。
this.allathleteTableAdapter3.Fill(this.統計表DataSet3.Allathlete);
// TODO: 這行代碼將數據加載到表「統計表DataSet2.Allathlete」中。您能夠根據須要移動或刪除它。
this.allathleteTableAdapter2.Fill(this.統計表DataSet2.Allathlete);
// TODO: 這行代碼將數據加載到表「統計表DataSet1.Allathlete」中。您能夠根據須要移動或刪除它。
this.allathleteTableAdapter1.Fill(this.統計表DataSet1.Allathlete);
// TODO: 這行代碼將數據加載到表「worker.Allathlete」中。您能夠根據須要移動或刪除它。
//this.allathleteTableAdapter.Fill(this.worker.Allathlete);


}

private void button3_Click(object sender, EventArgs e)
{
string conn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Administrator\Desktop\統計表.mdb";
OleDbConnection con = new OleDbConnection(conn);
// string sql = "select qiuyuan from Allathletes order by faqiu desc";
con.Open();
string sql = "select qiuyuan from Allathlete order by faqiu desc";
OleDbCommand cmd = new OleDbCommand(sql,con);
OleDbDataReader reader = cmd.ExecuteReader();
try
{
reader.Read();
string faqiu = (string)reader[0].ToString();
textBox1.Text = faqiu;
reader.Close();
con.Close();
con.Open();
string sqa = "select qiuyuan from Allathlete order by kouqiu desc";
OleDbCommand cma = new OleDbCommand(sqa, con);
OleDbDataReader readera = cma.ExecuteReader();
readera.Read();
string kouqiu = (string)readera[0].ToString();
textBox2.Text = kouqiu;
readera.Close();
con.Close();
con.Open();
string sqb = "select qiuyuan from Allathlete order by lanwang desc";
OleDbCommand cmb = new OleDbCommand(sqb, con);
OleDbDataReader readerb = cmb.ExecuteReader();
readerb.Read();
string lanwang = (string)readerb[0].ToString();
textBox3.Text = lanwang;
readerb.Close();
con.Close();
con.Open();
string sqc = "select qiuyuan from Allathlete order by yichuan desc";
OleDbCommand cmc = new OleDbCommand(sqc, con);
OleDbDataReader readerc = cmc.ExecuteReader();
readerc.Read();
string yichuan = (string)readerc[0].ToString();
textBox4.Text = yichuan;
readerc.Close();
con.Close();
con.Open();
string sqd = "select qiuyuan from Allathlete order by erchuan desc";
OleDbCommand cme = new OleDbCommand(sqd, con);
OleDbDataReader readerd = cme.ExecuteReader();
readerd.Read();
string erchuan = (string)readerd[0].ToString();
textBox5.Text = erchuan;
readerd.Close();
con.Close();
con.Open();
string sqf = "select qiuyuan from Allathlete order by ziyouren desc";
OleDbCommand cmf = new OleDbCommand(sqf, con);
OleDbDataReader readerf = cmf.ExecuteReader();
readerf.Read();
string ziyouren = (string)readerf[0].ToString();
//textBox1.Text = faqiu;
//textBox2.Text = kouqiu;
// textBox3.Text = lanwang;
// textBox4.Text = yichuan;
// textBox5.Text = erchuan;
textBox6.Text = ziyouren;
reader.Close();
}
catch
{
MessageBox.Show("沒有比賽數據!");
}
con.Close();
}

private void button1_Click(object sender, EventArgs e)
{
string conn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Administrator\Desktop\統計表.mdb";
OleDbConnection con = new OleDbConnection(conn);
string sql = "select qiuyuan from Allathlete order by score desc";
con.Open();
OleDbCommand cmd = new OleDbCommand(sql,con);
OleDbDataReader reader = cmd.ExecuteReader();
reader.Read();
try
{
string mvp = (string)reader[0].ToString();
text.Text = mvp;
}
catch
{
MessageBox.Show("沒有比賽數據!");
}
reader.Close();
con.Close();

}

private void label4_Click(object sender, EventArgs e)
{

}

private void button2_Click(object sender, EventArgs e)
{
text.Text = "";
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text= "";
}
}
}

2.7代碼複審

暫無。

2.8測試

使用VS對代碼進行測試,對代碼進行重構,修復了部分bug。

3.報告

3.1測試報告

測試經過。

3.2計算工做量

時間

24h

隨筆累計數

不肯定

代碼累計

不肯定

相關文章
相關標籤/搜索