private void MenuItem_Click(object sender, RoutedEventArgs e) { MenuItem menuItem = sender as MenuItem; if (grdAction.SelectedIndex < 0) { return; } MatchAction ma = grdAction.SelectedItem as MatchAction; if (menuItem.Tag.ToString() == "update") { UpdateMatchAction updateMatchAction = new UpdateMatchAction(ma.ActionNumberID); updateMatchAction.ShowDialog(); } else if (menuItem.Tag.ToString() == "del") { if (System.Windows.Forms.DialogResult.OK == GVAR.MsgBox("Are you confirm to delete the current action? ", "Warning", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Warning)) { GVAR.g_ManageDB.DeleteMatchAction(ma.ActionNumberID); } } InitialActionDataGrid(m_curMatchID); }
private void ButtonOK_Click(object sender, System.Windows.RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(txtScoreaway.Text) || string.IsNullOrWhiteSpace(txtScorehome.Text) || string.IsNullOrWhiteSpace(txtTime.Text)) { GVAR.MsgBox("Can not have empty field!"); return; } string regRule = @"^\d{2}:\d{2}$"; Regex regex = new Regex(regRule); Match m = regex.Match(txtTime.Text); if (!m.Success) { GVAR.MsgBox("time pattern is error. must be 05:34"); return; } try { MatchAction matchAction = new MatchAction(); matchAction.ActionNumberID = m_actionNumberID; matchAction.ActionTypeID = int.Parse(cbAction.SelectedValue.ToString()); matchAction.Period = int.Parse(cbPeriod.SelectedValue.ToString()); matchAction.MatchTime = txtTime.Text; matchAction.ScoreHome = int.Parse(txtScorehome.Text); matchAction.ScoreAway = int.Parse(txtScoreaway.Text); matchAction.ShirtNumber = int.Parse(cbShirtNumber.SelectedValue.ToString()); GVAR.g_ManageDB.UpdateMatchAction(matchAction); } catch { } finally { ClosewindowEvent(); } }
private void BtnStatus_Click(object sender, RoutedEventArgs e) { System.Windows.Controls.Button btn = sender as System.Windows.Controls.Button; int newStatus = Convert.ToInt32(btn.Tag); if (newStatus == m_curMatchStatus) { return; } if (m_curMatchStatus != (int)MatchStatus.Scheduled && newStatus == (int)MatchStatus.StartList) { if (System.Windows.Forms.DialogResult.Cancel == GVAR.MsgBox("Are you confirm to change status to \"STARTLIST\"? To do this,all the match data will be cleared!", "Warning", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Warning)) { return; } } if (newStatus == (int)MatchStatus.Unofficial || newStatus == (int)MatchStatus.Official) { if (m_homeTeamScore.ScoreTotal > m_awayTeamScore.ScoreTotal) { m_homeTeamScore.ResultID = GVAR.RESULT_TYPE_WIN; m_homeTeamScore.RankID = GVAR.RANK_TYPE_1ST; m_awayTeamScore.ResultID = GVAR.RESULT_TYPE_LOSE; m_awayTeamScore.RankID = GVAR.RANK_TYPE_2ND; } else if (m_homeTeamScore.ScoreTotal == m_awayTeamScore.ScoreTotal) { m_homeTeamScore.ResultID = GVAR.RESULT_TYPE_TIE; m_homeTeamScore.RankID = GVAR.RANK_TYPE_TIE; m_awayTeamScore.ResultID = GVAR.RESULT_TYPE_TIE; m_awayTeamScore.RankID = GVAR.RANK_TYPE_TIE; } else if (m_homeTeamScore.ScoreTotal < m_awayTeamScore.ScoreTotal) { m_homeTeamScore.ResultID = GVAR.RESULT_TYPE_LOSE; m_homeTeamScore.RankID = GVAR.RANK_TYPE_2ND; m_awayTeamScore.ResultID = GVAR.RESULT_TYPE_WIN; m_awayTeamScore.RankID = GVAR.RANK_TYPE_1ST; } GVAR.g_ManageDB.UpdateMatchRank(m_curMatchID, m_homeTeamScore.RankID, m_homeTeamScore.ResultID, 1); GVAR.g_ManageDB.UpdateMatchRank(m_curMatchID, m_awayTeamScore.RankID, m_awayTeamScore.ResultID, 2); } if (OVRDataBaseUtils.ChangeMatchStatus(m_curMatchID, newStatus, GVAR.g_adoDataBase.DBConnect, GVAR.g_RUPlugin) != 1) { Log.WriteLog("RU_Error", "调用OVRDataBaseUtils.ChangeMatchStatus改变状态失败!"); GVAR.MsgBox("Change match status failed!"); return; } else { if (newStatus == (int)MatchStatus.Unofficial || newStatus == (int)MatchStatus.Official) { GVAR.g_ManageDB.AutoProgressMatch(m_curMatchID); } GVAR.g_RUPlugin.DataChangedNotify(AutoSports.OVRCommon.OVRDataChangedType.emMatchStatus, -1, -1, -1, GVAR.g_matchID, GVAR.g_matchID, null); } CurMatchStatus = newStatus; GVAR.g_RUPlugin.UpdateMatchList(); CloseStatusWindow(); }