コード例 #1
0
        private void GetActiveDisciplineID()
        {
            if (sqlConnection.State == System.Data.ConnectionState.Closed)
            {
                sqlConnection.Open();
            }

            try
            {
                #region DML Command Setup for Active Discipline
                SqlCommand cmdDiscipline = new SqlCommand("Proc_GetActiveDiscipline", sqlConnection);
                cmdDiscipline.CommandType = CommandType.StoredProcedure;
                SqlDataReader dr = cmdDiscipline.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        m_strDisciplineID = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_DisciplineID");
                    }
                }
                dr.Close();
                #endregion
            }
            catch (System.Exception e)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(e.Message);
            }
        }
コード例 #2
0
        private void ResetMemberGrid()
        {
            if (sqlConnection.State == System.Data.ConnectionState.Closed)
            {
                sqlConnection.Open();
            }

            try
            {
                #region DML Command Setup for Active Discipline
                string     strDisciplineID = "0";
                SqlCommand cmdDiscipline   = new SqlCommand("Proc_GetActiveDiscipline", sqlConnection);
                cmdDiscipline.CommandType = CommandType.StoredProcedure;
                SqlDataReader dr = cmdDiscipline.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        strDisciplineID = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_DisciplineID");
                    }
                }
                dr.Close();
                #endregion

                #region DML Command Setup for Get Member
                int nRegisterID   = Convert.ToInt32(m_strRegisterID);
                int nDisciplineID = Convert.ToInt32(strDisciplineID);

                SqlCommand cmd = new SqlCommand("Proc_GetMember_WithOrder", sqlConnection);
                cmd.CommandType      = CommandType.StoredProcedure;
                cmd.UpdatedRowSource = UpdateRowSource.None;

                SqlParameter cmdParameter0 = new SqlParameter("@DisciplineID", SqlDbType.Int);
                SqlParameter cmdParameter1 = new SqlParameter("@RegisterID", SqlDbType.Int);
                SqlParameter cmdParameter2 = new SqlParameter("@LanguageCode", SqlDbType.NVarChar, 3);
                cmdParameter0.Value = Convert.ToInt32(strDisciplineID);
                cmdParameter1.Value = Convert.ToInt32(m_strRegisterID);
                cmdParameter2.Value = m_strLanguageCode;

                cmd.Parameters.Add(cmdParameter0);
                cmd.Parameters.Add(cmdParameter1);
                cmd.Parameters.Add(cmdParameter2);
                #endregion

                dr = cmd.ExecuteReader();
                OVRDataBaseUtils.FillDataGridViewWithCmb(dgvMember, dr, 3, 4);
                dr.Close();

                SetGridStyle(dgvMember);
            }
            catch (System.Exception e)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(e.Message);
            }
        }
コード例 #3
0
        private void FillPositionComboBox()
        {
            if (sqlConnection.State == System.Data.ConnectionState.Closed)
            {
                sqlConnection.Open();
            }

            try
            {
                #region DML Command Setup for Active Discipline
                string     strDisciplineID = "0";
                SqlCommand cmdDiscipline   = new SqlCommand("Proc_GetActiveDiscipline", sqlConnection);
                cmdDiscipline.CommandType = CommandType.StoredProcedure;
                SqlDataReader dr = cmdDiscipline.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        strDisciplineID = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_DisciplineID");
                    }
                }
                dr.Close();
                #endregion

                int nDisciplineID = Convert.ToInt32(strDisciplineID);

                #region DML Command Setup for Fill position combo
                SqlCommand cmd = new SqlCommand("Proc_GetPosition", sqlConnection);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter cmdParameter0 = new SqlParameter("@DisciplineID", SqlDbType.Int);
                SqlParameter cmdParameter1 = new SqlParameter("@LanguageCode", SqlDbType.NVarChar, 3);
                cmdParameter0.Value = nDisciplineID;
                cmdParameter1.Value = m_strLanguageCode;

                cmd.Parameters.Add(cmdParameter0);
                cmd.Parameters.Add(cmdParameter1);
                dr = cmd.ExecuteReader();
                #endregion


                DataTable table = new DataTable();
                table.Columns.Add("F_PositionLongName", typeof(string));
                table.Columns.Add("F_PositionID", typeof(int));
                table.Rows.Add("", "-1");
                table.Load(dr);

                (dgvMember.Columns[4] as DGVCustomComboBoxColumn).FillComboBoxItems(table, "F_PositionLongName", "F_PositionID");
                dr.Close();
            }
            catch (System.Exception e)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(e.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);
            }
        }
コード例 #5
0
        private string QueryDistrubutedVersion(string strTplType, string strRscCode)
        {
            string strDisVersion;

            strDisVersion = "";

            strDisVersion = strTplType + strRscCode;
            try
            {
                SqlCommand oneSqlCommand = new SqlCommand();
                oneSqlCommand.Connection  = sqlConnection;
                oneSqlCommand.CommandText = "Proc_GetDistrubutedVersion";
                oneSqlCommand.CommandType = CommandType.StoredProcedure;

                SqlParameter cmdParameter1 = new SqlParameter(
                    "@TplType", SqlDbType.NVarChar, 20,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, strTplType);
                oneSqlCommand.Parameters.Add(cmdParameter1);

                SqlParameter cmdParameter2 = new SqlParameter(
                    "@RscCode", SqlDbType.NVarChar, 50,
                    ParameterDirection.Input, true, 0, 0, "",
                    DataRowVersion.Current, strRscCode);

                oneSqlCommand.Parameters.Add(cmdParameter2);

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

                SqlDataReader sdr = oneSqlCommand.ExecuteReader();
                if (sdr.HasRows)
                {
                    if (sdr.Read())
                    {
                        strDisVersion = OVRDataBaseUtils.GetFieldValue2String(ref sdr, "F_DistrubutedVersion");
                    }
                }
                sdr.Close();
            }
            catch (Exception ex)
            {
                UIMessageDialog.ShowMessageDialog(ex.Message, "Information", false, this.Style);
            }

            return(strDisVersion);
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
        private void GetCommunicationContext()
        {
            if (m_iNewsID <= 0)
            {
                return;
            }
            if (DatabaseConnection.State == System.Data.ConnectionState.Closed)
            {
                sqlConnection.Open();
            }
            try
            {
                SqlCommand cmd = new SqlCommand("Proc_GetOfficialCommunication", DatabaseConnection);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter cmdParameter1 = new SqlParameter("@NewsID", SqlDbType.Int);
                cmdParameter1.Value = m_iNewsID;
                cmd.Parameters.Add(cmdParameter1);

                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        textItem.Text           = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_NewsItem");
                        textSubTitle.Text       = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_SubTitle");
                        textHeading.Text        = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_Heading");
                        textText.Text           = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_Text");
                        textIssuedBy.Text       = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_Issued_by");
                        cmbOCType.SelectedValue = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_Type");
                        dtOCDate.Text           = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_Date");
                        textNote.Text           = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_Note");
                        cmbReportTitle.Text     = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_ReportTitle");
                        txtSummary.Text         = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_Summary");
                        txtDetails.Text         = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_Details");
                    }
                }
                dr.Close();
            }
            catch (System.Exception e)
            {
                UIMessageDialog.ShowMessageDialog(e.Message, "Information", false, this.Style);
            }
        }
コード例 #8
0
        private void GetMFInfo()
        {
            if (m_dbConnect.State == System.Data.ConnectionState.Closed)
            {
                m_dbConnect.Open();
            }

            try
            {
                #region DML Command Setup for Get MFInfo

                SqlCommand cmd = new SqlCommand("Proc_EQ_GetMFID", m_dbConnect);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter cmdParameter1 = new SqlParameter("@MFID", SqlDbType.Int);
                SqlParameter cmdParameter2 = new SqlParameter("@LanguageCode", SqlDbType.NVarChar, 3);

                cmdParameter1.Value = m_iInfoID;
                cmdParameter2.Value = m_strLanguageCode;

                cmd.Parameters.Add(cmdParameter1);
                cmd.Parameters.Add(cmdParameter2);
                #endregion

                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        m_strLongName  = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_MFLongName");
                        m_strShortName = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_MFShortName");
                    }
                }
                dr.Close();
            }
            catch (System.Exception e)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(e.Message);
            }
        }
コード例 #9
0
        public string GetCurActivedLanguageCode()
        {
            if (m_genDataModule.DatabaseConnection.State == System.Data.ConnectionState.Closed)
            {
                m_genDataModule.DatabaseConnection.Open();
            }

            string strSQLDes;

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

            string        strLanguage = "";
            SqlDataReader dr          = cmd.ExecuteReader();

            while (dr.Read())
            {
                strLanguage = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_LanguageCode");
            }
            dr.Close();
            return(strLanguage);
        }
コード例 #10
0
        private void FillComboBox(DevComponents.DotNetBar.Controls.ComboBoxEx combo, SqlDataReader dr, String strValue)
        {
            combo.Items.Clear();
            if (dr.HasRows)
            {
                int nItemIdx    = 0;
                int nSelItemIdx = -1;
                while (dr.Read())
                {
                    ComboBoxItem item = new ComboBoxItem();

                    if (dr.FieldCount >= 2)
                    {
                        item.Text = OVRDataBaseUtils.GetFieldValue2String(ref dr, dr.GetName(0));
                        item.Tag  = OVRDataBaseUtils.GetFieldValue2String(ref dr, dr.GetName(1));
                    }
                    else if (dr.FieldCount == 1)
                    {
                        item.Text = OVRDataBaseUtils.GetFieldValue2String(ref dr, dr.GetName(0));
                        item.Tag  = OVRDataBaseUtils.GetFieldValue2String(ref dr, dr.GetName(0));
                    }
                    combo.Items.Add(item);

                    if (item.Tag.ToString().CompareTo(strValue) == 0)
                    {
                        nSelItemIdx = nItemIdx;
                    }
                    nItemIdx++;
                }

                if (nSelItemIdx >= 0)
                {
                    combo.Text = combo.Items[nSelItemIdx].ToString();
                }
            }
        }
コード例 #11
0
        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);
            }
        }
コード例 #12
0
        private void FillFunctionComboBox(int iMemberID)
        {
            if (sqlConnection.State == System.Data.ConnectionState.Closed)
            {
                sqlConnection.Open();
            }

            try
            {
                #region DML Command Setup for Active Discipline
                string     strDisciplineID = "0";
                SqlCommand cmdDiscipline   = new SqlCommand("Proc_GetActiveDiscipline", sqlConnection);
                cmdDiscipline.CommandType = CommandType.StoredProcedure;
                SqlDataReader dr = cmdDiscipline.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        strDisciplineID = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_DisciplineID");
                    }
                }
                dr.Close();

                int nDisciplineID = Convert.ToInt32(strDisciplineID);

                #endregion

                #region DML Command Setup for Register RegType
                string     strRegType = "";
                string     strSQL     = string.Format("SELECT F_RegTypeID FROM TR_Register WHERE F_RegisterID = {0}", iMemberID);
                SqlCommand RegTypecmd = new SqlCommand(strSQL, sqlConnection);

                dr = RegTypecmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        strRegType = OVRDataBaseUtils.GetFieldValue2String(ref dr, "F_RegTypeID");
                    }
                }
                dr.Close();

                #endregion


                #region DML Command Setup for Fill Function combo

                SqlCommand cmd = new SqlCommand("Proc_GetFunctionInfo", sqlConnection);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter cmdParameter0 = new SqlParameter("@DisciplineID", SqlDbType.Int);
                SqlParameter cmdParameter1 = new SqlParameter("@LanguageCode", SqlDbType.NVarChar, 3);
                SqlParameter cmdParameter2 = new SqlParameter("@RegType", SqlDbType.Int);

                cmdParameter0.Value = nDisciplineID;
                cmdParameter1.Value = m_strLanguageCode;
                if (strRegType.Length == 0)
                {
                    cmdParameter2.Value = DBNull.Value;
                }
                else
                {
                    cmdParameter2.Value = Convert.ToInt32(strRegType);
                }



                cmd.Parameters.Add(cmdParameter0);
                cmd.Parameters.Add(cmdParameter1);
                cmd.Parameters.Add(cmdParameter2);
                dr = cmd.ExecuteReader();
                #endregion

                DataTable table = new DataTable();
                table.Columns.Add("F_Name", typeof(string));
                table.Columns.Add("F_Key", typeof(int));
                table.Load(dr);

                (dgvMember.Columns[3] as DGVCustomComboBoxColumn).FillComboBoxItems(table, "F_Name", "F_Key");
                dr.Close();
            }
            catch (System.Exception e)
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(e.Message);
            }
        }
コード例 #13
0
ファイル: frmPhaseInfo.cs プロジェクト: jack-liaojie/EQ_C-
        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);
            }
        }
コード例 #14
0
        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;
        }