首页 > 代码库 > 排球计分员程序

排球计分员程序

技术分享

开发流程如下:

项目计划

   完成这个项目需要的时间:两星期

项目开发

  需求分析:

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

  设计文档

    由排球比赛用户故事的需求分析可知,此程序是用来记录现场比分情况。

  计划复审

 目前在进行中

  代码规范

技术分享    根据Visual Studio 2010规范去写。

  具体设计

技术分享

 <configuration>
    <connectionStrings>
      <add name="itcase"
           connectionString="server=.;database=itcase;Integrated Security=true" />
    </connectionStrings>
  </configuration>

public static  class SqlHelper  

   {

         private static readonly string constr = ConfigurationManager.ConnectionStrings["ball"].ConnectionString;

           public static int ExecuteNonQuery(string sql, params SqlParameter[] pms)   

               {     

                     using (SqlConnection con = new SqlConnection(strConn))

                         {  

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

            }

}

技术分享 private void cmb1_SelectedValueChanged(object sender, EventArgs e)

        {  

                       if (this.cmb1.Text.Equals("第一场"))

                       {

                               this.txt1.Text = "34";

                               this.txt2.Text = "24";  

                   if (i)

                {  

                   int a = int.Parse(txt1.Text);    

                   int b = int.Parse(txt2.Text);

                    sumA += a;

                    sumB += b;

                    this.sumGrade(sumA, sumB);

                    i = false;

                    if (a > b)

                         {

                        shengchang++;

                        this.textBox3.Text = shengchang.ToString();

                          }

                    else if (a < b)

                           {

                        bshengchang++;

                        this.textBox4.Text = bshengchang.ToString();

                           }

                }

总结:不太会,还在改善中。

排球计分员程序