开发流程如下:
·项目计划
完成这个项目需要的时间:5天
·项目开发
·需求分析:
·作为一名排球爱好者,我希望在观看比赛时能实时显示比赛双方的得分情况,以便于我能更好的去观看比赛(精确到局比分)。
·设计文档
·由排球比赛用户故事的需求分析可知,此程序是用来查询显示比赛双方的得分情况,及比赛的胜负结果的。
·计划复审
·正在进一步的商讨中。
·代码规范
·根据Visual Studio 2010规范去写。
·具体设计
·UML活动图
·具体编码
·部分代码如下
//Model层
public class paiqiu
{
public int ID { get; set; }
public string zong { get; set; }
public string one { get; set; }
public string two { get; set; }
public string three { get; set; }
public string four { get; set; }
public string five { get; set; }
}
//paiqiuDal层
public class paiqiuDll
{
public paiqiu Select()
{
string sql = "select * from bifen where Id=2";
paiqiu pq = null;
using (SqlDataReader reader = SqlHelper.ExecuteReader(sql))
{
if (reader.HasRows)
{
while (reader.Read())
{
pq = new paiqiu();
pq.ID = (int)reader["Id"];
pq.zong = reader["zong"].ToString();
pq.one = reader["one"].ToString();
pq.two = reader["two"].ToString();
pq.three = reader["three"].ToString();
pq.four = reader["four"].ToString();
pq.five = reader["five"].ToString();
}
}
}
return pq;
}
}
//paiqiuBll层
public class paiqiuBll
{
private paiqiuDll Dll = new paiqiuDll();
public paiqiu GetSelectpaiqiu()
{
return Dll.Select();
}
}
//paiqiuUI
public partial class Index : System.Web.UI.Page
{
private paiqiuBll Bll = new paiqiuBll();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
paiqiu pq = new paiqiu();
pq = Bll.GetSelectpaiqiu();
txtzong.Text = pq.zong;
txtone.Text = pq.one;
txttwo.Text = pq.two;
txtthree.Text = pq.three;
txtfour.Text = pq.four;
txtfive.Text = pq.five;
}
}
·界面显示如下:
·数据库、数据表结构如下: