protected override void OnMgrEvent(object sender, OVRMgr2PluginEventArgs e) { switch (e.Type) { case OVRMgr2PluginEventType.emMatchSelected: { if (m_frmEQPlugin != null) { m_frmEQPlugin.OnMsgFlushSelMatch(0, GVAR.Str2Int(e.Args.ToString())); SetReportContext("MatchID", e.Args.ToString()); } break; } case OVRMgr2PluginEventType.emRptContextQuery: { m_frmEQPlugin.QueryReportContext(e.Args as OVRReportContextQueryArgs); break; } } }
private void dgvMatchOfficial_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 || e.RowIndex < 0) { return; } int iColumnIndex = e.ColumnIndex; int iRowIndex = e.RowIndex; String strColumnName = dgvMatchOfficial.Columns[iColumnIndex].Name; DataGridViewCell CurCell = dgvMatchOfficial.Rows[iRowIndex].Cells[iColumnIndex]; if (CurCell != null) { int iRegisterID = GVAR.Str2Int(dgvMatchOfficial.Rows[iRowIndex].Cells["F_RegisterID"].Value); int iFunctionID = 0; int iPositionID = 0; if (CurCell is DGVCustomComboBoxCell) { DGVCustomComboBoxCell CurCell1 = CurCell as DGVCustomComboBoxCell; if (strColumnName.CompareTo("Function") == 0) { iFunctionID = GVAR.Str2Int(CurCell1.Tag); UpdateOfficialFunction(m_iMatchID, iRegisterID, iFunctionID); } else { iPositionID = GVAR.Str2Int(CurCell1.Tag); UpdateOfficialPosition(m_iMatchID, iRegisterID, iPositionID); } } else { return; } } ResetMatchOfficial(); }
//每个动作分打完后都需要发送一次分数给OVR,OVR需要计算当前的平均分 private void HandleXmlScore(int judgeNum, XmlDocument xmlScore) { // 获取比赛标示和比分列表 XmlNodeList xmlScoreList = null; xmlScoreList = xmlScore.SelectNodes("/Scores/Score"); //分数是否有效 bool bIsLegal = true; //是否确认提交 bool bIsValidated = false; //当前舞步 int iScore = 0; //直接入库,存入resultdetail foreach (XmlNode xmlScoreNode in xmlScoreList) { iScore++; string strScoreID = ((XmlElement)xmlScoreNode).GetAttribute("ScoreID"); string strScoreValue = ((XmlElement)xmlScoreNode).GetAttribute("ScoreValue"); //如果为"",表示没打分 decimal fScore = GVAR.Str2Decimal(strScoreValue); if (!strScoreID.Equals("F_TotalScore") && !strScoreID.Equals("F_Status")) { if (!strScoreID.Equals("F_0") && !IslegalSocre(strScoreValue)) { bIsLegal = false; } //将打过的分更新到数据库,调用存储过程更新resultdetail if (strScoreValue != "") { GVAR.g_EQDBManager.UpdateDetailScore(m_iCurMatchID, m_iCurRegisterID, judgeNum, strScoreID, fScore); } else { GVAR.g_EQDBManager.UpdateDetailScoreNull(m_iCurMatchID, m_iCurRegisterID, judgeNum, strScoreID); } } //如果扣分不为0 if (strScoreID.Equals("F_0")) { GVAR.g_EQDBManager.UpdateJudgePointsWhenDetailScoreChange(m_iCurMatchID, m_iCurRegisterID, 1); GVAR.g_EQDBManager.UpdateJudgePointsWhenDetailScoreChange(m_iCurMatchID, m_iCurRegisterID, 2); GVAR.g_EQDBManager.UpdateJudgePointsWhenDetailScoreChange(m_iCurMatchID, m_iCurRegisterID, 3); GVAR.g_EQDBManager.UpdateJudgePointsWhenDetailScoreChange(m_iCurMatchID, m_iCurRegisterID, 4); GVAR.g_EQDBManager.UpdateJudgePointsWhenDetailScoreChange(m_iCurMatchID, m_iCurRegisterID, 5); } //如果ipad发送了V按钮,同时分数都合法,则更新detail的状态为1 if (strScoreID.Equals("F_Status") && GVAR.Str2Int(strScoreValue) == 1 && bIsLegal) { GVAR.g_EQDBManager.UpdateDetailScore(m_iCurMatchID, m_iCurRegisterID, judgeNum, "F_Status", 1); bIsValidated = true; } } //计算和更新裁判点总分和百分比分 GVAR.g_EQDBManager.UpdateJudgePointsWhenDetailScoreChange(m_iCurMatchID, m_iCurRegisterID, judgeNum); //更新当前总 GVAR.g_EQDBManager.UpdateCurPointsWhenScoreChanged(m_iCurMatchID, m_iCurRegisterID, 1); //更新累计总 GVAR.g_EQDBManager.UpdateTotPointsWhenCurPointsChanged(m_iCurMatchID, m_iCurRegisterID); //触发dataentry刷新dgv //如果IPAD点击了确认,刷新主界面 if (bIsValidated) { m_EventIpadMark(this, new frmIPadMark2frmDataEntryEventArgs(frmIPadMark2frmDataEntryEventType.emUpdateDgvResult, null)); } m_EventIpadMark(this, new frmIPadMark2frmDataEntryEventArgs(frmIPadMark2frmDataEntryEventType.emUpdateDgvResultDetail, null)); //自动显示下一个动作 //MovementNextOperate(); }
private void dgvMatchConfig_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } Int32 iColumnIndex = e.ColumnIndex; Int32 iRowIndex = e.RowIndex; String strColumnName = dgvMatchConfig.Columns[iColumnIndex].Name; DataGridViewCell CurCell = dgvMatchConfig.Rows[iRowIndex].Cells[iColumnIndex]; Int32 iInputValue = 0; decimal fInputValue = 0; String strInputString = ""; //如果是combobox则保存CurCell的Tag if (CurCell.Value == null) { GVAR.g_EQDBManager.UpdateMatchConfigNull(MatchConfigID, strColumnName); } else { if (dgvMatchConfig.Columns[e.ColumnIndex].Name == "F_RiderInterval" || dgvMatchConfig.Columns[e.ColumnIndex].Name == "F_Judge" || dgvMatchConfig.Columns[e.ColumnIndex].Name == "F_Type") { strInputString = "'" + CurCell.Value.ToString() + "'"; GVAR.g_EQDBManager.UpdateMatchConfig(MatchConfigID, strColumnName, strInputString); } else if (dgvMatchConfig.Columns[e.ColumnIndex].Name == "F_Penalties") { try { fInputValue = Convert.ToDecimal(CurCell.Value); } catch (System.Exception ex) { fInputValue = 0; } GVAR.g_EQDBManager.UpdateMatchConfig(MatchConfigID, strColumnName, fInputValue); } else if (dgvMatchConfig.Columns[e.ColumnIndex].Name == "F_TimeAllowed" && m_iMatchConfigID == 7) { try { iInputValue = GVAR.Str2Int(GVAR.StrTime2Decimal(CurCell.Value).ToString()); GVAR.g_EQDBManager.UpdateMatchConfig(MatchConfigID, strColumnName, iInputValue); } catch (System.Exception ex) { GVAR.g_EQDBManager.UpdateMatchConfigNull(MatchConfigID, strColumnName); } } else { try { iInputValue = Convert.ToInt32(CurCell.Value); GVAR.g_EQDBManager.UpdateMatchConfig(MatchConfigID, strColumnName, iInputValue); } catch (System.Exception ex) { GVAR.g_EQDBManager.UpdateMatchConfigNull(MatchConfigID, strColumnName); } } } }