zoukankan      html  css  js  c++  java
  • 十六周个人作业

    • 计划

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

    • 开发
    • 需求分析

              用户故事:作为一个观众,我希望了解某一场比赛的比分,以便了解赛况。(满意条件:精确到每一局的结果比分)。

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

              以下为改程序的活动图:

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

                 以下为程序的类图:

    • 具体编码

                 以下为部分代码:

     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 }

             

         以下为选择队伍的界面:

              以下为查询后的界面:

     

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

  • 相关阅读:
    Packet for query is too large (1986748 > 1048576). You can change this value on the server by 异常
    解决springdatajpa插入大量数据速度慢的问题
    thymeleaf onclick方法向js方法传递参数
    git的使用(扫盲)
    【错误总结】Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
    SpringBoot集成Swagger(Swagger的使用),生成接口文档,方便前后端分离开发
    spring中后台接收参数总结
    PTA 03-树3 Tree Traversals Again (25分)
    PTA 03-树2 List Leaves (25分)
    PTA 03-树1 树的同构 (25分)
  • 原文地址:https://www.cnblogs.com/hutengqi/p/6216138.html
Copyright © 2011-2022 走看看