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);
    }
    }
    }
    }

  • 相关阅读:
    一个利用扩展方法的实例:AttachDataExtensions
    正则表达式语法
    正则表达式30分钟入门教程
    js正则验证两位小数 验证数字最简单正则表达式大全
    SQL Server DBA三十问【转】
    Vue(踩坑)vue.esm.js?efeb:628 [Vue warn]: Error in render: "TypeError: Cannot read property 'length' of undefined" found in
    vue(有必要做的项目优化)
    vue_(根据多种条件过滤评论内容)
    vue(ref父组件使用子组件中定义的方法)
    Vuex(实现加减操作,Vue.set解决自定义属性没有双向数据绑定)
  • 原文地址:https://www.cnblogs.com/9288yalan/p/6568217.html
Copyright © 2011-2022 走看看