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

    计划:

    估计需要10天

    开发:

    需求分析:

    作为一名现场记分员,我希望详细记录比赛现场比分增长情况,以便观众及运动员、教练员及时掌握比赛状况。(满意条件:每一次比分的改变,都要形成一条记录)

    3、生成设计文档:

    4、设计复审:三个小时


    5、代码规范 无


    6、具体编码:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Data;
    using System.Data.SqlClient;
    using System.Configuration;

    /// <summary>
    ///SqlHelper 
    /// </summary>

    //连接数据库
    public static class SqlHelper
    {
    public SqlHelper()
    {

    private static readonly string constr = ConfigurationManager.ConnectionStrings["conStr"].ConnectionString;
    public static int ExecuteNonQuery(string sql,params SqlParameter[] pms)
    {
    using (SqlConnection con = new SqlConnection(constr))
    {
    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(constr))
    {
    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(constr);
    using (SqlCommand cmd = new SqlCommand(sql, con))
    {
    if (pms != null)
    {
    cmd.Parameters.AddRange(pms);

    }
    try
    {
    con.Open();
    return cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
    }
    catch(Exception)
    {
    con.Close();
    con.Dispose();
    throw;
    }
    }
    }
    public static DataTable ExecuteDataTable(string sql, params SqlParameter[] pms)
    {
    DataTable dt = new DataTable();
    using (SqlDataAdapter adapter = new SqlDataAdapter(sql, constr))
    {
    if (pms != null)
    {
    adapter.SelectCommand.Parameters.AddRange(pms);

    }
    adapter.Fill(dt);
    }
    return dt;
    }

    }


    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Management;
    using System.IO;

    namespace 排球
    {
    public partial class ZhuShou : Form
    {

    public ZhuShou()
    {
    InitializeComponent();
    }private void btnOK_Click(object sender, EventArgs e){

    string ZhuGong111 = txtZhuGong1.Text;
    string ZhuGong222 = txtZhuGong2.Text;
    string FuGong111 = txtFuGong1.Text;
    string FuGong222 = txtFuGong2.Text;
    string JieYing111 = txtJieYing.Text;
    string ErChuan111 = txtErChuan.Text;
    string ZiYouRen111 = txtZiYouRen.Text;
    if (string.IsNullOrEmpty(ZhuGong111)) { MessageBox.Show("输入本场比赛的主攻手一"); }
    else if (string.IsNullOrEmpty(ZhuGong222)) { MessageBox.Show("输入本场比赛的主攻手二"); }
    else
    {
    groupBox1.Visible = false;
    groupBox2.Visible = true;
    linkZhuGong1.Text = ZhuGong1.Text + txtZhuGong1.Text;
    linkFuGong1.Text=FuGong1.Text+txtFuGong1.Text;
    linkZhuGong2.Text = ZhuGong2.Text + txtZhuGong2.Text;
    linkFuGong2.Text = FuGong2.Text + txtFuGong2.Text;
    linkJieYing.Text = JieYing.Text + txtJieYing.Text;
    linkErChuan.Text = ErChuan.Text + txtErChuan.Text;
    linkZiYouRen.Text = ZiYouRen.Text + txtZiYouRen.Text;

    }

    private void ZhuShou_Load(object sender, EventArgs e)
    {
    groupBox1.Visible = true;
    groupBox2.Visible = false;
    }
    int i = 0;

    private void button1_Click(object sender, EventArgs e)
    {
    i++;
    txtFen.AppendText (lblName.Text + button1.Text + " " + i); 
    }
    int FQ = 0;
    private void btnFaQiu_Click(object sender, EventArgs e)
    {
    FQ++;
    txtFen.AppendText(lblName.Text+btnFaQiu.Text+" "+FQ);
    }
    int KQ=0;
    private void btnKouQiu_Click(object sender, EventArgs e)
    {
    KQ++;
    txtFen.AppendText(lblName.Text + btnKouQiu.Text + " " + KQ); 
    }
    int CW=0;
    private void btnChouWang_Click(object sender, EventArgs e)
    {
    CW++;
    txtFen.AppendText(lblName.Text + btnChouWang.Text + " " + CW);
    }
    int DQ = 0;
    private void btnDiaoQiu_Click(object sender, EventArgs e)
    {
    DQ++;
    txtFen.AppendText(lblName.Text + btnDiaoQiu.Text + " " + DQ);
    }
    int LWCJ = 0;
    private void btnLWChuJie_Click(object sender, EventArgs e)
    {
    LWCJ++;
    txtFen.AppendText(lblName.Text + btnLWChuJie.Text + " " + LWCJ);
    }
    int FQSW = 0;
    private void btnFaQiuShiWu_Click(object sender, EventArgs e)
    {
    FQSW++;
    txtFen.AppendText(lblName.Text + btnFaQiuShiWu.Text + " " + FQSW);
    }
    int KQCJ = 0;
    private void btnKouQiuChuJie_Click(object sender, EventArgs e)
    {
    KQCJ++;
    txtFen.AppendText(lblName.Text + btnKouQiuChuJie.Text + " " + KQCJ);
    }
    private void lastOK_Click(object sender, EventArgs e)
    {
    FileStream fs = new FileStream("C:\file.txt", FileMode.OpenOrCreate, FileAccess.Write);
    StreamWriter m_streamWriter = new StreamWriter(fs);
    m_streamWriter.Flush(); 
    m_streamWriter.BaseStream.Seek(0, SeekOrigin.Begin);
    m_streamWriter.Write(txtFen.Text); 
    m_streamWriter.Close();
    MessageBox.Show("比赛结束!");
    7、代码复审:1h

    8、报告
    测试报告:30min
    计算工作量:12天
    事后总结:
    还不完善,有待提高与改进,希望老师和同学多多指教。

  • 相关阅读:
    int 和 Integer 有什么区别?
    内部类可以引用它的外部类的成员吗?有没有什么限制?
    为什么Java不支持运算符重载?
    生命周期内create和mounted的区别?
    JSP有哪些动作?分别是什么?
    vue解除双向绑定?
    实现一个函数功能:sum(1,2,3,4..n)转化为 sum(1)(2)(3)(4)…(n)?
    新旧生命周期?
    vue异步组件?
    XML文档约束有哪几种?有什么区别?
  • 原文地址:https://www.cnblogs.com/fujunyi/p/6568384.html
Copyright © 2011-2022 走看看