private void dgvPlayer_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button == MouseButtons.Right) { dgvPlayer.ContextMenu = null; dgvPlayer.ContextMenuStrip = null; string strColumnName = dgvPlayer.Columns[e.ColumnIndex].Name; if (strColumnName == "Name") { dgvPlayer.Rows[e.RowIndex].Selected = true; dgvPlayer.ContextMenu = null; dgvPlayer.ContextMenuStrip = contextMenu_IRM; Int32 iCompetitionPosition = -1; string strCompetitionPosition = ""; strCompetitionPosition = dgvPlayer.Rows[e.RowIndex].Cells["F_CompetitionPosition"].Value.ToString(); iCompetitionPosition = GFCommon.ConvertStrToInt(strCompetitionPosition); m_strOldIRM = GFCommon.g_ManageDB.GetPlayerIRM(m_iCurMatchID, iCompetitionPosition); SetIRM_MenuStrip(m_strOldIRM); m_iCurCompetitionPosition = iCompetitionPosition; } } }
private void btnx_OK_Click(object sender, EventArgs e) { m_iTee = GFCommon.ConvertStrToInt(tb_Tees.Text); m_strStartTime = dti_StartTime.Text; Boolean bResult = GFCommon.g_ManageDB.UpdateMatchGroup(m_iCurMatchID, m_iGroup, m_iTee, m_strStartTime); if (bResult) { this.DialogResult = DialogResult.OK; } this.Close(); }
private void btnx_OKSetTee_Click(object sender, EventArgs e) { m_iStart = GFCommon.ConvertStrToInt(tb_Start.Text); m_iFinish = GFCommon.ConvertStrToInt(tb_Finish.Text); m_iTee = GFCommon.ConvertStrToInt(tb_Tees.Text); bool bResult = GFCommon.g_ManageDB.SetMatchTee(m_iCurMatchID, m_iStart, m_iFinish, m_iTee, m_strStartTime, m_strSpanTime); if (bResult) { this.DialogResult = DialogResult.OK; } this.Close(); }
private void dgvTeam_CellEndEdit(object sender, DataGridViewCellEventArgs e) { Int32 nRowIndex = e.RowIndex; if (dgvTeam.Columns[e.ColumnIndex].Name.CompareTo("Pos") == 0) { string strOldData = m_dtOldTeam.Rows[nRowIndex]["Pos"].ToString(); string strNewData = ""; if (dgvTeam.Rows[e.RowIndex].Cells["Pos"].Value != null) { strNewData = dgvTeam.Rows[e.RowIndex].Cells["Pos"].Value.ToString(); bool bIsInt = true; for (int i = 0; i < strNewData.Length; i++) { if (!Char.IsNumber(strNewData, i)) { bIsInt = false; } } if (!bIsInt) { dgvTeam.Rows[e.RowIndex].Cells["Pos"].Value = strOldData; return; } if (int.Parse(strNewData) <= 0) { dgvTeam.Rows[e.RowIndex].Cells["Pos"].Value = strOldData; return; } } if (strNewData == strOldData) { return; } Int32 iTeamID = -1; string strTeamID = ""; strTeamID = dgvTeam.Rows[e.RowIndex].Cells["F_TeamID"].Value.ToString(); iTeamID = GFCommon.ConvertStrToInt(strTeamID); int nDisPos = int.Parse(strNewData); GFCommon.g_ManageDB.UpdateTeamDisPos(m_iCurMatchID, iTeamID, nDisPos); return; } }
private void btnx_ApplyCourse_Click(object sender, EventArgs e) { String strMessage = LocalizationRecourceManager.GetString(GFCommon.g_strSectionName, "MsgApplySelRule1"); if (DevComponents.DotNetBar.MessageBoxEx.Show(strMessage, GFCommon.g_strSectionName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } Int32 nRuleID = GFCommon.ConvertStrToInt(cmbCourseList.SelectedValue.ToString()); if (GFCommon.g_ManageDB.ApplayCourse(m_iCurMatchID, nRuleID)) { DataEntryChangeMatchRuleHandler.Invoke(); InitMatchInfo(); cmbCourseList.SelectedValue = m_iCurMatchRuleID; } }
private void btnx_OKCreateGroup_Click(object sender, EventArgs e) { m_iSides = GFCommon.ConvertStrToInt(tb_Sides.Text); String strMessage = LocalizationRecourceManager.GetString(GFCommon.g_strSectionName, "MsgGreateGroup1"); if (DevComponents.DotNetBar.MessageBoxEx.Show(strMessage, GFCommon.g_strSectionName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } bool bResult = GFCommon.g_ManageDB.CreateMatchGroup(m_iCurMatchID, m_iSides); if (bResult) { this.DialogResult = DialogResult.OK; } this.Close(); }
void FillPlayerOUTIN(Int32 nRowIndex) { Int32 nOUT = 0; Int32 nIN = 0; Int32 nColumn = m_dtHolePar.Columns.Count / 2; for (Int32 i = 0; i < nColumn; i++) { string strOUT = Convert.ToString(i + 1); string strIN = Convert.ToString(nColumn + i + 1); string strOUTValue = m_dtOldPlayer.Rows[nRowIndex][strOUT].ToString(); string strINValue = m_dtOldPlayer.Rows[nRowIndex][strIN].ToString(); nOUT += GFCommon.ConvertStrToInt(strOUTValue); nIN += GFCommon.ConvertStrToInt(strINValue); } dgvPlayer.Rows[nRowIndex].Cells["OUT"].Value = GFCommon.ConvertIntToStr(nOUT); dgvPlayer.Rows[nRowIndex].Cells["IN"].Value = GFCommon.ConvertIntToStr(nIN); }
private void btnx_ModifyGroup_Click(object sender, EventArgs e) { if (m_iCurMatchID < 1 || dgvPlayer.RowCount < 1) { return; } if (1 != dgvPlayer.SelectedRows.Count) { DevComponents.DotNetBar.MessageBoxEx.Show(LocalizationRecourceManager.GetString(GFCommon.g_strSectionName, "MsgModifyGroup1")); return; } Int32 iRowIdx = dgvPlayer.SelectedRows[0].Index; string strGroup = dgvPlayer.Rows[iRowIdx].Cells["Group"].Value.ToString(); if (strGroup == "") { DevComponents.DotNetBar.MessageBoxEx.Show(LocalizationRecourceManager.GetString(GFCommon.g_strSectionName, "MsgModifyGroup2")); return; } frmModifyGroup frmModifyGroup = new frmModifyGroup(); frmModifyGroup.m_iCurMatchID = m_iCurMatchID; frmModifyGroup.m_iGroup = GFCommon.ConvertStrToInt(strGroup); frmModifyGroup.ShowDialog(); if (frmModifyGroup.DialogResult == DialogResult.OK) { FillGridViewPlayer(); FillGridViewPlayerColor(); FillGridViewTeam(); } }
private void dgvPlayer_CellEndEdit(object sender, DataGridViewCellEventArgs e) { Int32 nRowIndex = e.RowIndex; if (dgvPlayer.Columns[e.ColumnIndex].Name.CompareTo("Time") == 0) { string strOldData = m_dtOldPlayer.Rows[nRowIndex]["Time"].ToString(); string strNewData = ""; if (dgvPlayer.Rows[e.RowIndex].Cells["Time"].Value != null) { strNewData = dgvPlayer.Rows[e.RowIndex].Cells["Time"].Value.ToString(); try { DateTime dtTemp = Convert.ToDateTime(strNewData); } catch { dgvPlayer.Rows[e.RowIndex].Cells["Time"].Value = strOldData; return; } } if (strNewData == strOldData) { return; } Int32 iCompetitionID = -1; string strCompetitionID = ""; strCompetitionID = dgvPlayer.Rows[e.RowIndex].Cells["F_CompetitionPosition"].Value.ToString(); iCompetitionID = GFCommon.ConvertStrToInt(strCompetitionID); GFCommon.g_ManageDB.UpdatePlayerMatchTime(m_iCurMatchID, iCompetitionID, strNewData); return; } else if (dgvPlayer.Columns[e.ColumnIndex].Name.CompareTo("Group") == 0) { string strOldData = m_dtOldPlayer.Rows[nRowIndex]["Group"].ToString(); string strNewData = ""; if (dgvPlayer.Rows[e.RowIndex].Cells["Group"].Value != null) { strNewData = dgvPlayer.Rows[e.RowIndex].Cells["Group"].Value.ToString(); bool bIsInt = true; for (int i = 0; i < strNewData.Length; i++) { if (!Char.IsNumber(strNewData, i)) { bIsInt = false; } } if (!bIsInt) { dgvPlayer.Rows[e.RowIndex].Cells["Group"].Value = strOldData; return; } } if (strNewData == strOldData) { return; } Int32 iCompetitionID = -1; string strCompetitionID = ""; strCompetitionID = dgvPlayer.Rows[e.RowIndex].Cells["F_CompetitionPosition"].Value.ToString(); iCompetitionID = GFCommon.ConvertStrToInt(strCompetitionID); Int32 iGroup = GFCommon.ConvertStrToInt(strNewData); GFCommon.g_ManageDB.UpdatePlayerMatchGroup(m_iCurMatchID, iCompetitionID, iGroup); return; } else if (dgvPlayer.Columns[e.ColumnIndex].Name.CompareTo("Sides") == 0) { string strOldData = m_dtOldPlayer.Rows[nRowIndex]["Sides"].ToString(); string strNewData = ""; if (dgvPlayer.Rows[e.RowIndex].Cells["Sides"].Value != null) { strNewData = dgvPlayer.Rows[e.RowIndex].Cells["Sides"].Value.ToString(); bool bIsInt = true; for (int i = 0; i < strNewData.Length; i++) { if (!Char.IsNumber(strNewData, i)) { bIsInt = false; } } if (!bIsInt) { dgvPlayer.Rows[e.RowIndex].Cells["Sides"].Value = strOldData; return; } } if (strNewData == strOldData) { return; } Int32 iCompetitionID = -1; string strCompetitionID = ""; strCompetitionID = dgvPlayer.Rows[e.RowIndex].Cells["F_CompetitionPosition"].Value.ToString(); iCompetitionID = GFCommon.ConvertStrToInt(strCompetitionID); Int32 iSides = GFCommon.ConvertStrToInt(strNewData); GFCommon.g_ManageDB.UpdatePlayerMatchSides(m_iCurMatchID, iCompetitionID, iSides); return; } else if (dgvPlayer.Columns[e.ColumnIndex].Name.CompareTo("Tee") == 0) { string strOldData = m_dtOldPlayer.Rows[nRowIndex]["Tee"].ToString(); string strNewData = ""; if (dgvPlayer.Rows[e.RowIndex].Cells["Tee"].Value != null) { strNewData = dgvPlayer.Rows[e.RowIndex].Cells["Tee"].Value.ToString(); bool bIsInt = true; for (int i = 0; i < strNewData.Length; i++) { if (!Char.IsNumber(strNewData, i)) { bIsInt = false; } } if (!bIsInt) { dgvPlayer.Rows[e.RowIndex].Cells["Tee"].Value = strOldData; return; } } if (strNewData == strOldData) { return; } Int32 iCompetitionID = -1; string strCompetitionID = ""; strCompetitionID = dgvPlayer.Rows[e.RowIndex].Cells["F_CompetitionPosition"].Value.ToString(); iCompetitionID = GFCommon.ConvertStrToInt(strCompetitionID); Int32 iTee = GFCommon.ConvertStrToInt(strNewData); GFCommon.g_ManageDB.UpdatePlayerMatchTee(m_iCurMatchID, iCompetitionID, iTee); return; } else if (dgvPlayer.Columns[e.ColumnIndex].Name.CompareTo("Pos") == 0) { string strOldData = m_dtOldPlayer.Rows[nRowIndex]["Pos"].ToString(); string strNewData = ""; if (dgvPlayer.Rows[e.RowIndex].Cells["Pos"].Value != null) { strNewData = dgvPlayer.Rows[e.RowIndex].Cells["Pos"].Value.ToString(); bool bIsInt = true; for (int i = 0; i < strNewData.Length; i++) { if (!Char.IsNumber(strNewData, i)) { bIsInt = false; } } if (!bIsInt) { dgvPlayer.Rows[e.RowIndex].Cells["Pos"].Value = strOldData; return; } } if (strNewData == strOldData) { return; } Int32 iCompetitionID = -1; string strCompetitionID = ""; strCompetitionID = dgvPlayer.Rows[e.RowIndex].Cells["F_CompetitionPosition"].Value.ToString(); iCompetitionID = GFCommon.ConvertStrToInt(strCompetitionID); string strPos = strNewData; //Int32 iTee = GFCommon.ConvertStrToInt(strNewData); GFCommon.g_ManageDB.UpdatePlayerMatchPos(m_iCurMatchID, iCompetitionID, strPos); return; } else { string strColumnName = dgvPlayer.Columns[e.ColumnIndex].Name; Int32 iHole = GFCommon.ConvertStrToInt(strColumnName); if (iHole < 0 || iHole > m_dtHolePar.Columns.Count) { return; } Int32 nPar = GFCommon.ConvertStrToInt(m_dtHolePar.Rows[0][strColumnName].ToString()); string strOldData = m_dtOldPlayer.Rows[nRowIndex][strColumnName].ToString(); string strNewData = ""; if (dgvPlayer.Rows[e.RowIndex].Cells[strColumnName].Value != null) { strNewData = dgvPlayer.Rows[e.RowIndex].Cells[strColumnName].Value.ToString(); bool bIsInt = true; for (int i = 0; i < strNewData.Length; i++) { if (!Char.IsNumber(strNewData, i)) { bIsInt = false; } } if (!bIsInt) { dgvPlayer.Rows[e.RowIndex].Cells[strColumnName].Value = strOldData; return; } } if (strNewData == strOldData) { return; } if (strNewData == "") { strNewData = "0"; } m_dtOldPlayer.Rows[nRowIndex][strColumnName] = strNewData; Int32 iHoleNumber = GFCommon.ConvertStrToInt(strNewData); if (iHoleNumber == 0) { dgvPlayer.Rows[e.RowIndex].Cells[strColumnName].Value = ""; } Int32 iCompetitionID = -1; string strCompetitionID = ""; strCompetitionID = dgvPlayer.Rows[e.RowIndex].Cells["F_CompetitionPosition"].Value.ToString(); iCompetitionID = GFCommon.ConvertStrToInt(strCompetitionID); GFCommon.g_ManageDB.UpdatePlayerHoleNum(m_iCurMatchID, iCompetitionID, iHole, iHoleNumber, 1); FillHoleColor(e.RowIndex, e.ColumnIndex, iHole, iHoleNumber, strColumnName); FillPlayerOUTIN(e.RowIndex); FillPlayerRank(); FillGridViewTeam(); return; } }
public void UpdateMatchHoleNumFromTcp(String strSexCode, String strEventCode, String strRound, String strRegisterCode, String strHole, String strScore, int nDoRank) { Int32 nMatchID, nCompetitionID, nHole, nHoleNum; nMatchID = GFCommon.g_ManageDB.GetTcpMatchID(strSexCode, strEventCode, strRound); nHole = GFCommon.ConvertStrToInt(strHole); nHoleNum = GFCommon.ConvertStrToInt(strScore); if (nMatchID > 0) { nCompetitionID = GFCommon.g_ManageDB.GetTcpCompetitionID(nMatchID, strRegisterCode); if (nCompetitionID > 0) { Boolean bResult = false; bResult = GFCommon.g_ManageDB.UpdatePlayerHoleNum(nMatchID, nCompetitionID, nHole, nHoleNum, nDoRank); if (bResult && nMatchID == m_iCurMatchID && m_bIsRunning) { Int32 nRow, nCol, iHole, iHoleNum; iHole = GFCommon.ConvertStrToInt(strHole); iHoleNum = GFCommon.ConvertStrToInt(strScore); int n = 0; for (n = 0; n < dgvPlayer.RowCount; n++) { string strTempCompetitionID = dgvPlayer.Rows[n].Cells["F_CompetitionPosition"].Value.ToString(); if (strTempCompetitionID == nCompetitionID.ToString()) { break; } } nRow = n; nCol = 0; if (iHole > 0 && iHole < 10) { nCol = 9 + iHole; } else if (iHole > 9 && iHole < 19) { nCol = 10 + iHole; } if (dgvPlayer.Rows[nRow].Cells[strHole].Value != null) { dgvPlayer.Rows[nRow].Cells[strHole].Value = strScore; if (strScore.Length == 0) { m_dtOldPlayer.Rows[nRow][strHole] = DBNull.Value; } else { m_dtOldPlayer.Rows[nRow][strHole] = strScore; } FillHoleColor(nRow, nCol, iHole, iHoleNum, strHole); FillPlayerOUTIN(nRow); FillPlayerRank(); FillDataGridViewTeamForTcp(); } } else { if (GFCommon.g_GFPlugin != null) { GFCommon.g_GFPlugin.DataChangedNotify(OVRDataChangedType.emMatchResult, -1, -1, -1, nMatchID, nMatchID, null); } } } } }
void FillHoleColor(Int32 nRowIndex, Int32 nColIndex, Int32 nHole, Int32 nHoleNum, string strColName) { string strPar = m_dtHolePar.Rows[0][strColName].ToString(); Int32 nPar = GFCommon.ConvertStrToInt(strPar); if (nHoleNum > 0) { Int32 nSub = nHoleNum - nPar; if (nSub == 0) { dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.ForeColor = System.Drawing.Color.Black; if (nRowIndex % 2 == 0) { dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.BackColor = System.Drawing.Color.FromArgb(230, 239, 248); } else { dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.BackColor = System.Drawing.Color.FromArgb(202, 221, 238); } } else if (nSub == -1) { dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.ForeColor = System.Drawing.Color.Red; if (nRowIndex % 2 == 0) { dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.BackColor = System.Drawing.Color.FromArgb(230, 239, 248); } else { dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.BackColor = System.Drawing.Color.FromArgb(202, 221, 238); } } else if (nSub < -1) { dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.ForeColor = System.Drawing.Color.Red; dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.BackColor = System.Drawing.Color.Yellow; } else if (nSub == 1) { dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.ForeColor = System.Drawing.Color.Blue; if (nRowIndex % 2 == 0) { dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.BackColor = System.Drawing.Color.FromArgb(230, 239, 248); } else { dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.BackColor = System.Drawing.Color.FromArgb(202, 221, 238); } } else if (nSub > 1) { dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.ForeColor = System.Drawing.Color.White; dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.BackColor = System.Drawing.Color.Blue; } } else { dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.ForeColor = System.Drawing.Color.Black; if (nRowIndex % 2 == 0) { dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.BackColor = System.Drawing.Color.FromArgb(230, 239, 248); } else { dgvPlayer.Rows[nRowIndex].Cells[nColIndex].Style.BackColor = System.Drawing.Color.FromArgb(202, 221, 238); } } }
void FillGridViewPlayerColor() { for (int j = 0; j < dgvPlayer.RowCount; j++) { for (int m = 0; m < dgvPlayer.Columns.Count; m++) { string strColName = dgvPlayer.Columns[m].Name; if (strColName == "OUT") { dgvPlayer.Rows[j].Cells[m].Style.BackColor = System.Drawing.Color.Violet; } else if (strColName == "IN") { dgvPlayer.Rows[j].Cells[m].Style.BackColor = System.Drawing.Color.Violet; } else if (strColName == "F_CompetitionPosition" || strColName == "Order" || strColName == "NOC" || strColName == "Name" || strColName == "Group" || strColName == "Sides" || strColName == "Tee" || strColName == "Time" || strColName == "Round Rank" || strColName == "Total" || strColName == "Pos") { } else { string strPar = m_dtHolePar.Rows[0][strColName].ToString(); Int32 nPar = GFCommon.ConvertStrToInt(strPar); string strHole = dgvPlayer.Rows[j].Cells[m].Value.ToString(); if (strHole != "" && strHole != "0") { Int32 nHoleNum = GFCommon.ConvertStrToInt(strHole); Int32 nSub = nHoleNum - nPar; if (nSub == 0) { dgvPlayer.Rows[j].Cells[m].Style.ForeColor = System.Drawing.Color.Black; } else if (nSub == -1) { dgvPlayer.Rows[j].Cells[m].Style.ForeColor = System.Drawing.Color.Red; } else if (nSub < -1) { dgvPlayer.Rows[j].Cells[m].Style.ForeColor = System.Drawing.Color.Red; dgvPlayer.Rows[j].Cells[m].Style.BackColor = System.Drawing.Color.Yellow; } else if (nSub == 1) { dgvPlayer.Rows[j].Cells[m].Style.ForeColor = System.Drawing.Color.Blue; } else if (nSub > 1) { dgvPlayer.Rows[j].Cells[m].Style.ForeColor = System.Drawing.Color.White; dgvPlayer.Rows[j].Cells[m].Style.BackColor = System.Drawing.Color.Blue; } } else { if (j % 2 == 0) { dgvPlayer.Rows[j].Cells[m].Style.BackColor = System.Drawing.Color.FromArgb(230, 239, 248); } else { dgvPlayer.Rows[j].Cells[m].Style.BackColor = System.Drawing.Color.FromArgb(202, 221, 238); } } } } } }