public void GetMatchUniform(int iMatchID, int iTeamPos, ref int iUniformID)
        {
            if (Common.g_DataBaseCon.State == System.Data.ConnectionState.Closed)
            {
                Common.g_DataBaseCon.Open();
            }

            try
            {
                #region DML Command Setup for Get TeamUniform
                string strSQL;
                strSQL = string.Format("SELECT F_UniformID FROM TS_Match_Result WHERE F_MatchID = {0} AND F_CompetitionPosition = {1}", iMatchID, iTeamPos);
                SqlCommand cmd = new SqlCommand(strSQL, Common.g_DataBaseCon);

                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        iUniformID = OVRDataBaseUtils.GetFieldValue2Int32(ref dr, 0);
                    }
                }
                dr.Close();
                #endregion
            }
            catch (System.Exception e)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(e.Message);
            }
        }
示例#2
0
        private void GetActiveInfo(ref int iSportID, ref int iDisciplineID, ref string strLanguageCode, ref int iGroupType)
        {
            if (sqlConnection.State == System.Data.ConnectionState.Closed)
            {
                sqlConnection.Open();
            }
            iSportID        = 0;
            iDisciplineID   = 0;
            strLanguageCode = "CHN";
            iGroupType      = 1;

            try
            {
                #region DML Command Setup for Get Active Info

                SqlCommand cmd = new SqlCommand("Proc_GetActiveInfo", sqlConnection);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter cmdParameter1 = new SqlParameter("@SportID", SqlDbType.Int);
                SqlParameter cmdParameter2 = new SqlParameter("@DisciplineID", SqlDbType.Int);
                SqlParameter cmdParameter3 = new SqlParameter("@LanguageCode", SqlDbType.NVarChar, 3);
                SqlParameter cmdParameter4 = new SqlParameter("@Result", SqlDbType.Int);

                cmdParameter1.Direction = ParameterDirection.Output;
                cmdParameter2.Direction = ParameterDirection.Output;
                cmdParameter3.Direction = ParameterDirection.Output;
                cmdParameter4.Direction = ParameterDirection.Output;

                cmd.Parameters.Add(cmdParameter1);
                cmd.Parameters.Add(cmdParameter2);
                cmd.Parameters.Add(cmdParameter3);
                cmd.Parameters.Add(cmdParameter4);
                cmd.UpdatedRowSource = UpdateRowSource.OutputParameters;
                #endregion

                cmd.ExecuteNonQuery();
                int nRetValue = (int)cmdParameter4.Value;
                if (nRetValue == 1)
                {
                    iSportID        = (int)cmdParameter1.Value;
                    iDisciplineID   = (int)cmdParameter2.Value;
                    strLanguageCode = cmdParameter3.Value.ToString();

                    string strSQLDes;
                    strSQLDes = string.Format("SELECT F_ConfigValue FROM TS_Sport_Config WHERE F_ConfigType = 1 AND F_SportID = {0}", iSportID);
                    SqlCommand    cmd_GroupType = new SqlCommand(strSQLDes, DatabaseConnection);
                    SqlDataReader dr            = cmd_GroupType.ExecuteReader();
                    while (dr.Read())
                    {
                        iGroupType = OVRDataBaseUtils.GetFieldValue2Int32(ref dr, "F_ConfigValue");
                    }
                    dr.Close();
                }
            }
            catch (System.Exception e)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(e.Message);
            }
        }
示例#3
0
        private void InitMatchById(Int32 iNodeType, Int32 iEventID, Int32 iPhaseID, Int32 iMatchID)
        {
            try
            {
                SqlCommand oneSqlCommand = new SqlCommand();
                oneSqlCommand.Connection  = m_DatabaseConnection;
                oneSqlCommand.CommandText = "Proc_GetMatchCompetitionRuleInfo";
                oneSqlCommand.CommandType = CommandType.StoredProcedure;


                SqlParameter cmdParameter1 = new SqlParameter(
                    "@NodeType", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, iNodeType);
                oneSqlCommand.Parameters.Add(cmdParameter1);

                SqlParameter cmdParameter2 = new SqlParameter(
                    "@EventID", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, iEventID);
                oneSqlCommand.Parameters.Add(cmdParameter2);

                SqlParameter cmdParameter3 = new SqlParameter(
                    "@PhaseID", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, iPhaseID);
                oneSqlCommand.Parameters.Add(cmdParameter3);

                SqlParameter cmdParameter4 = new SqlParameter(
                    "@MatchID", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, iMatchID);
                oneSqlCommand.Parameters.Add(cmdParameter4);

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

                SqlDataReader sdr = oneSqlCommand.ExecuteReader();
                if (sdr.HasRows)
                {
                    if (sdr.Read())
                    {
                        CmbCompetitionRule.SelectedValue = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_CompetitionRuleID");
                    }
                }
                sdr.Close();
            }
            catch (Exception ex)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
            }
        }
示例#4
0
        private void InitMatchById(Int32 iMatchID, String strLanguageCode)
        {
            try
            {
                SqlCommand oneSqlCommand = new SqlCommand();
                oneSqlCommand.Connection  = m_DatabaseConnection;
                oneSqlCommand.CommandText = "Proc_GetMatchInfo";
                oneSqlCommand.CommandType = CommandType.StoredProcedure;

                SqlParameter cmdParameter1 = new SqlParameter(
                    "@MatchID", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, iMatchID);
                oneSqlCommand.Parameters.Add(cmdParameter1);

                SqlParameter cmdParameter2 = new SqlParameter(
                    "@LanguageCode", SqlDbType.Char, 3,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, strLanguageCode);

                oneSqlCommand.Parameters.Add(cmdParameter2);

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

                SqlDataReader sdr = oneSqlCommand.ExecuteReader();
                if (sdr.HasRows)
                {
                    if (sdr.Read())
                    {
                        TextCode.Text     = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_MatchCode");
                        TextOrder.Text    = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_Order");
                        TextMatchNum.Text = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_MatchNum");
                        textHasMedal.Text = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_MatchHasMedal");

                        TextLongName.Text  = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_MatchLongName");
                        TextShortName.Text = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_MatchShortName");
                        TextComment.Text   = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_MatchComment");
                        TextComment2.Text  = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "MatchComment2");

                        TextCompetitorNum.Text  = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "MatchCompetitorNum");
                        CmbStatus.SelectedValue = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_MatchStatusID");
                    }
                }
                sdr.Close();
            }
            catch (Exception ex)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
            }
        }
        private void InitMatchInfo()
        {
            SqlConnection theDataBaseCon;

            theDataBaseCon = DVCommon.g_DataBaseCon;

            try
            {
                SqlCommand oneSqlCommand = new SqlCommand();
                oneSqlCommand.Connection  = theDataBaseCon;
                oneSqlCommand.CommandText = "Proc_DV_GetMatchInfo";
                oneSqlCommand.CommandType = CommandType.StoredProcedure;

                SqlParameter cmdParameter1 = new SqlParameter(
                    "@MatchID", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, m_iCurMatchID);
                oneSqlCommand.Parameters.Add(cmdParameter1);

                SqlParameter cmdParameter2 = new SqlParameter(
                    "@LanguageCode", SqlDbType.Char, 3,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, m_strLanguageCode);

                oneSqlCommand.Parameters.Add(cmdParameter2);

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

                SqlDataReader sdr = oneSqlCommand.ExecuteReader();
                if (sdr.HasRows)
                {
                    if (sdr.Read())
                    {
                        lb_MatchDes.Text  = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "MatchDes");
                        m_iDisciplineID   = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_DisciplineID");
                        m_iCurMatchRuleID = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_CompetitionRuleID");
                    }
                }
                sdr.Close();
            }
            catch (Exception ex)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
            }
        }
示例#6
0
        private int GetCodeLength()
        {
            if (sqlConnection.State == System.Data.ConnectionState.Closed)
            {
                sqlConnection.Open();
            }

            SqlDataReader dr = null;

            try
            {
                string strItemName = "MatchCodeLength";

                string strSQL;
                strSQL = String.Format("SELECT ItemValue FROM TC_Discipline_Config WHERE ItemName = '{0}'", strItemName);

                SqlCommand cmd = new SqlCommand(strSQL, sqlConnection);
                dr = cmd.ExecuteReader();

                int iLength = 0;
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        iLength = OVRDataBaseUtils.GetFieldValue2Int32(ref dr, "ItemValue");
                    }
                    dr.Close();
                }
                return(iLength);
            }
            catch (System.Exception e)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(e.Message);
                if (dr != null)
                {
                    dr.Close();
                }
                return(0);
            }
        }
示例#7
0
        public Int32 GetActiveSport()
        {
            if (m_genDataModule.DatabaseConnection.State == System.Data.ConnectionState.Closed)
            {
                m_genDataModule.DatabaseConnection.Open();
            }

            string strSQLDes;

            strSQLDes = "SELECT F_SportID FROM TS_Sport WHERE F_Active = 1";
            SqlCommand cmd = new SqlCommand(strSQLDes, m_genDataModule.DatabaseConnection);

            int           iActiveInfo = 0;
            SqlDataReader dr          = cmd.ExecuteReader();

            while (dr.Read())
            {
                iActiveInfo = OVRDataBaseUtils.GetFieldValue2Int32(ref dr, "F_SportID");
            }
            dr.Close();
            return(iActiveInfo);
        }
示例#8
0
        private Int32 GetGroupType()
        {
            if (m_RegisterModule.DatabaseConnection.State == System.Data.ConnectionState.Closed)
            {
                m_RegisterModule.DatabaseConnection.Open();
            }

            int iSportID = m_iActiveSport;

            string strSQLDes;

            strSQLDes = string.Format("SELECT F_ConfigValue FROM TS_Sport_Config WHERE F_ConfigType = 1 AND F_SportID = {0}", iSportID);
            SqlCommand cmd = new SqlCommand(strSQLDes, m_RegisterModule.DatabaseConnection);

            int           iGroupType = -1;
            SqlDataReader dr         = cmd.ExecuteReader();

            if (dr.Read())
            {
                iGroupType = OVRDataBaseUtils.GetFieldValue2Int32(ref dr, "F_ConfigValue");
            }
            dr.Close();
            return(iGroupType);
        }
示例#9
0
        public Int32 GetCurActivedDisciplineID()
        {
            if (m_genDataModule.DatabaseConnection.State == System.Data.ConnectionState.Closed)
            {
                m_genDataModule.DatabaseConnection.Open();
            }

            SqlCommand cmdDiscipline = new SqlCommand("Proc_GetActiveDiscipline", m_genDataModule.DatabaseConnection);

            cmdDiscipline.CommandType = CommandType.StoredProcedure;
            SqlDataReader dr            = cmdDiscipline.ExecuteReader();
            Int32         iDisciplineID = -1;

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    iDisciplineID = OVRDataBaseUtils.GetFieldValue2Int32(ref dr, "F_DisciplineID");
                }
            }
            dr.Close();

            return(iDisciplineID);
        }
        private void InitCompetitionPositionById(Int32 iMatchID, Int32 iCompetitionPosition, String strLanguageCode)
        {
            try
            {
                SqlCommand oneSqlCommand = new SqlCommand();
                oneSqlCommand.Connection  = m_DatabaseConnection;
                oneSqlCommand.CommandText = "Proc_GetCompetitionPositionInfo";
                oneSqlCommand.CommandType = CommandType.StoredProcedure;

                SqlParameter cmdParameter1 = new SqlParameter(
                    "@MatchID", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, iMatchID);
                oneSqlCommand.Parameters.Add(cmdParameter1);

                SqlParameter cmdParameter2 = new SqlParameter(
                    "@CompetitionPosition", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, iCompetitionPosition);
                oneSqlCommand.Parameters.Add(cmdParameter2);

                SqlParameter cmdParameter3 = new SqlParameter(
                    "@LanguageCode", SqlDbType.Char, 3,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, strLanguageCode);
                oneSqlCommand.Parameters.Add(cmdParameter3);

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

                SqlDataReader sdr = oneSqlCommand.ExecuteReader();
                if (sdr.HasRows)
                {
                    if (sdr.Read())
                    {
                        TextMatchName.Text         = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_MatchLongName");
                        TextPositionDes1.Text      = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_CompetitionPositionDes1");
                        TextPositionDes2.Text      = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_CompetitionPositionDes2");
                        TextPositionSourceDes.Text = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_CompetitorSourceDes");

                        CmbCompetitor.SelectedValue = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_RegisterID");

                        CmbStartPhase.SelectedValue = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_StartPhaseID");
                        TextPhasePosition.Text      = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_StartPhasePosition");

                        CmbSourcePhase.SelectedValue = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_SourcePhaseID");
                        TextPhaseRank.Text           = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_SourcePhaseRank");

                        CmbSourcePhaseForMatch.SelectedValue = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_SourcePhaseID");
                        CmbSourceMatch.SelectedValue         = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_SourceMatchID");
                        TextMatchRank.Text = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_SourceMatchRank");

                        CmbSourcePhaseforHistoryMatch.SelectedValue = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_SourcePhaseID");
                        CmbHistoryMatch.SelectedValue = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_HistoryMatchID");
                        TextHistoryMatchRank.Text     = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_HistoryMatchRank");
                        TextHistoryLevel.Text         = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_HistoryLevel");

                        TextSourceProgress.Text = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_SouceProgressDes");
                        TextProgress.Text       = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_ProgressDes");

                        m_iPositionSourceType = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "PositionSourceType");
                        //IntiSourceControls(m_iPositionSourceType);
                        switch (m_iPositionSourceType)
                        {
                        case 1:
                            RadioFromPhasePosition.Checked = true;
                            break;

                        case 2:
                            RadioFromPhaseRank.Checked = true;
                            break;

                        case 3:
                            RadioFromMatchRank.Checked = true;
                            break;

                        case 4:
                            RadioFromMatchHistory.Checked = true;
                            break;

                        case 0:
                            RadioFromPhasePosition.Checked = false;
                            RadioFromPhaseRank.Checked     = false;
                            RadioFromMatchRank.Checked     = false;
                            RadioFromMatchHistory.Checked  = false;
                            break;
                        }
                    }
                }
                sdr.Close();
            }
            catch (Exception ex)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
            }
        }
示例#11
0
        private void AddRegisterMember(int nRegisterID, int nMemberID)
        {
            if (sqlConnection.State == System.Data.ConnectionState.Closed)
            {
                sqlConnection.Open();
            }

            try
            {
                #region DML Command Setup for Find Member Basic Funciton

                int        iFunctionID = 0;
                String     strSQL      = string.Format("SELECT F_FunctionID FROM TR_Register WHERE F_RegisterID = {0}", nMemberID);
                SqlCommand cmd_Func    = new SqlCommand(strSQL, sqlConnection);

                SqlDataReader dr = cmd_Func.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        iFunctionID = OVRDataBaseUtils.GetFieldValue2Int32(ref dr, 0);
                    }
                }
                dr.Close();
                #endregion

                #region DML Command Setup for Add RegisterMember
                SqlCommand cmd = new SqlCommand("proc_AddMemberRegister_WithOrder", sqlConnection);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter cmdParameter1 = new SqlParameter(
                    "@RegisterID", SqlDbType.Int, 4,
                    ParameterDirection.Input, false, 0, 0, "@RegisterID",
                    DataRowVersion.Current, nRegisterID);

                SqlParameter cmdParameter2 = new SqlParameter(
                    "@MemberRegisterID", SqlDbType.Int, 4,
                    ParameterDirection.Input, false, 0, 0, "@MemberRegisterID",
                    DataRowVersion.Default, nMemberID);

                SqlParameter cmdParameter3 = new SqlParameter(
                    "@FunctionID", SqlDbType.Int, 4);

                SqlParameter cmdParameter4 = new SqlParameter(
                    "@PositionID", SqlDbType.Int, 4,
                    ParameterDirection.Input, false, 0, 0, "@PositionID",
                    DataRowVersion.Default, DBNull.Value);

                SqlParameter cmdParameter5 = new SqlParameter(
                    "@Order", SqlDbType.Int, 4,
                    ParameterDirection.Input, false, 0, 0, "@Order",
                    DataRowVersion.Default, DBNull.Value);

                SqlParameter cmdParameter6 = new SqlParameter(
                    "@ShirtNum", SqlDbType.Int, 4,
                    ParameterDirection.Input, false, 0, 0, "@ShirtNum",
                    DataRowVersion.Default, DBNull.Value);

                SqlParameter cmdParameter7 = new SqlParameter(
                    "@Result", SqlDbType.Int, 4,
                    ParameterDirection.Output, false, 0, 0, "@Result",
                    DataRowVersion.Default, DBNull.Value);

                if (iFunctionID != 0)
                {
                    cmdParameter3.Value = iFunctionID;
                }
                else
                {
                    cmdParameter3.Value = DBNull.Value;
                }

                cmd.Parameters.Add(cmdParameter1);
                cmd.Parameters.Add(cmdParameter2);
                cmd.Parameters.Add(cmdParameter3);
                cmd.Parameters.Add(cmdParameter4);
                cmd.Parameters.Add(cmdParameter5);
                cmd.Parameters.Add(cmdParameter6);
                cmd.Parameters.Add(cmdParameter7);
                cmd.UpdatedRowSource = UpdateRowSource.OutputParameters;
                #endregion

                cmd.ExecuteNonQuery();
                int    nRetValue = (int)cmd.Parameters["@Result"].Value;
                string strPromotion;
                switch (nRetValue)
                {
                case 0:
                    strPromotion = LocalizationRecourceManager.GetString(this.Name, "AddMember_Failed");
                    DevComponents.DotNetBar.MessageBoxEx.Show(strPromotion);
                    break;

                case -1:
                    strPromotion = LocalizationRecourceManager.GetString(this.Name, "AddMember_Team");
                    DevComponents.DotNetBar.MessageBoxEx.Show(strPromotion);
                    break;

                case -2:
                    strPromotion = LocalizationRecourceManager.GetString(this.Name, "AddMember_Pair");
                    DevComponents.DotNetBar.MessageBoxEx.Show(strPromotion);
                    break;

                default:
                    m_bModified = true;
                    break;
                }
            }
            catch (System.Exception e)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(e.Message);
            }
        }
示例#12
0
        private void InitPhaseById(Int32 iPhaseID, String strLanguageCode)
        {
            try
            {
                SqlCommand oneSqlCommand = new SqlCommand();
                oneSqlCommand.Connection  = m_DatabaseConnection;
                oneSqlCommand.CommandText = "Proc_GetPhaseInfo";
                oneSqlCommand.CommandType = CommandType.StoredProcedure;

                SqlParameter cmdParameter1 = new SqlParameter(
                    "@PhaseID", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, iPhaseID);
                oneSqlCommand.Parameters.Add(cmdParameter1);

                SqlParameter cmdParameter2 = new SqlParameter(
                    "@LanguageCode", SqlDbType.Char, 3,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, strLanguageCode);

                oneSqlCommand.Parameters.Add(cmdParameter2);

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

                SqlDataReader sdr = oneSqlCommand.ExecuteReader();
                if (sdr.HasRows)
                {
                    if (sdr.Read())
                    {
                        TextCode.Text     = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_PhaseCode");
                        DateStart.Text    = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_OpenDate");
                        DateEnd.Text      = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_CloseDate");
                        TextOrder.Text    = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_Order");
                        textIsPool.Text   = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_PhaseIsPool");
                        textHasPools.Text = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_PhaseHasPools");

                        TextLongName.Text  = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_PhaseLongName");
                        TextShortName.Text = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_PhaseShortName");
                        TextComment.Text   = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_PhaseComment");

                        CmbStatus.SelectedValue = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_PhaseStatusID");

                        m_strIniPhaseCode = TextCode.Text;
                        m_strIniDateStart = DateStart.Text;
                        m_strIniDateEnd   = DateEnd.Text;
                        m_strIniOrder     = TextOrder.Text;
                        m_strIniIsPool    = textIsPool.Text;
                        m_strIniHasPool   = textHasPools.Text;
                        m_strIniLongName  = TextLongName.Text;
                        m_strIniShortName = TextShortName.Text;
                        m_strIniComment   = TextComment.Text;
                        m_strIniStatusID  = CmbStatus.SelectedValue.ToString();

                        m_iEventID       = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_EventID");
                        m_iPhaseID       = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_PhaseID");
                        m_iFatherPhaseID = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_FatherPhaseID");
                    }
                }
                sdr.Close();
            }
            catch (Exception ex)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
            }
        }
        private void RefreshPhaseTree()
        {
            advTree.BeginUpdate();
            advTree.Nodes.Clear();
            DevComponents.AdvTree.Node oLastSelNode = null;
            try
            {
                SqlCommand oneSqlCommand = new SqlCommand();
                oneSqlCommand.Connection  = m_matchScheduleModule.DatabaseConnection;
                oneSqlCommand.CommandText = "Proc_GetScheduleTree";
                oneSqlCommand.CommandType = CommandType.StoredProcedure;

                SqlParameter cmdParameter1 = new SqlParameter(
                    "@ID", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "@ID",
                    DataRowVersion.Current, m_strDisciplineID);
                oneSqlCommand.Parameters.Add(cmdParameter1);

                SqlParameter cmdParameter2 = new SqlParameter(
                    "@Type", SqlDbType.Int, 4,
                    ParameterDirection.Input, true, 0, 0, "@Type",
                    DataRowVersion.Current, -5);
                oneSqlCommand.Parameters.Add(cmdParameter2);

                SqlParameter cmdParameter3 = new SqlParameter(
                    "@LanguageCode", SqlDbType.Char, 3,
                    ParameterDirection.Input, true, 0, 0, "@LanguageCode",
                    DataRowVersion.Current, m_strActiveLanguageCode);

                oneSqlCommand.Parameters.Add(cmdParameter3);

                if (m_matchScheduleModule.DatabaseConnection.State == System.Data.ConnectionState.Closed)
                {
                    m_matchScheduleModule.DatabaseConnection.Open();
                }

                SqlDataReader sdr = oneSqlCommand.ExecuteReader();

                int cols = sdr.FieldCount;                                          //获取结果行中的列数

                object[] values = new object[cols];
                if (sdr.HasRows)
                {
                    while (sdr.Read())
                    {
                        String strNodeName      = "";
                        String strNodeKey       = "";
                        String strFatherNodeKey = "";
                        int    iNodeType        = -5;//-4表示所有Sport, -3表示Sport,-2表示Discipline,-1表示Event,0表示Phase
                        int    iSportID         = 0;
                        int    iDisciplineID    = 0;
                        int    iEventID         = 0;
                        int    iPhaseID         = 0;
                        int    iPhaseType       = 0;
                        int    iPhaseSize       = 0;
                        int    iFatherPhaseID   = 0;
                        int    iMatchID         = 0;
                        int    nImage           = 0;
                        int    nSelectedImage   = 0;

                        strNodeName      = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_NodeName");
                        strNodeKey       = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_NodeKey");
                        strFatherNodeKey = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_FatherNodeKey");
                        iNodeType        = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_NodeType");
                        iSportID         = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_SportID");
                        iDisciplineID    = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_DisciplineID");
                        iEventID         = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_EventID");
                        iPhaseID         = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_PhaseID");
                        iPhaseType       = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_PhaseType");
                        iPhaseSize       = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_PhaseSize");
                        iFatherPhaseID   = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_FatherPhaseID");
                        iMatchID         = OVRDataBaseUtils.GetFieldValue2Int32(ref sdr, "F_MatchID");
                        nImage           = iNodeType + 3;
                        nSelectedImage   = iNodeType + 3;

                        SAxTreeNodeInfo oneSNodeInfo = new SAxTreeNodeInfo();
                        oneSNodeInfo.strNodeKey     = strNodeKey;
                        oneSNodeInfo.iNodeType      = iNodeType;
                        oneSNodeInfo.iSportID       = iSportID;
                        oneSNodeInfo.iDisciplineID  = iDisciplineID;
                        oneSNodeInfo.iEventID       = iEventID;
                        oneSNodeInfo.iPhaseID       = iPhaseID;
                        oneSNodeInfo.iPhaseType     = iPhaseType;
                        oneSNodeInfo.iPhaseSize     = iPhaseSize;
                        oneSNodeInfo.iFatherPhaseID = iFatherPhaseID;
                        oneSNodeInfo.iMatchID       = iMatchID;

                        DevComponents.AdvTree.Node oneNode = new DevComponents.AdvTree.Node();
                        oneNode.Text               = strNodeName;
                        oneNode.ImageIndex         = nImage;
                        oneNode.ImageExpandedIndex = nSelectedImage;
                        oneNode.Tag     = oneSNodeInfo;
                        oneNode.DataKey = strNodeKey;

                        if (oneSNodeInfo.iNodeType == -3)
                        {
                            oneNode.Expanded = true;
                        }
                        if (oneSNodeInfo.iNodeType == -2 && oneSNodeInfo.iDisciplineID == m_iActiveDisciplineID)
                        {
                            oneNode.Expanded = true;
                        }

                        DevComponents.AdvTree.Node FatherNode = advTree.FindNodeByDataKey(strFatherNodeKey);
                        if (FatherNode == null)
                        {
                            advTree.Nodes.Add(oneNode);
                        }
                        else
                        {
                            FatherNode.Nodes.Add(oneNode);
                        }

                        if (m_strLastSelPhaseTreeNodeKey == strNodeKey)
                        {
                            oLastSelNode     = oneNode;
                            oneNode.Expanded = true;

                            // Expand All Parent Node
                            DevComponents.AdvTree.Node node = oLastSelNode;
                            while (node.Parent != null)
                            {
                                node.Parent.Expanded = true;
                                node = node.Parent;
                            }
                        }
                    }
                }

                sdr.Close();
            }
            catch (Exception ex)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(ex.Message);
            }

            advTree.EndUpdate();
            advTree.SelectedNode = oLastSelNode;
        }