zoukankan      html  css  js  c++  java
  • 排球积分程序

    开发流程如下:

    项目计划

       完成这个项目需要的时间:5-7天

    项目开发

      需求分析:

       作为一名现场记分员,我希望详细记录比赛现场比分增长情况,以便观众及运动员、教练员及时掌握比赛状况。

      设计文档

        由排球比赛用户故事的需求分析可知,此程序是用来统计各个队伍的比分和积分情况,每一次比分的改变,都要形成一条记录。

      计划复审

     目前在进行中

      代码规范

        根据Visual Studio 2010规范去写。

      具体设计

       URL活动图如下:

    代码如下:

    namespace LessonDAL
    {
    public class SqlHelper
    {
    private static readonly string strcon = ConfigurationManager.ConnectionStrings["connectionStr"].ConnectionString;
    public static int ExecuteNonQuery(string sql,params SqlParameter[] pms)
    {
    using (SqlConnection con = new SqlConnection(strcon))
    {
    using(SqlCommand cmd=new SqlCommand (sql,con))
    {
    if(pms!=null)
    {
    cmd.Parameters.AddRange(pms);
    }
    con.Open();
    return cmd.ExecuteNonQuery();
    }
    }
    }

    public static object ExecuteScalar(string sql, params SqlParameter[] pms)
    {
    using (SqlConnection con = new SqlConnection(strcon))
    {
    using (SqlCommand cmd = new SqlCommand(sql, con))
    {
    if (pms != null)
    {
    cmd.Parameters.AddRange(pms);
    }
    con.Open();
    return cmd.ExecuteScalar();
    }
    }
    }

    public static SqlDataReader ExecuteReader(string sql, params SqlParameter[] pms)
    {
    SqlConnection con = new SqlConnection(strcon);
    using (SqlCommand cmd = new SqlCommand(sql, con))
    {
    if (pms != null)
    {
    cmd.Parameters.AddRange(pms);
    }
    con.Open();
    return cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection); ;
    }
    }

    public static DataTable ExecuteDataTable(string sql, params SqlParameter[] pms)
    {
    DataTable dt = new DataTable();
    using(SqlDataAdapter adapter=new SqlDataAdapter (sql,strcon))
    {
    if(pms!=null)
    {
    adapter.SelectCommand.Parameters.AddRange(pms);
    }
    adapter.Fill(dt);
    }
    return dt;
    }

     

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using VolleyballBll;
    using Moudel;

    namespace VolleyballUI
    {
    public partial class Index : System.Web.UI.Page
    {
    private TeamBll teamBll = new TeamBll();

    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
    BindDropDownList();
    }
    }

    protected void btnSaveName_Click(object sender, EventArgs e)
    {
    Team team = new Team();
    team.Name=TeamName.Text.Trim();
    if (teamBll.GetInsertTeamName(team))
    {
    Response.Redirect("Index.aspx");
    }
    else
    {
    Response.Write("<script>alert('添加失败')</script>");
    }
    }

    public void BindDropDownList()
    {
    DropDownListA.DataSource = teamBll.GetSelectAllTeams();
    DropDownListA.DataTextField = "Name";
    DropDownListA.DataValueField = "ID";
    DropDownListA.DataBind();
    DropDownListB.DataSource = teamBll.GetSelectAllTeams();
    DropDownListB.DataTextField = "Name";
    DropDownListB.DataValueField = "ID";
    DropDownListB.DataBind();
    }

    protected void btnSave_Click(object sender, EventArgs e)
    {
    if (DropDownListA.SelectedItem.Text == DropDownListB.SelectedItem.Text)
    {
    Response.Write("<script>alert('同一支队伍之间不能比赛!')</script>");
    }
    else
    {
    Response.Redirect("Main.aspx?TeamA=" + DropDownListA.SelectedItem.Text + "&TeamB=" + DropDownListB.SelectedItem.Text);
    }
    }

    protected void btnSelect_Click(object sender, EventArgs e)
    {
    if (DropDownListA.SelectedItem.Text == DropDownListB.SelectedItem.Text)
    {
    Response.Write("<script>alert('同一支队伍之间没有比赛!')</script>");
    }
    else
    {
    Response.Redirect("Select.aspx?TeamA=" + DropDownListA.SelectedItem.Text + "&TeamB=" + DropDownListB.SelectedItem.Text);
    }
    }
    }
    }

  • 相关阅读:
    CSS 字体
    列表排列
    IE6 fixed 页面抖动
    HTML中css和js链接中的版本号(刷新缓存)
    CSS3 box-shadow
    CSS3的文字阴影—text-shadow
    [LeetCode][JavaScript]Add Digits
    [LeetCode][JavaScript]Max Points on a Line
    [LeetCode][JavaScript]Subsets II
    [LeetCode][JavaScript]Subsets
  • 原文地址:https://www.cnblogs.com/9288yalan/p/6568217.html
Copyright © 2011-2022 走看看