标签:data space sys select 技术分享 edit span dir volley
估计此程序需要3-5天。
用户故事:作为一个观众,我希望了解某一场比赛的比分,以便了解赛况。(满意条件:精确到每一局的结果比分)。
从分析用例故事可以知道完成此程序需要这两项任务:选择队伍和查询比赛记录。
以下为改程序的活动图:
以下为程序的类图:
以下为部分代码:
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Web;
5 using System.Web.UI;
6 using System.Web.UI.WebControls;
7 using VolleyballBll;
8 using Moudel;
9
10 namespace VolleyballUI
11 {
12 public partial class Index : System.Web.UI.Page
13 {
14 private TeamBll teamBll = new TeamBll();
15
16 protected void Page_Load(object sender, EventArgs e)
17 {
18 if (!IsPostBack)
19 {
20 BindDropDownList();
21 }
22 }
23
24 protected void btnSaveName_Click(object sender, EventArgs e)
25 {
26 Team team = new Team();
27 team.Name=TeamName.Text.Trim();
28 if (teamBll.GetInsertTeamName(team))
29 {
30 Response.Redirect("Index.aspx");
31 }
32 else
33 {
34 Response.Write("<script>alert(‘添加失败‘)</script>");
35 }
36 }
37
38 public void BindDropDownList()
39 {
40 DropDownListA.DataSource = teamBll.GetSelectAllTeams();
41 DropDownListA.DataTextField = "Name";
42 DropDownListA.DataValueField = "ID";
43 DropDownListA.DataBind();
44 DropDownListB.DataSource = teamBll.GetSelectAllTeams();
45 DropDownListB.DataTextField = "Name";
46 DropDownListB.DataValueField = "ID";
47 DropDownListB.DataBind();
48 }
49
50 protected void btnSave_Click(object sender, EventArgs e)
51 {
52 if (DropDownListA.SelectedItem.Text == DropDownListB.SelectedItem.Text)
53 {
54 Response.Write("<script>alert(‘同一支队伍之间不能比赛!‘)</script>");
55 }
56 else
57 {
58 Response.Redirect("Main.aspx?TeamA=" + DropDownListA.SelectedItem.Text + "&TeamB=" + DropDownListB.SelectedItem.Text);
59 }
60 }
61
62 protected void btnSelect_Click(object sender, EventArgs e)
63 {
64 if (DropDownListA.SelectedItem.Text == DropDownListB.SelectedItem.Text)
65 {
66 Response.Write("<script>alert(‘同一支队伍之间没有比赛!‘)</script>");
67 }
68 else
69 {
70 Response.Redirect("Select.aspx?TeamA=" + DropDownListA.SelectedItem.Text + "&TeamB=" + DropDownListB.SelectedItem.Text);
71 }
72 }
73 }
74 }
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Web;
5 using System.Web.UI;
6 using System.Web.UI.WebControls;
7 using Moudel;
8 using System.Data.SqlClient;
9 using VolleyballBll;
10
11 namespace VolleyballUI
12 {
13 public partial class Select : System.Web.UI.Page
14 {
15 private GameBll gameBll = new GameBll();
16 protected void Page_Load(object sender, EventArgs e)
17 {
18 Game game = new Game();
19 game.TeamA = Request.QueryString["TeamA"];
20 game.TeamB = Request.QueryString["TeamB"];
21 if (!IsPostBack)
22 {
23 SelectTable.DataSource= gameBll.GetSelectGame(game);
24 SelectTable.DataBind();
25 }
26 }
27 }
28 }
以下为选择队伍的界面:
以下为查询后的界面:
关于代码复审,测试和之后的报告,会在接下来的几天时间内完成并逐渐完善自己的程序。
标签:data space sys select 技术分享 edit span dir volley
原文地址:http://www.cnblogs.com/hutengqi/p/6216138.html