private void dgv_PlayerA_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex > 0)
            {
                AR_End rowEnd  = new AR_End();
                bool   bReturn = false;
                if (dgv_PlayerA.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name.Contains("Arrow"))
                {
                    EditArrowsInfo(dgv_PlayerA[e.ColumnIndex, e.RowIndex]);
                }

                rowEnd        = (AR_End)dgv_PlayerA.Rows[e.RowIndex].Tag;
                rowEnd.R10Num = ARFunctions.ConvertToStringFromObject(dgv_PlayerA.Rows[e.RowIndex].Cells["10s"].Value);
                rowEnd.Xnum   = ARFunctions.ConvertToStringFromObject(dgv_PlayerA.Rows[e.RowIndex].Cells["Xs"].Value);
                rowEnd.Total  = ARFunctions.ConvertToStringFromObject(dgv_PlayerA.Rows[e.RowIndex].Cells["Total"].Value);

                labX_TotalA.Text = this.GetPlayerTotalScore(dgv_PlayerA);
                bReturn          = GVAR.g_ManageDB.UpdatePlayerEnd(m_nCurMatchID, rowEnd.CompetitionPosition, rowEnd.SplitID, rowEnd.EndIndex, rowEnd.Total,
                                                                   rowEnd.Point, rowEnd.R10Num, rowEnd.Xnum, 0);
                if (bReturn)
                {
                    dgv_PlayerA.Rows[e.RowIndex].Tag = rowEnd;
                    GVAR.g_ARPlugin.DataChangedNotify(OVRDataChangedType.emMatchResult, -1, -1, -1, m_nCurMatchID, m_nCurMatchID, null);
                }
            }
        }
        public static AR_End GetPlayerOneEndByDistince(int nMatchID, int nDistince, int nCompetitionPosition, string nEndIndex)
        {
            List <AR_End> myEnds = new List <AR_End>();
            DataTable     dt     = GVAR.g_ManageDB.GetPlayerEnds(nMatchID, nDistince, nCompetitionPosition, nEndIndex);

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

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

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

                strFieldName    = "EndIndex";
                obj             = dt.Rows[nRow][strFieldName];
                oneEnd.EndIndex = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName    = "EndCode";
                obj             = dt.Rows[nRow][strFieldName];
                oneEnd.EndIndex = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName   = "F_MatchID";
                obj            = dt.Rows[nRow][strFieldName];
                oneEnd.MatchID = ARFunctions.ConvertToIntFromObject(obj);

                strFieldName   = "F_MatchSplitID";
                obj            = dt.Rows[nRow][strFieldName];
                oneEnd.SplitID = ARFunctions.ConvertToIntFromObject(obj);

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

                strFieldName  = "Num10s";
                obj           = dt.Rows[nRow][strFieldName];
                oneEnd.R10Num = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName = "NumXs";
                obj          = dt.Rows[nRow][strFieldName];
                oneEnd.Xnum  = ARFunctions.ConvertToStringFromObject(obj);

                myEnds.Add(oneEnd);
            }
            AR_End ar = new AR_End();

            if (myEnds.Count > 0)
            {
                ar = myEnds[0];
            }
            return(ar);
        }
        public static List <AR_End> GetPlayerShootEnds(int nMatchID, int nCompetitionPosition)
        {
            List <AR_End> myEnds = new List <AR_End>();
            DataTable     dt     = GVAR.g_ManageDB.GetPlayerShootEnds(nMatchID, 1, nCompetitionPosition, "-1");

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

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

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

                strFieldName    = "EndIndex";
                obj             = dt.Rows[nRow][strFieldName];
                oneEnd.EndIndex = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName    = "EndCode";
                obj             = dt.Rows[nRow][strFieldName];
                oneEnd.EndIndex = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName   = "F_MatchID";
                obj            = dt.Rows[nRow][strFieldName];
                oneEnd.MatchID = ARFunctions.ConvertToIntFromObject(obj);

                strFieldName   = "F_MatchSplitID";
                obj            = dt.Rows[nRow][strFieldName];
                oneEnd.SplitID = ARFunctions.ConvertToIntFromObject(obj);

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

                strFieldName  = "Num10s";
                obj           = dt.Rows[nRow][strFieldName];
                oneEnd.R10Num = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName = "NumXs";
                obj          = dt.Rows[nRow][strFieldName];
                oneEnd.Xnum  = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName      = "EndComment";
                obj               = dt.Rows[nRow][strFieldName];
                oneEnd.EndComment = ARFunctions.ConvertToStringFromObject(obj);

                myEnds.Add(oneEnd);
            }
            return(myEnds);
        }
        public static AR_Arrow GetPlayerOneShootArrow(int nMatchID, int nSplitID, int nCompetitionPosition, string nArrowIndex)
        {
            List <AR_Arrow> Arrows = new List <AR_Arrow>();
            DataTable       dt     = GVAR.g_ManageDB.GetPlayerShootArrows(nMatchID, nSplitID, nCompetitionPosition, nArrowIndex);

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

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

                strFieldName = "F_Points";
                obj          = dt.Rows[nRow][strFieldName];
                oneAR.Ring   = ARFunctions.ConvertToStringFromObject(obj);

                //strFieldName = "F_Order";
                //obj = dt.Rows[nRow][strFieldName];
                //oneAR.ArrowIndex = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName     = "F_MatchSplitCode";
                obj              = dt.Rows[nRow][strFieldName];
                oneAR.ArrowIndex = ARFunctions.ConvertToStringFromObject(obj);

                strFieldName  = "F_MatchID";
                obj           = dt.Rows[nRow][strFieldName];
                oneAR.MatchID = ARFunctions.ConvertToIntFromObject(obj);

                strFieldName  = "F_MatchSplitID";
                obj           = dt.Rows[nRow][strFieldName];
                oneAR.SplitID = ARFunctions.ConvertToIntFromObject(obj);

                strFieldName        = "F_FatherMatchSplitID";
                obj                 = dt.Rows[nRow][strFieldName];
                oneAR.FatherSplitID = ARFunctions.ConvertToIntFromObject(obj);

                strFieldName   = "FaterCode";
                obj            = dt.Rows[nRow][strFieldName];
                oneAR.EndIndex = ARFunctions.ConvertToStringFromObject(obj);


                Arrows.Add(oneAR);
            }
            AR_Arrow AA = new AR_Arrow();

            if (Arrows.Count > 0)
            {
                AA = Arrows[0];
            }
            return(AA);
        }
        private void EditArrowsInfo(DataGridViewCell cell)
        {
            bool     bReturn = false;
            AR_Arrow arrow   = (AR_Arrow)cell.Tag;

            arrow.Ring = ARFunctions.ConvertToStringFromObject(cell.Value);
            bReturn    = GVAR.g_ManageDB.UpdatePlayerArrow(m_nCurMatchID, arrow.CompetitionPosition, arrow.FatherSplitID, arrow.ArrowIndex, arrow.Ring, 1);
            if (bReturn)
            {
                cell.Tag = arrow;
                AR_End rowEnd        = (AR_End)cell.OwningRow.Tag;
                int    curArrowIndex = rowEnd.Arrows.FindIndex(delegate(AR_Arrow aa) { return(aa.ArrowIndex == arrow.ArrowIndex); });
                rowEnd.Arrows[curArrowIndex] = arrow;
                SetEnd10AndXNumbers(cell.OwningRow);
                if (IsAutoUpTotal) //自动更新每局总环数开关
                {
                    SetPlayerEndTotal(cell.OwningRow);
                }
                GVAR.g_ARPlugin.DataChangedNotify(OVRDataChangedType.emMatchResult, -1, -1, -1, m_nCurMatchID, m_nCurMatchID, null);
            }
        }
        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);
        }