• 排球计分程序(记分员):


    排球计分程序(记分员):

    一,设计
    估计这个任务需要多少时间  两星期


    二,开发

    1,需求分析---》拆成任务,编写代码 两星期

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

    任务:a,作为记分员需要知道每场比赛的比分,及增长情况;
             b,观众及运动员、教练员及时掌握比赛状况;

    2,生成设计文档 六天

    由排球用户故事的需求可知,这个程序用来统计各个队伍的比分与比分增长情况,

    3,设计复审 讨论,写文档

    4,代码规范 根据vs2010进行规范

    5,具体代码

    namespace BLL
    {

    public class MembersBll
    {
    MembersDAL membersdal = new MembersDAL();

    public bool InsertMembersBll(Members m)
    {
    return membersdal.InsertMemberDal(m) > 0;
    }

    public List<string> GetTeamBNameBll(string s)
    {
    List<string> teamBList = membersdal.GetTeamBName(s);
    return teamBList;
    }

    public List<string> GetTeamMembers(string tname, string mname = null)
    {
    List<string> teamMemberList = membersdal.GetTeamMembers(tname,mname);
    return teamMemberList;
    }
    }
    }

    namespace BLL
    {
    public class GetOtherDataBll
    {
    GetOtherDataDAL getdata = new GetOtherDataDAL();

    public DataTable SelectInfoBll(string team, string member)
    {
    return getdata.SelectInfoDal(team,member);
    }
    }
    }

    namespace DAL
    {
    public class SingleBallDAL
    {
    /// 把单个球的记录插入到数据表
    public int InsertBallInfo(SingleBall sb)
    {
    string sql = "insert into SingleBall values"+
    "(@BallNum,@GetTeam,@WinTeamScore,@LoseTeamScore,@GetMemberNum,@HowGet,@LoseMemberNum)";
    SqlParameter[] pms = {
    new SqlParameter("@BallNum",sb.BallNum),
    new SqlParameter("@GetTeam",sb.GetTeam),
    new SqlParameter("@WinTeamScore",sb.WinTeamScore),
    new SqlParameter("@LoseTeamScore",sb.LoseTeamScore),
    new SqlParameter("@GetMemberNum",sb.GetMemberNum),
    new SqlParameter("@HowGet",sb.HowGet),
    new SqlParameter("@LoseMemberNum",sb.LoseMemberNum),
    };
    return SqlHelper.ExecuteNonQuery(sql, pms);
    }
    }
    }

    public static class SqlHelper

    {
    //获取连接字符串
    private static readonly string constr =
    ConfigurationManager.ConnectionStrings["ClassroomPc"].ConnectionString;
    ExecuteNonQuery() 方法
    ExecuteScalar() 方法
    ExecuteReader() 方法
    ExecuteDataTable() 方法*/

    //执行增删改的
    public static int ExecuteNonQuery(string sql, params SqlParameter[] pms)

    using (SqlConnection con = new SqlConnection(constr))
    {
    //创建执行SQL命令对象
    using (SqlCommand cmd = new SqlCommand(sql, con))
    {
    //判断是否传递了SQL参数
    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();
    }
    }
    }

    //执行返回SqlDataReader,用于获取一条或多条数据
    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; 
    }
    }

    }

    //执行返回DataTable
    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;
    }
    }

    public partial class showForm : Form
    {
    public static showForm SF = new showForm();
    public showForm()
    {
    InitializeComponent();
    SF = this;
    }

    public void DisplayScore(params string[] scoreNow)
    {
    this.lblTeamA.Text = scoreNow[0];
    this.lblTeamB.Text = scoreNow[1];
    this.gBoxNowResult.Text = scoreNow[2];
    this.juA.Text = scoreNow[3];
    this.juB.Text = scoreNow[4];
    this.SA.Text = scoreNow[5];
    this.SB.Text = scoreNow[6];
    }



    public partial class BeginForm : Form
    {
    public BeginForm()
    {
    InitializeComponent();
    }

    int scoreA = 0;
    int scoreB = 0;
    int juANum = 0;
    int juBNum = 0;
    int juCount = 1;
    string ju = "第一局";
    int ballNum = 0; 

    showForm F = null;

    private void BeginForm_Load(object sender, EventArgs e)
    {

    this.Location = new Point(0, 0);

    cmbTeam.Items.Clear();
    cmbTeam.Items.Add("请选择队伍");
    cmbTeam.Items.Add("查全部队伍");
    cmbTeam.SelectedIndex = 1;
    cmbTeamA.Items.Clear();
    cmbTeamA.Items.Add("<请选择队伍");
    cmbTeamA.SelectedIndex = 0;
    MembersBll membersbll = new MembersBll();
    List<string> allTeamList = membersbll.GetTeamBNameBll("null");
    for (int i = 0; i < allTeamList.Count; i++)
    {
    cmbTeam.Items.Add(allTeamList[i]);
    cmbTeamA.Items.Add(allTeamList[i]);
    }

    }

    private void btnSave_Click(object sender, EventArgs e)
    {

    Members m = new Members();

    if (String.IsNullOrEmpty(m.MName) || String.IsNullOrEmpty(m.TName) || String.IsNullOrEmpty(m.Number)||String.IsNullOrEmpty(m.Position) ||
    String.IsNullOrEmpty(m.Weight) || String.IsNullOrEmpty(m.Height))
    {
    MessageBox.Show("请检查一边");
    }
    else
    {
    MembersBll mbll = new MembersBll();
    bool successInsert = mbll.InsertMembersBll(m);
    if (mbll.InsertMembersBll(m) == true)
    {
    MessageBox.Show("插入成功");
    }
    else
    {
    MessageBox.Show("插入信息失败");
    }

    }
    }
    private void btnClear_Click(object sender, EventArgs e)
    {
    txtMName.Text = "";
    txtNumber.Text = "";
    txtPosition.Text = "";
    txtWeight.Text = "";
    txtHeight.Text = "";
    txtNickName.Text = "";
    txtStrength.Text = "";
    }

    6,代码复审   四小时

    7,测试    修改代码,提交代码     四小时

    三,报告:

    1,测试报告:两小时

    2,计算工作量:一小时

    3,事后总结:里边还有不足,需要多加改进。

  • 相关阅读:
    Centos7静态ip设置(亲测有效)
    14个Xcode中常用的快捷键操作(转)
    C,C++经典笔试题(答案)转自:http://blog.163.com/jianhuali0118@126/blog/static/377499702008230104125229/
    Cocos2d-x 3.2 项目源代码从Mac打包到安卓教程【转自:http://www.2cto.com/kf/201410/342649.html】
    NumPy的详细教程
    我对自己提的几个关于cocos2dx的几个问题
    为什么将类的构造函数设为私有的成员函数?
    cocos2d事件处理机制之我见
    windows7 + cocos2d-x 3.2 +vs2012 速度真的很慢
    CCActionManager
  • 原文地址:https://www.cnblogs.com/1383817277a/p/6568328.html
Copyright © 2020-2023  润新知