十六周个人作业
- 計(jì)劃
??????? 估計(jì)此程序需要3-5天。
- 開(kāi)發(fā)
- 需求分析
????????? 用戶(hù)故事:作為一個(gè)觀(guān)眾,我希望了解某一場(chǎng)比賽的比分,以便了解賽況。(滿(mǎn)意條件:精確到每一局的結(jié)果比分)。
????????? 從分析用例故事可以知道完成此程序需要這兩項(xiàng)任務(wù):選擇隊(duì)伍和查詢(xún)比賽記錄。
????????? 以下為改程序的活動(dòng)圖:
- ? 代碼規(guī)范:使用Vs2010和帕斯卡命名法和駱駝命名法 。
?
- 具體設(shè)計(jì):
?????????????以下為程序的類(lèi)圖:
- 具體編碼
???????????? 以下為部分代碼:
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('同一支隊(duì)伍之間不能比賽!')</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('同一支隊(duì)伍之間沒(méi)有比賽!')</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 }?????????
???? 以下為選擇隊(duì)伍的界面:
???? ???? 以下為查詢(xún)后的界面:
?
關(guān)于代碼復(fù)審,測(cè)試和之后的報(bào)告,會(huì)在接下來(lái)的幾天時(shí)間內(nèi)完成并逐漸完善自己的程序。
轉(zhuǎn)載于:https://www.cnblogs.com/hutengqi/p/6216138.html
總結(jié)
- 上一篇: 11.4 专利法与反不正当竞争法解读
- 下一篇: js数组去重的四种方式