Esempio n. 1
0
        private bool UpdateScoreToDB()
        {
            string strPtsWinA   = _dgvWinLose[1, 0].Value == null ? "" : _dgvWinLose[1, 0].Value.ToString();
            string strPtsWinB   = _dgvWinLose[1, 1].Value == null ? "" : _dgvWinLose[1, 1].Value.ToString();
            string strPtsLoseA  = _dgvWinLose[2, 0].Value == null ? "" : _dgvWinLose[2, 0].Value.ToString();
            string strPtsLoseB  = _dgvWinLose[2, 1].Value == null ? "" : _dgvWinLose[2, 1].Value.ToString();
            string strSetsWinA  = _dgvWinLose[3, 0].Value == null ? "" : _dgvWinLose[3, 0].Value.ToString();
            string strSetsWinB  = _dgvWinLose[3, 1].Value == null ? "" : _dgvWinLose[3, 1].Value.ToString();
            string strSetsLoseA = _dgvWinLose[4, 0].Value == null ? "" : _dgvWinLose[4, 0].Value.ToString();
            string strSetsLoseB = _dgvWinLose[4, 1].Value == null ? "" : _dgvWinLose[4, 1].Value.ToString();
            string strGrpPtsA   = _dgvWinLose[5, 0].Value == null ? "" : _dgvWinLose[5, 0].Value.ToString();
            string strGrpPtsB   = _dgvWinLose[5, 1].Value == null ? "" : _dgvWinLose[5, 1].Value.ToString();

            SqlCommand dbCmd = new SqlCommand("proc_VB_PRG_MatchSetScoreWinLose");

            dbCmd.CommandType = CommandType.StoredProcedure;
            dbCmd.Parameters.AddWithValue("@MatchID", Common.g_nMatchID);
            dbCmd.Parameters.AddWithValue("@PtsWinA", strPtsWinA == "" ? (object)DBNull.Value : Common.Str2Int(strPtsWinA));
            dbCmd.Parameters.AddWithValue("@PtsWinB", strPtsWinB == "" ? (object)DBNull.Value : Common.Str2Int(strPtsWinB));
            dbCmd.Parameters.AddWithValue("@PtsLoseA", strPtsLoseA == "" ? (object)DBNull.Value : Common.Str2Int(strPtsLoseA));
            dbCmd.Parameters.AddWithValue("@PtsLoseB", strPtsLoseB == "" ? (object)DBNull.Value : Common.Str2Int(strPtsLoseB));
            dbCmd.Parameters.AddWithValue("@SetsWinA", strSetsWinA == "" ? (object)DBNull.Value : Common.Str2Int(strSetsWinA));
            dbCmd.Parameters.AddWithValue("@SetsWinB", strSetsWinB == "" ? (object)DBNull.Value : Common.Str2Int(strSetsWinB));
            dbCmd.Parameters.AddWithValue("@SetsLoseA", strSetsLoseA == "" ? (object)DBNull.Value : Common.Str2Int(strSetsLoseA));
            dbCmd.Parameters.AddWithValue("@SetsLoseB", strSetsLoseB == "" ? (object)DBNull.Value : Common.Str2Int(strSetsLoseB));
            dbCmd.Parameters.AddWithValue("@GroupPointsA", strGrpPtsA == "" ? (object)DBNull.Value : Common.Str2Int(strGrpPtsA));
            dbCmd.Parameters.AddWithValue("@GroupPointsB", strGrpPtsB == "" ? (object)DBNull.Value : Common.Str2Int(strGrpPtsB));

            dbCmd.Parameters.AddWithValue("@Result", DBNull.Value);
            dbCmd.Parameters["@Result"].Size      = 4;
            dbCmd.Parameters["@Result"].SqlDbType = SqlDbType.Int;
            dbCmd.Parameters["@Result"].Direction = ParameterDirection.Output;

            return(Common.dbExecuteNonQuery(ref dbCmd));
        }