Exemplo n.º 1
0
        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;
                }
            }
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        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;
            }
        }
Exemplo n.º 5
0
        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;
            }
        }
Exemplo n.º 6
0
        protected override void OnMgrEvent(object sender, OVRMgr2PluginEventArgs e)
        {
            switch (e.Type)
            {
            case OVRMgr2PluginEventType.emMatchSelected:
            {
                if (m_frmGFPlugin != null)
                {
                    m_frmGFPlugin.OnMsgFlushSelMatch(0, GFCommon.Str2Int(e.Args.ToString()));
                }
                break;
            }

            case OVRMgr2PluginEventType.emRptContextQuery:
            {
                m_frmGFPlugin.QueryReportContext(e.Args as OVRReportContextQueryArgs);
                break;
            }
            }
        }
Exemplo n.º 7
0
        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();
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        private void SaveCompetitionRule2XML()
        {
            Int32  iColCount;
            String strHole;
            String strHoleName;
            String strPar;
            String strDistance;
            String strXML;

            if (dgvCourseDetail.Rows.Count != 2 || dgvCourseDetail.Columns.Count == 0)
            {
                return;
            }

            iColCount = dgvCourseDetail.Columns.Count;

            strHole = iColCount.ToString();
            strXML  = "<CourseInfo NumHoles=\"" + strHole + "\">";

            for (Int32 iCol = 0; iCol < iColCount; iCol++)
            {
                strHoleName = dgvCourseDetail.Columns[iCol].Name;
                strPar      = GFCommon.GetFieldValue(dgvCourseDetail, 0, iCol);
                strDistance = GFCommon.GetFieldValue(dgvCourseDetail, 1, iCol);

                strXML = strXML + "<HoleRule HoleNum=\"" + strHoleName + "\" HolePar=\"" + strPar + "\" HoleDistance=\"" + strDistance + "\" />";
            }

            strXML = strXML + "</CourseInfo>";

            if (1 != dgvCourseList.SelectedRows.Count)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(LocalizationRecourceManager.GetString(GFCommon.g_strSectionName, "MsgDelRule4"));
                return;
            }

            Int32 nRuleID = Convert.ToInt32(dgvCourseList.SelectedRows[0].Cells["F_CompetitionRuleID"].Value);

            GFCommon.g_ManageDB.UpdateCourseDetail(nRuleID, strXML);
        }
Exemplo n.º 10
0
        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();
            }
        }
Exemplo n.º 11
0
        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;
            }
        }
Exemplo n.º 12
0
        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);
                        }
                    }
                }
            }
        }
Exemplo n.º 13
0
        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);
                }
            }
        }
Exemplo n.º 14
0
        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);
                            }
                        }
                    }
                }
            }
        }