Ejemplo n.º 1
0
        private void UpdateDataGridView(DataGridView dgv)
        {
            dgv.Rows.Clear();
            AR_Archer player = (AR_Archer)dgv.Tag;

            if (player.Ends.Count > 0)
            {
                for (int nRow = 0; nRow < CurMatchInfo.EndCount; nRow++)
                {
                    DataGridViewRow row = new DataGridViewRow();
                    row.CreateCells(dgv);
                    row.Selected = false;

                    AR_End theEnd = player.Ends[nRow];
                    row.Cells[0].Value = "End " + (nRow + 1).ToString();
                    int ColIndex = 1;
                    for (int nCol = 0; nCol < CurMatchInfo.ArrowCount; nCol++)
                    {
                        row.Cells[nCol + 1].Value = theEnd.Arrows[nCol].Ring;
                        row.Cells[nCol + 1].Tag   = theEnd.Arrows[nCol];
                        ColIndex++;
                    }
                    row.Cells[ColIndex].Value = theEnd.R10Num;
                    ColIndex++;
                    row.Cells[ColIndex].Value = theEnd.Xnum;
                    ColIndex++;
                    row.Cells[ColIndex].Value = theEnd.Total;
                    ColIndex++;
                    dgv.Rows.Add(row);
                    row.Tag = theEnd;
                }
            }
            dgv.Tag = player;
        }
Ejemplo n.º 2
0
        private void InterfaceUpdateDataGridView(DataGridView dgv)
        {
            AR_Archer player = (AR_Archer)dgv.Tag;

            if (player.Ends.Count > 0)
            {
                for (int nRow = 1; nRow <= dgv.Rows.Count; nRow++)
                {
                    DataGridViewRow row      = dgv.Rows[nRow - 1];
                    AR_End          theEnd   = player.Ends.Find(p => p.EndIndex == nRow.ToString());
                    int             ColIndex = 1;
                    for (int nCol = 0; nCol < CurMatchInfo.ArrowCount; nCol++)
                    {
                        row.Cells[nCol + 1].Value = theEnd.Arrows[nCol].Ring;
                        row.Cells[nCol + 1].Tag   = theEnd.Arrows[nCol];
                        ColIndex++;
                    }
                    row.Cells[ColIndex].Value = theEnd.R10Num;
                    ColIndex++;
                    row.Cells[ColIndex].Value = theEnd.Xnum;
                    ColIndex++;
                    row.Cells[ColIndex].Value = theEnd.Total;
                    ColIndex++;
                    row.Tag = theEnd;
                }
            }
            dgv.Tag = player;
        }
Ejemplo n.º 3
0
        private static int ArchersComparePoint(AR_Archer objEx1, AR_Archer objEx2)
        {
            if (objEx1 == objEx2)
            {
                return(0);
            }
            if (objEx1.Result != objEx2.Result)
            {
                int total1 = ARFunctions.ConvertToIntFromString(objEx1.Result);
                int total2 = ARFunctions.ConvertToIntFromString(objEx2.Result);
                if (total1 < total2)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }
            }
            else
            {
                if (objEx1.Num10S != objEx2.Num10S)
                {
                    int num10s_1 = ARFunctions.ConvertToIntFromString(objEx1.Num10S);
                    int num10s_2 = ARFunctions.ConvertToIntFromString(objEx2.Num10S);
                    if (num10s_1 < num10s_2)
                    {
                        return(1);
                    }
                    else
                    {
                        return(-1);
                    }
                }
                else
                {
                    if (objEx1.NumXS != objEx2.NumXS)
                    {
                        int numXs_1 = ARFunctions.ConvertToIntFromString(objEx1.NumXS);
                        int numXs_2 = ARFunctions.ConvertToIntFromString(objEx2.NumXS);
                        if (numXs_1 < numXs_2)
                        {
                            return(1);
                        }
                        else
                        {
                            return(-1);
                        }
                    }

                    else
                    {
                        objEx1.IRM = "T";
                        objEx2.IRM = "T";
                        return(0);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public frmQualificationEnds(int nMatchID, int nDistince, AR_Archer Archer)
        {
            InitializeComponent();

            m_nCurMatchID  = nMatchID;
            m_nCurDistince = nDistince;
            Player         = Archer;
            this.UpdatedUserControlsHandler = new ARDataEntryUpdatedMatchInfo(SettingControlsStatus);
        }
Ejemplo n.º 5
0
        private void UpdateRecDataEventHandler()
        {
            Player = AREntityOperation.GetCompetitionPlayerInfo(m_nCurMatchID, Player, m_nCurDistince);

            if (Player != null)
            {
                dgv_PlayerA.Tag = Player;
                InterfaceUpdateDataGridView(dgv_PlayerA);
                SettingControlsStatus(CurMatchInfo);
            }
        }
Ejemplo n.º 6
0
        public static AR_Archer GetCompetitionOnePlayerByRegisterID(int nMatchID, int nRegisterID)
        {
            AR_Archer        player  = new AR_Archer();
            List <AR_Archer> Archers = new List <AR_Archer>();

            Archers = GetCompetitionPlayers(nMatchID);
            foreach (AR_Archer ar in Archers)
            {
                if (ar.RegisterID == nRegisterID)
                {
                    player = ar;
                }
            }
            return(player);
        }
Ejemplo n.º 7
0
        private void frmQualificationEnds_Load(object sender, EventArgs e)
        {
            this.InitDataGridView(dgv_PlayerA);

            Player = AREntityOperation.GetCompetitionPlayerInfo(m_nCurMatchID, Player, m_nCurDistince);

            if (Player != null)
            {
                InitPlayerInfo();
            }
            labX_A10s.Text = GetPlayerTotalByColumns(dgv_PlayerA.Columns["10s"]);
            labX_AXs.Text  = GetPlayerTotalByColumns(dgv_PlayerA.Columns["Xs"]);
            SettingControlsStatus(CurMatchInfo);

            ARUdpService.ReceivedData += new ReceiveDataEventHandler(UpdateRecData);
        }
Ejemplo n.º 8
0
        public void UpdateRank()
        {
            List <AR_Archer> Archers = new List <AR_Archer>();
            AR_Archer        playerA = (AR_Archer)dgv_PlayerA.Tag;

            Archers.Add(playerA);
            AR_Archer winner = null;

            foreach (AR_Archer player in Archers)
            {
                bool bReturn = GVAR.g_ManageDB.UpdateMatchResult(m_nCurMatchID, player.CompetitionPosition, player.Num10S,
                                                                 player.NumXS, player.Total, player.Result, player.QRank, player.DisplayPosition.ToString(), player.IRM, player.Target);
                if (bReturn && player.QRank == "1")
                {
                    winner = player;
                    GVAR.g_ARPlugin.DataChangedNotify(OVRDataChangedType.emMatchResult, -1, -1, -1, m_nCurMatchID, m_nCurMatchID, null);
                }
            }
        }
Ejemplo n.º 9
0
        private void toolStripMenuItem_Common(string IRM)
        {
            DataGridView dgv    = (DataGridView)MenuStrip_IRM.Tag;
            AR_Archer    player = (AR_Archer)dgv.Tag;

            player.IRM    = IRM;
            player.Total  = IRM.Length != 0 ? "" : this.GetPlayerTotalScore(dgv);
            player.Result = IRM.Length != 0 ? "" : this.GetPlayerTotalPoint(dgv);
            player.QRank  = IRM.Length != 0 ? "" : player.QRank;

            bool bReturn = GVAR.g_ManageDB.UpdateMatchResult(m_nCurMatchID, player.CompetitionPosition,
                                                             player.Num10S, player.NumXS, player.Total, player.Result, player.QRank, player.DisplayPosition.ToString(), player.IRM, player.Target);

            if (bReturn)
            {
                dgv.Tag        = player;
                labX_IRMA.Text = IRM;
                GVAR.g_ARPlugin.DataChangedNotify(OVRDataChangedType.emMatchResult, -1, -1, -1, m_nCurMatchID, m_nCurMatchID, null);
            }
        }
Ejemplo n.º 10
0
        public static AR_Archer GetCompetitionPlayerInfo(int nMatchID, AR_Archer player, int nDistince)
        {
            AR_Archer Archer = player;

            if (Archer != null)
            {
                List <AR_End> myEnds = new List <AR_End>();
                myEnds = GetPlayerEndsByDistince(nMatchID, nDistince, Archer.CompetitionPosition);
                foreach (AR_End end in myEnds)
                {
                    List <AR_Arrow> arrows = new List <AR_Arrow>();
                    arrows = GetPlayerArrows(nMatchID, end.SplitID, end.CompetitionPosition);

                    end.Arrows = arrows;
                }

                Archer.Ends = myEnds;
            }

            return(Archer);
        }
Ejemplo n.º 11
0
        private void labX_A_TextChanged(object sender, EventArgs e)
        {
            LabelX    labA   = (LabelX)sender;
            AR_Archer player = (AR_Archer)dgv_PlayerA.Tag;

            if (labA == labX_A10s)
            {
                string Num10A = labX_A10s.Text;
                //player.Num10S = Num10A;
            }
            if (labA == labX_AXs)
            {
                string NumXA = labX_AXs.Text;
                //player.NumXS = NumXA;
            }
            if (labA == labX_TotalA)
            {
                string Total = labX_TotalA.Text;
                if (m_nCurDistince == 1)
                {
                    player.TotalLongA = Total;
                }
                else if (m_nCurDistince == 2)
                {
                    player.TotalLongB = Total;
                }
                else if (m_nCurDistince == 3)
                {
                    player.TotalShortA = Total;
                }
                else if (m_nCurDistince == 4)
                {
                    player.TotalShortB = Total;
                }
            }

            dgv_PlayerA.Tag = player;
            //UpdateRank();
        }
Ejemplo n.º 12
0
        public static List <AR_Archer> GetCompetitionPlayers(int nMatchID)
        {
            List <AR_Archer> Archers = new List <AR_Archer>();

            DataTable dt = GVAR.g_ManageDB.GetCompetitionPlayers(nMatchID);

            for (int nRow = 0; nRow < dt.Rows.Count; nRow++)
            {
                string    strFieldName = "";
                object    obj          = null;
                AR_Archer onePlayer    = new AR_Archer();

                strFieldName = "F_CompetitionPosition";
                obj          = dt.Rows[nRow][strFieldName];
                onePlayer.CompetitionPosition = ARFunctions.ConvertToIntFromObject(obj);

                strFieldName         = "F_RegisterID";
                obj                  = dt.Rows[nRow][strFieldName];
                onePlayer.RegisterID = ARFunctions.ConvertToIntFromObject(obj);

                strFieldName  = "Bib";
                obj           = dt.Rows[nRow][strFieldName];
                onePlayer.Bib = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName   = "Name";
                obj            = dt.Rows[nRow][strFieldName];
                onePlayer.Name = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName  = "NOC";
                obj           = dt.Rows[nRow][strFieldName];
                onePlayer.Noc = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName    = "Rank";
                obj             = dt.Rows[nRow][strFieldName];
                onePlayer.QRank = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName    = "Total";
                obj             = dt.Rows[nRow][strFieldName];
                onePlayer.Total = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName     = "Point";
                obj              = dt.Rows[nRow][strFieldName];
                onePlayer.Result = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName  = "IRM";
                obj           = dt.Rows[nRow][strFieldName];
                onePlayer.IRM = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName     = "10s";
                obj              = dt.Rows[nRow][strFieldName];
                onePlayer.Num10S = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName    = "Xs";
                obj             = dt.Rows[nRow][strFieldName];
                onePlayer.NumXS = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName     = "Remark";
                obj              = dt.Rows[nRow][strFieldName];
                onePlayer.Remark = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName     = "Target";
                obj              = dt.Rows[nRow][strFieldName];
                onePlayer.Target = ARFunctions.ConvertToStringFromObject(obj);

                Archers.Add(onePlayer);
            }
            return(Archers);
        }