Пример #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));
        }
Пример #2
0
        //对此场进行操作后,在TS_Match,F_MatchComment2中记录下当前系统时间,

        //这样其他客户端可利用比较时间的方法,轮询此时间判断自己是否需要更新

        //同时,把自己的时间同步为数据库时间,自己避免再次刷新
        public static bool dbMatchModifyTimeSet()
        {
            String strSql = String.Format("UPDATE TS_Match SET F_MatchComment3 = CONVERT(NVARCHAR(100), GETDATE(), 21) WHERE F_MatchID = {0}", g_nMatchID);

            bool bRet = (Common.dbExecuteNonQuery(strSql) == 1);

            if (bRet)
            {
                m_TimeDbModify = Common.dbMatchModifyTimeGet();
            }

            return(bRet);
        }