//从数据库刷新界面 //未从新刷新队员等信息,所以只能用于中途刷新 private bool scoreInfoRefresh() { //获取比分 GameGeneralBall gameObj = new GameGeneralBall(); if (Common.dbGetMatch2GameObj(Common.g_nMatchID, ref gameObj)) { //将比分对象覆盖当前的 Common.g_Game = gameObj; //刷新比分 dgvMatchScoreRefresh(); } else { Debug.Assert(false); } return(true); }
protected override void OnMgrEvent(object sender, OVRMgr2PluginEventArgs e) { switch (e.Type) { case OVRMgr2PluginEventType.emMatchSelected: //选择比赛时 { if (m_frmPlugin.Enabled) { if (MessageBox.Show("直接切换比赛?", "切换比赛", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } } int nMatchID = Common.Str2Int(e.Args.ToString()); if (nMatchID <= 0) { Debug.Assert(false); return; } DataTable tblMatch = Common.dbGetMatchInfo(nMatchID, Common.g_strLanguage); if (tblMatch == null || tblMatch.Rows.Count < 1 || tblMatch.Columns.Count < 1) { MessageBox.Show("exec proc_VB_PRG_MatchInfo failed.\n读取新比赛基础数据失败! 未切换比赛!"); return; } Int32 nDisciplineID = Common.Str2Int(tblMatch.Rows[0]["F_DisciplineID"]); Int32 nEventID = Common.Str2Int(tblMatch.Rows[0]["F_EventID"]); Int32 nTeamRegIDA = Common.Str2Int(tblMatch.Rows[0]["F_TeamARegID"]); Int32 nTeamRegIDB = Common.Str2Int(tblMatch.Rows[0]["F_TeamBRegID"]); String strTeamANoc = tblMatch.Rows[0]["F_TeamANoc"].ToString(); String strTeamBNoc = tblMatch.Rows[0]["F_TeamBNoc"].ToString(); String strTeamAName = tblMatch.Rows[0]["F_TeamAName"].ToString(); String strTeamBName = tblMatch.Rows[0]["F_TeamBName"].ToString(); String strVenue = tblMatch.Rows[0]["F_VenueDes"].ToString(); if (nDisciplineID <= 0 || nEventID <= 0) { MessageBox.Show("SprotID,nDispID,nEventID不正确! 未切换比赛!"); return; } if (nTeamRegIDA <= 0 || nTeamRegIDB <= 0) { MessageBox.Show("该场比赛未指派双方队伍! 未切换比赛!"); return; } if (strVenue.Length == 0) { if (MessageBox.Show("该比赛未指定场馆,是否继续?", "切换比赛", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } } //如果是新建比赛,通过GameObject写入一次库 int nCretaeMatchResult = Common.dbInitMatch(nMatchID, 5, false); if (nCretaeMatchResult == 0) { MessageBox.Show("exec proc_VB_PRG_MatchCreate failed.\n在数据库中初始化新比赛局信息失败! 未切换比赛!"); return; } else if (nCretaeMatchResult == 1) { GameGeneralBall newGameObj = new GameGeneralBall(); if (!Common.dbGetMatch2GameObj(nMatchID, ref newGameObj)) { MessageBox.Show("exec proc_VB_PRG_MatchInfo failed.\n读取新比赛比分数据失败! 未切换比赛!"); //以后改成强行重置选项 return; } //再往库中写一次,是为了避免第一次进入比赛后,没有局标示的问题5 if (!Common.dbGameObj2Db(nMatchID, newGameObj)) { MessageBox.Show("exec proc_VB_PRG_MatchSetScore failed.\n写入新比分数据失败! 未切换比赛!"); return; } } GameGeneralBall gameObj = new GameGeneralBall(); if (!Common.dbGetMatch2GameObj(nMatchID, ref gameObj)) { MessageBox.Show("exec proc_VB_PRG_MatchInfo failed.\n读取比赛比分数据失败! 未切换比赛!"); return; } //开始切换比赛 Common.g_Game = gameObj; Common.g_nDiscID = nDisciplineID; Common.g_nEventID = nEventID; Common.g_nMatchID = nMatchID; Common.g_nTeamRegIDA = nTeamRegIDA; Common.g_nTeamRegIDB = nTeamRegIDB; Common.g_strNocA = strTeamANoc; Common.g_strNocB = strTeamBNoc; SetReportContext("MatchID", Common.g_nMatchID.ToString()); m_frmPlugin.OnMatchChanged(0); break; } case OVRMgr2PluginEventType.emRptContextQuery: { if (e == null || e.Args == null) { return; } OVRReportContextQueryArgs rptQuery = e.Args as OVRReportContextQueryArgs; switch (rptQuery.Name) { case "MatchID": { rptQuery.Value = Common.g_nMatchID.ToString(); rptQuery.Handled = true; } break; case "DisciplineID": { rptQuery.Value = Common.g_nDiscID.ToString(); rptQuery.Handled = true; } break; default: break; } break; } } }