示例#1
0
        public bool CheckMatchStated()
        {
            if (GVAR.g_sqlConn.State == System.Data.ConnectionState.Closed)
            {
                GVAR.g_sqlConn.Open();
            }

            if (m_bIsCheckMatchStated)
            {
                return(true);
            }

            SqlCommand cmd = null;

            cmd             = new SqlCommand("Proc_BK_CheckMatchStat", GVAR.g_sqlConn);
            cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter cmdParameter = null;

            cmdParameter = new SqlParameter(
                "@MatchID", SqlDbType.Int, 4,
                ParameterDirection.Input, false, 0, 0, "@MatchID",
                DataRowVersion.Current, GVAR.Str2Int(MatchID));
            cmd.Parameters.Add(cmdParameter);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            m_bIsCheckMatchStated = true;

            return(true);
        }
示例#2
0
        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);
            }
        }
        public void SetPlayerActive(DataGridViewCellMouseEventArgs e, ref DataGridView dgv, ref List <SPlayerInfo> lstActive, int iTeamPos)
        {
            int iSelRowIndex = e.RowIndex;

            if (iSelRowIndex < 0 || iSelRowIndex > dgv.RowCount)
            {
                return;
            }

            int iMatchID  = int.Parse(m_CCurMatch.MatchID);
            int iPlayerID = GVAR.Str2Int(dgv.Rows[iSelRowIndex].Cells["F_RegisterID"].Value);

            if (dgv.Rows[iSelRowIndex].Cells["F_Active"].Value.ToString() == "1")
            {
                GVAR.g_ManageDB.UpdatePlayerActive(iMatchID, iPlayerID, 0, "");
            }
            else
            {
                if (lstActive.Count >= 5)
                {
                    return;
                }
                GVAR.g_ManageDB.UpdatePlayerActive(iMatchID, iPlayerID, 1, "");
            }

            if (iTeamPos == 1)
            {
                ResetPlayerList(iTeamPos, ref dgvHomeList);
                InitPlayerAcitve(iTeamPos, ref lstActive);
            }
            else
            {
                ResetPlayerList(iTeamPos, ref dgvVisitList);
                InitPlayerAcitve(iTeamPos, ref lstActive);
            }
        }
        public void ChangePeriod()
        {
            if (m_CCurMatch.Period == GVAR.PERIOD_EXTRA1)
            {
                if (lbExa1.Visible == false)
                {
                    lbExa1.Visible          = true;
                    txtBox_HPt_Exa1.Visible = true;
                    txtBox_VPt_Exa1.Visible = true;
                }

                if (!GVAR.g_ManageDB.IsExistMatchSplit(ref m_CCurMatch, GVAR.PERIOD_EXTRA1))
                {
                    GVAR.g_ManageDB.AddSplitMatch(ref m_CCurMatch, GVAR.PERIOD_EXTRA1.ToString());
                }
            }
            if (m_CCurMatch.Period == GVAR.PERIOD_EXTRA2)
            {
                if (lbExa2.Visible == false)
                {
                    lbExa2.Visible          = true;
                    txtBox_HPt_Exa2.Visible = true;
                    txtBox_VPt_Exa2.Visible = true;
                }

                if (!GVAR.g_ManageDB.IsExistMatchSplit(ref m_CCurMatch, GVAR.PERIOD_EXTRA2))
                {
                    GVAR.g_ManageDB.AddSplitMatch(ref m_CCurMatch, GVAR.PERIOD_EXTRA2.ToString());
                }
            }
            if (m_CCurMatch.Period == GVAR.PERIOD_EXTRA3)
            {
                if (lbExa3.Visible == false)
                {
                    lbExa3.Visible          = true;
                    txtBox_HPt_Exa3.Visible = true;
                    txtBox_VPt_Exa3.Visible = true;
                }

                if (!GVAR.g_ManageDB.IsExistMatchSplit(ref m_CCurMatch, GVAR.PERIOD_EXTRA3))
                {
                    GVAR.g_ManageDB.AddSplitMatch(ref m_CCurMatch, GVAR.PERIOD_EXTRA3.ToString());
                }
            }
            if (m_CCurMatch.Period == GVAR.PERIOD_EXTRA4)
            {
                if (lbExa4.Visible == false)
                {
                    lbExa4.Visible          = true;
                    txtBox_HPt_Exa4.Visible = true;
                    txtBox_VPt_Exa4.Visible = true;
                }

                if (!GVAR.g_ManageDB.IsExistMatchSplit(ref m_CCurMatch, GVAR.PERIOD_EXTRA4))
                {
                    GVAR.g_ManageDB.AddSplitMatch(ref m_CCurMatch, GVAR.PERIOD_EXTRA4.ToString());
                }
            }

            GVAR.g_ManageDB.UpdateMatchPeriod(ref m_CCurMatch);
            GVAR.g_ManageDB.UpdateTeamSetPt(m_CCurMatch.Period, ref m_CCurMatch);
            lbPeriod.Text = GVAR.g_ManageDB.GetPeriodName(GVAR.Str2Int(m_CCurMatch.MatchID), m_CCurMatch.Period.ToString());
        }
        private void UpdateMatchStatus()
        {
            InitStatusBtn();

            int iMatchID = GVAR.Str2Int(m_CCurMatch.MatchID);

            switch (m_CCurMatch.MatchStatus)
            {
            case GVAR.STATUS_SCHEDULE:
            {
                EnalbeMatchCtrl(true);
                EnableScoreBtn(false);
                btnx_StartList.Enabled = true;
                btnx_Schedule.Checked  = true;
                btnStatus.Text         = btnx_Schedule.Text;
                btnStatus.ForeColor    = System.Drawing.SystemColors.ControlText;
                break;
            }

            case GVAR.STATUS_ON_COURT:
            {
                EnalbeMatchCtrl(true);
                EnableScoreBtn(false);
                btnx_Running.Enabled   = true;
                btnx_StartList.Checked = true;
                btnStatus.Text         = btnx_StartList.Text;
                btnStatus.ForeColor    = System.Drawing.SystemColors.ControlText;
                break;
            }

            case GVAR.STATUS_RUNNING:
            {
                EnalbeMatchCtrl(true);
                EnableScoreBtn(true);
                btnx_Suspend.Enabled    = true;
                btnx_Unofficial.Enabled = true;
                btnx_Running.Checked    = true;
                btnStatus.Text          = btnx_Running.Text;
                btnStatus.ForeColor     = System.Drawing.Color.Red;

                GVAR.g_ManageDB.CheckMatchStat(int.Parse(m_CCurMatch.MatchID));

                break;
            }

            case GVAR.STATUS_SUSPEND:
            {
                EnalbeMatchCtrl(true);
                EnableScoreBtn(false);
                btnx_Running.Enabled = true;
                btnx_Suspend.Checked = true;
                btnStatus.Text       = btnx_Suspend.Text;
                btnStatus.ForeColor  = System.Drawing.Color.Red;
                break;
            }

            case GVAR.STATUS_UNOFFICIAL:
            {
                EnalbeMatchCtrl(true);
                EnableScoreBtn(true);
                btnx_Finished.Enabled   = true;
                btnx_Unofficial.Checked = true;
                btnStatus.Text          = btnx_Unofficial.Text;
                btnStatus.ForeColor     = System.Drawing.Color.LimeGreen;

                UpdateMatchResult();

                int iEventID = GVAR.g_ManageDB.GetEventID(m_CCurMatch.MatchID);
                GVAR.g_BKPlugin.DataChangedNotify(OVRDataChangedType.emMatchResult, -1, iEventID, -1, iMatchID, iMatchID, null);

                OVRDataBaseUtils.AutoProgressMatch(iMatchID, GVAR.g_sqlConn, GVAR.g_BKPlugin);        //自动晋级

                //GVAR.g_ManageDB.AutoGroupRank(iMatchID);       // 自动小组排名
                int iPhaseID = GVAR.g_ManageDB.GetPhaseID(iMatchID);
                GVAR.g_BKPlugin.DataChangedNotify(OVRDataChangedType.emPhaseResult, -1, -1, iPhaseID, -1, iPhaseID, null);

                break;
            }

            case GVAR.STATUS_FINISHED:
            {
                EnalbeMatchCtrl(false);
                EnableScoreBtn(false);

                btnx_Revision.Enabled = true;
                btnx_Finished.Checked = true;
                btnStatus.Text        = btnx_Finished.Text;
                btnStatus.ForeColor   = System.Drawing.Color.LimeGreen;

                int iEventID = GVAR.g_ManageDB.GetEventID(m_CCurMatch.MatchID);
                GVAR.g_BKPlugin.DataChangedNotify(OVRDataChangedType.emMatchResult, -1, iEventID, -1, iMatchID, iMatchID, null);

                OVRDataBaseUtils.AutoProgressMatch(iMatchID, GVAR.g_sqlConn, GVAR.g_BKPlugin); //自动晋级

                GVAR.g_ManageDB.AutoGroupRank(iMatchID);                                       // 自动小组排名
                int iPhaseID = GVAR.g_ManageDB.GetPhaseID(iMatchID);
                GVAR.g_BKPlugin.DataChangedNotify(OVRDataChangedType.emPhaseResult, -1, -1, iPhaseID, -1, iPhaseID, null);
                break;
            }

            case GVAR.STATUS_REVISION:
            {
                EnalbeMatchCtrl(true);
                EnableScoreBtn(true);

                btnx_Finished.Enabled = true;
                btnx_Revision.Checked = true;
                btnStatus.Text        = btnx_Revision.Text;
                btnStatus.ForeColor   = System.Drawing.Color.LimeGreen;
                break;
            }

            case GVAR.STATUS_CANCELED:
            {
                EnalbeMatchCtrl(false);
                EnableScoreBtn(false);

                btnx_Canceled.Checked = true;
                btnStatus.Text        = btnx_Canceled.Text;
                btnStatus.ForeColor   = System.Drawing.SystemColors.ControlText;
                break;
            }

            default:
                return;
            }
        }
示例#6
0
        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);
        }
示例#7
0
        public int ChangePoint(int iTeamPos, bool bAdd, int iPoint)
        {
            int iResult = 0;

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


            OVRBKTeamInfo tmpTeam = new OVRBKTeamInfo();
            int           iSetPt;

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

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

            //判断当前小节的胜负关系


            if (GVAR.Str2Int(m_CHomeTeam.GetScore(m_iPeriod)) > GVAR.Str2Int(m_CVisitTeam.GetScore(m_iPeriod)))
            {
                m_CHomeTeam.SetRank(m_iPeriod, GVAR.RANK_TYPE_1ST);
                m_CVisitTeam.SetRank(m_iPeriod, GVAR.RANK_TYPE_2ND);

                m_CHomeTeam.SetResult(m_iPeriod, GVAR.RESULT_TYPE_WIN);
                m_CVisitTeam.SetResult(m_iPeriod, GVAR.RESULT_TYPE_LOSE);
            }
            else if (GVAR.Str2Int(m_CHomeTeam.GetScore(m_iPeriod)) < GVAR.Str2Int(m_CVisitTeam.GetScore(m_iPeriod)))
            {
                m_CVisitTeam.SetRank(m_iPeriod, GVAR.RANK_TYPE_1ST);
                m_CHomeTeam.SetRank(m_iPeriod, GVAR.RANK_TYPE_2ND);

                m_CVisitTeam.SetResult(m_iPeriod, GVAR.RESULT_TYPE_WIN);
                m_CHomeTeam.SetResult(m_iPeriod, GVAR.RESULT_TYPE_LOSE);
            }
            else
            {
                m_CVisitTeam.SetRank(m_iPeriod, GVAR.RANK_TYPE_TIE);
                m_CHomeTeam.SetRank(m_iPeriod, GVAR.RANK_TYPE_TIE);

                m_CVisitTeam.SetResult(m_iPeriod, GVAR.RESULT_TYPE_TIE);
                m_CHomeTeam.SetResult(m_iPeriod, GVAR.RESULT_TYPE_TIE);
            }


            //计算总分
            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);
        }
示例#8
0
        public bool PutTeamStatDataToDatabase(string strPeriodType, string strTeamID, List <Statistics> lstStat)
        {
            CheckMatchStated();

            if (GVAR.g_sqlConn.State == System.Data.ConnectionState.Closed)
            {
                GVAR.g_sqlConn.Open();
            }

            SqlCommand cmd = null;

            cmd             = new SqlCommand("Proc_BK_ImportTeamPeriodStat", GVAR.g_sqlConn);
            cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter cmdParameter = null;

            cmdParameter = new SqlParameter(
                "@MatchID", SqlDbType.Int, 4,
                ParameterDirection.Input, false, 0, 0, "@MatchID",
                DataRowVersion.Current, GVAR.Str2Int(MatchID));
            cmd.Parameters.Add(cmdParameter);
            cmdParameter = new SqlParameter(
                "@RoundNo", SqlDbType.Int, 4,
                ParameterDirection.Input, false, 0, 0, "@RoundNo",
                DataRowVersion.Current, GVAR.Str2Int(RoundNo));
            cmd.Parameters.Add(cmdParameter);
            cmdParameter = new SqlParameter(
                "@MatchNo", SqlDbType.Int, 4,
                ParameterDirection.Input, false, 0, 0, "@MatchNo",
                DataRowVersion.Current, GVAR.Str2Int(MatchNo));
            cmd.Parameters.Add(cmdParameter);
            cmdParameter = new SqlParameter(
                "@PeriodType", SqlDbType.Int, 4,
                ParameterDirection.Input, false, 0, 0, "@PeriodType",
                DataRowVersion.Current, GVAR.Str2Int(strPeriodType));
            cmd.Parameters.Add(cmdParameter);
            cmdParameter = new SqlParameter(
                "@TeamID", SqlDbType.Int, 4,
                ParameterDirection.Input, false, 0, 0, "@TeamID",
                DataRowVersion.Current, GVAR.Str2Int(strTeamID));
            cmd.Parameters.Add(cmdParameter);

            MakeStatisticsSqlParameter(lstStat, ref cmd);

            cmdParameter = new SqlParameter(
                "@Remark", SqlDbType.Int, 4,
                ParameterDirection.Input, false, 0, 0, "@Remark",
                DataRowVersion.Current, DBNull.Value);
            cmd.Parameters.Add(cmdParameter);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(true);
        }
示例#9
0
        /*
         * 2011	FGM	Field Goals Made	NULL	F_TotalShoots	ENG
         * 2012	FGA	Field Goals Attempt	NULL	F_TotalThrows	ENG
         * 2021	2PTSM	2 Points Made	NULL	F_2PointsShoots	ENG
         * 2022	2PTSA	2 Points Attempt	NULL	F_2PointsThrows	ENG
         * 2031	3PTSM	3 Points Made	NULL	F_3PointsShoots	ENG
         * 2032	3PTSA	3 Points Attempt	NULL	F_3PointsThrows	ENG
         * 2041	FM	Free Made	NULL	F_FreeShoots	ENG
         * 2042	FA	Free Attempt	NULL	F_FreeThrows	ENG
         * 2500	PTS	Points	NULL	F_Points	ENG
         * 2050	TR	Rebounds	NULL	F_Rebounds	ENG
         * 2051	OR	Offensive Rebounds	NULL	F_OffensiveRebounds	ENG
         * 2052	DR	DefensiveRebounds	NULL	F_DefensiveRebounds	ENG
         * 2060	AS	Assists	NULL	F_Assists	ENG
         * 2070	TO	Turnovers	NULL	F_Turnovers	ENG
         * 2080	ST	Steals	NULL	F_Steals	ENG
         * 2090	BS	Blocked Shots	NULL	F_BlockedShots	ENG
         * 2101	OF	Offensive Fouls	NULL	F_OffensiveFouls	ENG
         * 2102	DF	Defensive Fouls	NULL	F_DefensiveFouls	ENG
         * 2100	TF	Fouls	NULL	F_Fouls	ENG
         * 2110	MIN	Minutes Played	NULL	F_MinutesPlayed	ENG
         * NULL	NULL	NULL	NULL	NULL	NULL
         */
        public void MakeStatisticsSqlParameter(List <Statistics> lstStat, ref SqlCommand cmd)
        {
            SqlParameter cmdParameter = null;
            int          nIndex       = 1;

            foreach (Statistics oneStatistics in lstStat)
            {
                if (oneStatistics.StatValue == null || oneStatistics.StatValue == string.Empty)
                {
                    oneStatistics.StatValue = "0";
                }

                String sParameterName = "";
                switch (nIndex)
                {
                case 1:
                    sParameterName = "@FGM";
                    break;

                case 2:
                    sParameterName = "@FGA";
                    break;

                case 3:
                    sParameterName = "@2PTSM";
                    break;

                case 4:
                    sParameterName = "@2PTSA";
                    break;

                case 5:
                    sParameterName = "@3PTSM";
                    break;

                case 6:
                    sParameterName = "@3PTSA";
                    break;

                case 7:
                    sParameterName = "@FM";
                    break;

                case 8:
                    sParameterName = "@FA";
                    break;

                case 9:
                    sParameterName = "@PTS";
                    break;

                case 10:
                    sParameterName = "@TR";
                    break;

                case 11:
                    sParameterName = "@OR";
                    break;

                case 12:
                    sParameterName = "@DR";
                    break;

                case 13:
                    sParameterName = "@AS";
                    break;

                case 14:
                    sParameterName = "@TO";
                    break;

                case 15:
                    sParameterName = "@ST";
                    break;

                case 16:
                    sParameterName = "@BS";
                    break;

                case 17:
                    sParameterName = "@OF";
                    break;

                case 18:
                    sParameterName = "@DF";
                    break;

                case 19:
                    sParameterName = "@TF";
                    break;

                case 20:
                    sParameterName = "@MIN";
                    break;

                default:
                    break;
                }
                cmdParameter = new SqlParameter(
                    sParameterName, SqlDbType.Int, 4,
                    ParameterDirection.Input, false, 0, 0, sParameterName,
                    DataRowVersion.Current, GVAR.Str2Int(oneStatistics.StatValue));
                cmd.Parameters.Add(cmdParameter);

                nIndex++;
            }

            return;
        }
示例#10
0
 public void InitAction(OVRBKMatchInfo tmpMatch, int iMatchSplitID)
 {
     m_iMatchID      = GVAR.Str2Int(tmpMatch.MatchID);
     m_iMatchSplitID = iMatchSplitID;
 }