Exemple #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            int iColIdx     = dgvAvailOfficial.Columns["F_RegisterID"].Index;
            int iFuncColIdx = dgvAvailOfficial.Columns["F_FunctionID"].Index;

            for (int i = 0; i < dgvAvailOfficial.SelectedRows.Count; i++)
            {
                int iRowIdx = dgvAvailOfficial.SelectedRows[i].Index;

                string strRegisterID = dgvAvailOfficial.Rows[iRowIdx].Cells[iColIdx].Value.ToString();
                string strFunctionID = dgvAvailOfficial.Rows[iRowIdx].Cells[iFuncColIdx].Value.ToString();

                int iRegisterID = GVAR.Str2Int(strRegisterID);
                int iFunctionID = 0;
                if (strFunctionID.Length == 0)
                {
                    iFunctionID = -1;
                }
                else
                {
                    iFunctionID = GVAR.Str2Int(strFunctionID);
                }
                GVAR.g_ManageDB.AddMatchOfficial(m_iMatchID, iRegisterID, iFunctionID);
            }
            ResetAvailableOfficial();
            ResetMatchOfficial();
        }
        private void UpdateMemberPosition(int iTeamPos, ref DataGridView dgv, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }

            int              iColumnIndex  = e.ColumnIndex;
            int              iRowIndex     = e.RowIndex;
            String           strColumnName = dgv.Columns[iColumnIndex].Name;
            DataGridViewCell CurCell       = dgv.Rows[iRowIndex].Cells[iColumnIndex];

            if (CurCell != null)
            {
                int iPositionID = 0;
                if (CurCell is DGVCustomComboBoxCell)
                {
                    DGVCustomComboBoxCell CurCell1 = CurCell as DGVCustomComboBoxCell;
                    iPositionID = GVAR.Str2Int(CurCell1.Tag);
                }
                else
                {
                    return;
                }
                int iMemberID = GVAR.Str2Int(dgv.Rows[iRowIndex].Cells["F_MemberID"].Value);
                GVAR.g_ManageDB.UpdateMatchMembePosition(m_iMatchID, iMemberID, iTeamPos, iPositionID);
            }
        }
Exemple #3
0
        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 iFunctionID = 0;
                if (CurCell is DGVCustomComboBoxCell)
                {
                    DGVCustomComboBoxCell CurCell1 = CurCell as DGVCustomComboBoxCell;
                    iFunctionID = GVAR.Str2Int(CurCell1.Tag);
                }
                else
                {
                    return;
                }

                int iRegisterID = GVAR.Str2Int(dgvMatchOfficial.Rows[iRowIndex].Cells["F_RegisterID"].Value);
                GVAR.g_ManageDB.UpdateOfficialFunction(m_iMatchID, iRegisterID, iFunctionID);
            }
            ResetMatchOfficial();
        }
Exemple #4
0
        private void AddPenaltyAction(ref DataGridView dgv, int iTeamPos, int iRwoIdx, int iColIndex, int iResultID)
        {
            int    iRegisterID  = GVAR.Str2Int(dgv.Rows[iRwoIdx].Cells["F_RegisterID"].Value.ToString());
            string strRegName   = dgv.Rows[iRwoIdx].Cells["Name"].Value.ToString();
            int    iShirtNumber = GVAR.Str2Int(dgv.Rows[iRwoIdx].Cells["CapNo"].Value.ToString());
            int    iShotResult  = iResultID;

            m_CurAction.InitAction(m_CCurMatch, m_iMatchPenaltySplitID);

            m_CurAction.TeamPos    = iTeamPos;
            m_CurAction.RegisterID = iRegisterID;
            m_CurAction.RegName    = strRegName;
            m_CurAction.ActionTime = "";

            m_CurAction.ActionDes     = iShirtNumber.ToString();
            m_CurAction.ActionType    = EActionType.emShot;
            m_CurAction.ActionDetail1 = "5";
            m_CurAction.ActionDetail2 = iShotResult.ToString();

            m_CurAction.GetActionCode();
            if (m_CurAction.IsActionComplete())
            {
                int iOPGKID = GVAR.g_ManageDB.GetCurActiveGKID(m_CCurMatch, (2 - m_CurAction.TeamPos + 1));
                m_CurAction.CreateActionXml(m_CCurMatch, iOPGKID);
                AddAction();
                m_CurAction.Init();
            }
        }
        private void UpdateMemberStartup(int iTeampos, ref DataGridView dgv, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= dgv.RowCount || e.RowIndex < 0)
            {
                return;
            }
            if (e.ColumnIndex != dgv.Columns["Startup"].Index)
            {
                return;
            }


            string strRegisterID = dgv.Rows[e.RowIndex].Cells["F_MemberID"].Value.ToString();

            if (GVAR.Str2Int(dgv.Rows[e.RowIndex].Cells[e.ColumnIndex].Value) == 1)
            {
                GVAR.g_ManageDB.UpdateMemberStartup(m_iMatchID, iTeampos, strRegisterID, false);
            }
            else
            {
                if ((iTeampos == 1 && m_iHomeStartup < 7) || (iTeampos == 2 && m_iVisitStartup < 7))
                {
                    GVAR.g_ManageDB.UpdateMemberStartup(m_iMatchID, iTeampos, strRegisterID, true);
                }
            }

            if (iTeampos == 1)
            {
                GVAR.g_ManageDB.ResetMemberGrid(m_iMatchID, m_iHomeRegisterID, 1, ref dgvMember_Home, ref m_iHomeStartup);
            }
            else if (iTeampos == 2)
            {
                GVAR.g_ManageDB.ResetMemberGrid(m_iMatchID, m_iVisitRegisterID, 2, ref dgvMember_Visit, ref m_iVisitStartup);
            }
        }
Exemple #6
0
        public int ChangePoint(int iTeamPos, bool bAdd, int iPoint, int iPeriod)
        {
            int iResult = 0;

            if (iPeriod <= 0)
            {
                return(iResult);
            }
            if (m_CHomeTeam.GetScore(iPeriod).Length == 0)
            {
                m_CHomeTeam.SetScore("0", iPeriod);
            }
            if (m_CVisitTeam.GetScore(iPeriod).Length == 0)
            {
                m_CVisitTeam.SetScore("0", iPeriod);
            }


            OVRWPTeamInfo tmpTeam = new OVRWPTeamInfo();
            int           iSetPt;

            if (iTeamPos == 1)
            {
                tmpTeam = m_CHomeTeam;
            }
            else if (iTeamPos == 2)
            {
                tmpTeam = m_CVisitTeam;
            }

            if (bAdd)
            {
                iSetPt = GVAR.Str2Int(tmpTeam.GetScore(iPeriod)) + 1;
            }
            else
            {
                iSetPt = Math.Max(GVAR.Str2Int(tmpTeam.GetScore(iPeriod)) - 1, 0);
            }
            tmpTeam.SetScore(iSetPt.ToString(), iPeriod);

            //计算总分
            int iHomePt  = 0;
            int iVisitPt = 0;

            for (int i = 1; i <= GVAR.MAXSETNUM; i++)
            {
                iHomePt  += GVAR.Str2Int(m_CHomeTeam.GetScore(i));
                iVisitPt += GVAR.Str2Int(m_CVisitTeam.GetScore(i));
            }
            m_CHomeTeam.TeamPoint  = iHomePt;
            m_CVisitTeam.TeamPoint = iVisitPt;
            iResult = 1;
            return(iResult);
        }
        private void AddMember(int iTeamPos, ref DataGridView dgv)
        {
            int iColIdx          = dgv.Columns["F_MemberID"].Index;
            int iFuncColIdx      = dgv.Columns["F_FunctionID"].Index;
            int iShirtNumberIdex = dgv.Columns["ShirtNumber"].Index;
            int iPosColIdx       = dgv.Columns["F_PositionID"].Index;

            for (int i = 0; i < dgv.SelectedRows.Count; i++)
            {
                int iRowIdx = dgv.SelectedRows[i].Index;

                if (dgv.Rows[iRowIdx].ReadOnly == true)
                {
                    continue;
                }
                string strMemberID    = dgv.Rows[iRowIdx].Cells[iColIdx].Value.ToString();
                string strFunctionID  = dgv.Rows[iRowIdx].Cells[iFuncColIdx].Value.ToString();
                string strPositionID  = dgv.Rows[iRowIdx].Cells[iPosColIdx].Value.ToString();
                string strShirtNumber = dgv.Rows[iRowIdx].Cells[iShirtNumberIdex].Value.ToString();

                int iMemberID    = GVAR.Str2Int(strMemberID);
                int iFunctionID  = 0;
                int iPostionID   = 0;
                int iShirtNumber = 0;
                if (strFunctionID.Length == 0)
                {
                    iFunctionID = -1;
                }
                else
                {
                    iFunctionID = GVAR.Str2Int(strFunctionID);
                }
                if (strPositionID.Length == 0)
                {
                    iPostionID = -1;
                }
                else
                {
                    iPostionID = GVAR.Str2Int(strPositionID);
                }
                if (strShirtNumber.Length == 0)
                {
                    iShirtNumber = -1;
                }
                else
                {
                    iShirtNumber = GVAR.Str2Int(strShirtNumber);
                }
                GVAR.g_ManageDB.AddMatchMember(m_iMatchID, iMemberID, iTeamPos, iFunctionID, iPostionID, iShirtNumber);
            }
        }
        private void RemoveMember(int iTeamPos, ref DataGridView dgv)
        {
            int iColIdx = dgv.Columns["F_MemberID"].Index;

            for (int i = 0; i < dgv.SelectedRows.Count; i++)
            {
                int iRowIdx = dgv.SelectedRows[i].Index;

                string strMemberID = dgv.Rows[iRowIdx].Cells[iColIdx].Value.ToString();
                int    iMemberID   = GVAR.Str2Int(strMemberID);

                GVAR.g_ManageDB.RemoveMatchMember(m_iMatchID, iMemberID, iTeamPos);
            }
        }
Exemple #9
0
        private void btnChosePlayer_Click(object sender, EventArgs e)
        {
            int    iMatchID     = GVAR.Str2Int(m_CCurMatch.MatchID);
            int    iHomeRegID   = m_CCurMatch.m_CHomeTeam.TeamID;
            int    iVisitRegID  = m_CCurMatch.m_CVisitTeam.TeamID;
            string strHomeName  = m_CCurMatch.m_CHomeTeam.TeamName;
            string strVisitName = m_CCurMatch.m_CVisitTeam.TeamName;

            frmOVRWPPenaltyPlayer PenaltyMemberForm = new frmOVRWPPenaltyPlayer(iMatchID, m_iMatchPenaltySplitID, iHomeRegID, iVisitRegID, strHomeName, strVisitName);

            PenaltyMemberForm.ShowDialog();

            FillPlayerUI();
        }
Exemple #10
0
        private void FillPlayerUI()
        {
            UpdateScoreUI();

            string strHGKName = "";
            string strVGKName = "";

            GVAR.g_ManageDB.GetPenaltyGKInfo(GVAR.Str2Int(m_CCurMatch.MatchID), 1, m_iMatchPenaltySplitID, ref strHGKName, ref m_iHomeGKID);
            GVAR.g_ManageDB.GetPenaltyGKInfo(GVAR.Str2Int(m_CCurMatch.MatchID), 2, m_iMatchPenaltySplitID, ref strVGKName, ref m_iVisitGKID);

            lbHGKName.Text = strHGKName;
            lbVGKName.Text = strVGKName;

            ResetHomePenaltyDataGridView();
            ResetVisitPenaltyDataGridView();
        }
Exemple #11
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            int iColIdx = dgvMatchOfficial.Columns["F_RegisterID"].Index;

            for (int i = 0; i < dgvMatchOfficial.SelectedRows.Count; i++)
            {
                int iRowIdx = dgvMatchOfficial.SelectedRows[i].Index;

                string strRegisterID = dgvMatchOfficial.Rows[iRowIdx].Cells[iColIdx].Value.ToString();

                int iRegisterID = GVAR.Str2Int(strRegisterID);
                GVAR.g_ManageDB.RemoveMatchOfficial(m_iMatchID, iRegisterID);
            }
            ResetAvailableOfficial();
            ResetMatchOfficial();
        }
        private void UpdateMemberOrder(int iTeamPos, ref DataGridView dgv, DataGridViewCellEventArgs e)
        {
            int iColumnIndex = e.ColumnIndex;
            int iRowIndex    = e.RowIndex;

            DataGridViewCell CurCell = dgv.Rows[iRowIndex].Cells[iColumnIndex];

            int iBatOrder = 0;

            if (CurCell.Value != null)
            {
                iBatOrder = GVAR.Str2Int(CurCell.Value);
            }
            int iMemberID = GVAR.Str2Int(dgv.Rows[iRowIndex].Cells["F_MemberID"].Value);

            GVAR.g_ManageDB.UpdatePlayerOrder(m_iMatchID, iMemberID, iBatOrder);
        }
        private void UpdateMemberShirtNumber(int iTeamPos, ref DataGridView dgv, DataGridViewCellEventArgs e)
        {
            int iColumnIndex = e.ColumnIndex;
            int iRowIndex    = e.RowIndex;

            DataGridViewCell CurCell = dgv.Rows[iRowIndex].Cells[iColumnIndex];

            string strShirtNumber = "";

            if (CurCell.Value != null)
            {
                strShirtNumber = CurCell.Value.ToString();
            }
            int iMemberID = GVAR.Str2Int(dgv.Rows[iRowIndex].Cells["F_MemberID"].Value);

            GVAR.g_ManageDB.UpdateMatchMemberShirtNumber(m_iMatchID, iMemberID, iTeamPos, strShirtNumber);
        }
Exemple #14
0
 public frmOVRWPPenaltyScore(ref OVRWPMatchInfo cMatchInfo)
 {
     InitializeComponent();
     m_CCurMatch = cMatchInfo;
     m_CurAction.Init();
     m_MatchID = GVAR.Str2Int(m_CCurMatch.MatchID);
     m_iMatchPenaltySplitID = GVAR.g_ManageDB.GetMatchSplitID(m_MatchID, GVAR.PERIOD_PSO);
     if (m_iMatchPenaltySplitID <= 0)
     {
         m_iMatchPenaltySplitID = GVAR.g_ManageDB.AddSplitMatch(ref m_CCurMatch, GVAR.PERIOD_PSO.ToString());
     }
     else
     {
         m_iHomePScore  = GVAR.g_ManageDB.GetSplitScore(m_MatchID, m_iMatchPenaltySplitID, 1);
         m_iVisitPScore = GVAR.g_ManageDB.GetSplitScore(m_MatchID, m_iMatchPenaltySplitID, 2);
     }
 }
Exemple #15
0
        public static string FormatTime(string strTime)
        {
            string strFmtTime = "";

            if (strTime.Length == 0)
            {
                return(strFmtTime);
            }

            int iMatchTime = GVAR.Str2Int(strTime);
            int iHour_Min  = iMatchTime / 60;
            int iHour      = iHour_Min / 60;
            int iMin       = iHour_Min % 60;
            int iSec       = iMatchTime % 60;

            //格式为00:00:00
            strFmtTime = iHour.ToString() + ":" + iMin.ToString() + ":" + iSec.ToString();
            return(strFmtTime);
        }
Exemple #16
0
        public static void ConvetTime2String(string strFormatTime, ref string strTime)
        {
            int iIndex = strFormatTime.IndexOf(':');

            if (iIndex < 0)
            {
                return;
            }

            string strMin = strFormatTime.Substring(0, iIndex);
            string strSec = strFormatTime.Substring(iIndex + 1);

            int iMin = 0;
            int iSec = 0;

            if (strMin.Length == 0)
            {
                iMin = 0;
            }
            else
            {
                try
                {
                    iMin = GVAR.Str2Int(strMin) * 60;
                }
                catch (System.Exception e)
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show(e.Message);
                }
            }

            try
            {
                iSec = GVAR.Str2Int(strSec);
            }
            catch (System.Exception e)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(e.Message);
            }

            strTime = (iSec + iMin).ToString();
        }
Exemple #17
0
        private void dgvVisitPenalty_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            int iRowIdx = e.RowIndex;
            int iColIdx = e.ColumnIndex;

            if (iRowIdx >= dgvVisitPenalty.RowCount || iRowIdx < 0 || iColIdx < 0)
            {
                return;
            }

            m_CurAction.Init();
            m_CurAction.AcitonID = GVAR.Str2Int(dgvVisitPenalty.Rows[iRowIdx].Cells["F_ActionID"].Value.ToString());
            if (dgvVisitPenalty.Columns[iColIdx].Name.CompareTo("ResultDes") == 0)
            {
                DataGridViewCell CurCell = dgvVisitPenalty.Rows[iRowIdx].Cells[iColIdx];
                if (CurCell != null)
                {
                    int iResultID = 0;
                    if (CurCell is DGVCustomComboBoxCell)
                    {
                        DGVCustomComboBoxCell CurCell1 = CurCell as DGVCustomComboBoxCell;
                        iResultID = GVAR.Str2Int(CurCell1.Tag);
                    }
                    else
                    {
                        return;
                    }

                    if (m_CurAction.AcitonID < 0)
                    {
                        AddPenaltyAction(ref dgvVisitPenalty, 2, iRowIdx, iColIdx, iResultID);
                    }
                    else
                    {
                        GVAR.g_ManageDB.GetMatchAction(m_MatchID, m_CurAction.AcitonID, ref m_CurAction);
                        EditPenaltyAction(ref dgvVisitPenalty, 2, iRowIdx, iColIdx, iResultID);
                    }
                    ResetVisitPenaltyDataGridView();
                }
            }
        }
        private void UpdateMemberDSQ(int iTeamPos, ref DataGridView dgv, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }

            int iColumnIndex         = e.ColumnIndex;
            int iRowIndex            = e.RowIndex;
            DataGridViewCell CurCell = dgv.Rows[iRowIndex].Cells[iColumnIndex];

            if (CurCell != null)
            {
                int iIRMID = 0;
                if (CurCell is DGVCustomComboBoxCell)
                {
                    DGVCustomComboBoxCell CurCell1 = CurCell as DGVCustomComboBoxCell;
                    iIRMID = GVAR.Str2Int(CurCell1.Tag);
                }
                else
                {
                    return;
                }

                int iMemberID   = GVAR.Str2Int(dgv.Rows[iRowIndex].Cells["F_MemberID"].Value);
                int iRegisterID = 0;
                if (iTeamPos == 1)
                {
                    iRegisterID = m_iHomeRegisterID;
                }
                else if (iTeamPos == 2)
                {
                    iRegisterID = m_iVisitRegisterID;
                }
                GVAR.g_ManageDB.UpdateMemberDSQ(iRegisterID, iMemberID, iIRMID);
            }
        }
Exemple #19
0
 public void InitAction(OVRWPMatchInfo tmpMatch, int iMatchSplitID)
 {
     m_iMatchID      = GVAR.Str2Int(tmpMatch.MatchID);
     m_iMatchSplitID = iMatchSplitID;
 }
        private void cmbUniform_Visit_SelectionChangeCommitted(object sender, EventArgs e)
        {
            m_iVisitUniformID = GVAR.Str2Int(cmbUniform_Visit.SelectedValue);

            GVAR.g_ManageDB.UpdateMatchUniform(m_iMatchID, 2, m_iVisitUniformID);
        }
Exemple #21
0
 private void ResetVisitPenaltyDataGridView()
 {
     GVAR.g_ManageDB.FillPenaltyDataGridView(ref dgvVisitPenalty, GVAR.Str2Int(m_CCurMatch.MatchID), m_iMatchPenaltySplitID, 2);
 }
Exemple #22
0
        public void ParseUDPThread()
        {
            try
            {
                int itime = 0;
                while (m_bParse)
                {
                    Byte[] bytes = m_UDP.Receive(ref m_Server);

                    for (int i = 0; i < bytes.Length; i++)
                    {
                        if (bytes[i] == Time_Score_Head)
                        {
                            m_bUDPFrameStart  = true;
                            m_TextBufferIndex = 0;
                            continue;
                        }
                        if (bytes[i] == Time_Score_Tail)
                        {
                            if (m_TextBufferIndex == 5)
                            {
                                itime = m_TextBuffer[0] * 60 + m_TextBuffer[1];
                                m_CCurMatch.MatchTime = itime.ToString();
                                MatchTime.Text        = GVAR.TranslateINT32toTime(itime);
                            }
                            m_bUDPFrameStart  = false;
                            m_TextBufferIndex = 0;
                        }
                        if (m_bUDPFrameStart)
                        {
                            m_TextBuffer[m_TextBufferIndex] = bytes[i];
                            m_TextBufferIndex++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //MessageBoxEx.Show("Receive thread error happened!");
            }
            finally
            {
                m_bParse         = false;
                m_ParseUDPThread = null;
                if (m_UDP != null)
                {
                    m_UDP.Close();
                    m_UDP = null;
                }
                m_bUDPFrameStart  = false;
                m_TextBufferIndex = 0;
                MyInvoke        mi = new MyInvoke(this.UPdateUI);
                ClearTextInvoke Ci = new ClearTextInvoke(this.ClearText);
                if (m_bIsCloseThreadManuel)
                {
                    this.BeginInvoke(mi, new object[] { btn_start_receive, true });
                    m_bIsCloseThreadManuel = false;
                }
                else
                {
                    this.BeginInvoke(mi, new object[] { btn_start_receive, false });
                    this.BeginInvoke(Ci, new object[] { Label_SelectedPort });
                }
                this.BeginInvoke(mi, new object[] { btn_stop_receive, false });
            }
        }