• 排球计分程序


    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 = "";
    }

  • 相关阅读:
    pytroch tensor初始化权重、改变tensor某行列为指定值
    蜜蜂寻路
    童年生活二三事
    母牛的故事
    星际密码
    斐波那契凤尾
    客似云来
    养兔子
    NowCoder数列
    采花生
  • 原文地址:https://www.cnblogs.com/JWY829/p/6568393.html
Copyright © 2020-2023  润新知