• 十八周个人作业


    • 计划

            估计此程序需要3-5天。

    • 开发
    • 需求分析

              用户故事:作为一个赛事管理人员,我希望知道每场比赛队伍得分和积分情况,以便给每队进行排名。

              从分析用例故事可以知道完成此程序需要这两项任务:选择业务和查询队伍积分排名。

              以下为改程序的活动图:

    •   代码规范:使用Vs2010和帕斯卡命名法和骆驼命名法 。
    • 具体设计:

    根据《2015-2016赛季中国排球联赛竞赛规程》,积分规则如下:
    1、计分方式:比赛结果为3:0、3:1时,胜队积3分,负队积0分;比赛结果为3:2时,胜队积2分,负队积1分;积分高者排名在前。
    2、当积分相等时,决定名次顺序为:①胜场;②总胜局/总输局(C值);③总得分/总失分(Z值)。
    3、当三队或三队以上Z值仍相等时,则仅在该几队之间依次按照上述第2条决定名次办法①、②、③决定。

                故需要建立表头为:队伍名称,胜场,总胜局/总输局,总得分/总失分,积分,名次的数据表。

                 以下为程序的类图:

    • 具体编码

                 以下为部分代码:

     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 }

                   以下为选择队伍的界面:

              以下为查询后的界面:

    关于代码复审,测试和之后的报告,会在接下来的几天时间内完成并逐渐完善自己的程序。

  • 相关阅读:
    书写高效的CSS
    _blank开新窗口不符合标准?
    IE6支持PNG透明(alpha通道)的4种方法
    jQuery插件支持天干地支阴历阳历万年历节假日红字显示记事等功能的日历插件(1)
    讓你的windowsXP支持四桌面,類似Ubuntu的效果
    MySql语句常见操作创建数据库,选择数据库,创建表,数据库中文乱码;
    解决<pre>标签里的文本换行(兼容IE, FF和Opera等)
    使用jquyer擴展方法定義屬於自己的氣泡提示
    jQuery插件通用input或textarea靜態ajax修改功能插件
    SEO的经验
  • 原文地址:https://www.cnblogs.com/hutengqi/p/6246638.html
Copyright © 2020-2023  润新知