Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        //int _nScore = 0;
        //bool _bDirPlus = true;

        //轮询数据库刷新用的
        private void timerDbRefresh_Tick(object sender, EventArgs e)
        {
            //避免在执行期间,时钟多重启动
            m_timerDbRefresh.Enabled = false;


            // Auto add Score for test.

            /*
             * //////
             * int nScore = Common.g_Game.GetScoreSet(false);
             * Debug.Assert(nScore == _nScore);
             *
             * if (_bDirPlus && nScore == 25) _bDirPlus = false;
             * if (!_bDirPlus && nScore == 0) _bDirPlus = true;
             *
             * if (_bDirPlus)
             * {
             *      BtnScoreAddReduce_Click(btnScoreAddA, null);
             *      _nScore++;
             * }
             * else
             * {
             *      BtnScoreAddReduce_Click(btnScoreReduceA, null);
             *      _nScore--;
             * }
             *
             * Debug.Assert(Common.g_Game.GetScoreSet(false) == _nScore);
             * ////////
             */

            string timeDbModify = Common.dbMatchModifyTimeGet();

            if (Common.m_TimeDbModify != timeDbModify)
            {
                Common.m_TimeDbModify = timeDbModify;


                UpdateMatchStatus();

                bool bRunning   = (btnx_Running.Checked || btnx_Revision.Checked);
                bool bStartlist = btnx_StartList.Checked;
                bool bStat      = _tabMain.SelectedTab == _tabHeaderStatDouble || _tabMain.SelectedTab == _tabHeaderTeamA || _tabMain.SelectedTab == _tabHeaderTeamB;
                SetMatchOperateEnable(bRunning, bStartlist, bStat);

                scoreInfoRefresh();
                timeoutSubtitutionRefresh();
                propertyGridSetup.Refresh();

                //做STAT的按钮们都没有点,全部刷新,如果点中过某些STAT,则只刷新列表

                if (btnStatEntryTemErr.Enabled == true)
                {
                    statInfoReferesh();
                }
                else
                {
                    DataSet   dataAction    = Common.dbActionListGetList(Common.g_nMatchID, GetStatCurSet());
                    DataTable tblActionList = dataAction != null && dataAction.Tables.Count > 0 ? dataAction.Tables[0] : null;
                    dgvActionListRefresh(tblActionList);
                }
            }

            m_timerDbRefresh.Enabled = true;
        }