コード例 #1
0
        /// <summary>
        /// check for a valid connection
        /// </summary>
        /// <returns></returns>
        public CStatus DBConnValid()
        {
            CStatus status = new CStatus();

            status.StatusCode    = k_STATUS_CODE.Success;
            status.Status        = true;
            status.StatusComment = String.Empty;

            if (DBConn == null)
            {
                status.Status        = false;
                status.StatusCode    = k_STATUS_CODE.Failed;
                status.StatusComment = "Database connection is null!";
            }

            return(status);
        }
コード例 #2
0
        /// <summary>
        /// NEW execute with status info returned
        /// </summary>
        /// <param name="strSPName"></param>
        /// <param name="ParamList"></param>
        /// <returns></returns>
        public CStatus ExecuteOracleSP(string strSPName,
                                       CParameterList ParamList)
        {
            k_STATUS_CODE lStatusCode = k_STATUS_CODE.Success;
            string        strStatus   = String.Empty;

            CStatus status = new CStatus();

            status.Status = ExecuteOracleSP(strSPName,
                                            ParamList,
                                            out lStatusCode,
                                            out strStatus);
            status.StatusCode    = lStatusCode;
            status.StatusComment = strStatus;

            return(status);
        }
コード例 #3
0
        /// <summary>
        /// New call using CStatus, calls will be convertyed to this later
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="strSPName"></param>
        /// <param name="ParamList"></param>
        /// <param name="ds"></param>
        /// <returns></returns>
        public CStatus GetOracleDataSet(CDataConnection conn,
                                        string strSPName,
                                        CParameterList ParamList,
                                        out DataSet ds)
        {
            ds = null;

            k_STATUS_CODE lStatusCode = k_STATUS_CODE.Success;
            string        strStatus   = String.Empty;

            CStatus status = new CStatus();

            status.Status = GetOracleDataSet(conn,
                                             strSPName,
                                             ParamList,
                                             out ds,
                                             out lStatusCode,
                                             out strStatus);
            status.StatusCode    = lStatusCode;
            status.StatusComment = strStatus;

            return(status);
        }
コード例 #4
0
ファイル: CDataUtils.cs プロジェクト: whitten/CheckListTool
        /// <summary>
        /// US:838
        /// gets a dataset as delimeted fields
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="strField"></param>
        /// <param name="strData"></param>
        /// <returns></returns>
        static public CStatus GetDSDelimitedData(
            DataSet ds,
            string strField,
            string strDelimeter,
            out string strData)
        {
            strData = string.Empty;
            CStatus status = new CStatus();

            try
            {
                foreach (DataTable table in ds.Tables)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        if (!row.IsNull(strField))
                        {
                            string strValue = GetDSStringValue(row, strField);
                            if (!String.IsNullOrEmpty(strValue))
                            {
                                //add the value and delimeter to the list
                                strData += strValue;
                                strData += strDelimeter;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                status.Status        = false;
                status.StatusCode    = k_STATUS_CODE.Failed;
                status.StatusComment = e.Message;
            }

            return(status);
        }
コード例 #5
0
 public CStringStatus(CStatus status, string strValue)
     : base(status.Status, status.StatusCode, status.StatusComment)
 {
     m_strValue = strValue;
 }
コード例 #6
0
        /// <summary>
        /// Connect to the Oracle database using the connection string
        /// passed in. if bAudit is true, all SP calls are audited
        /// to the FX_AUDIT table
        /// </summary>
        /// <param name="strConnectionString"></param>
        /// <param name="bAudit"></param>
        /// <returns></returns>
        public CStatus Connect(string strConnectionString,
                               bool bAudit)
        {
            m_bAudit = bAudit;
            CStatus status = new CStatus();

            //close connection if it is open
            if (m_OracleConnection != null)
            {
                try
                {
                    m_OracleConnection.Close();
                    m_OracleConnection = null;
                }
                catch (OracleException e)
                {
                    m_OracleConnection   = null;
                    status.StatusComment = e.Message;
                    status.StatusCode    = k_STATUS_CODE.Failed;
                    status.Status        = false;
                }
            }

            //make sure the string is valid
            if (String.IsNullOrEmpty(strConnectionString))
            {
                status.StatusComment = "Connectuion string is empty!";
                status.StatusCode    = k_STATUS_CODE.Failed;
                status.Status        = false;
                m_OracleConnection   = null;

                return(status);
            }

            //trim the connection string
            string strConnString = strConnectionString.Trim();

            try
            {
                m_OracleConnection = new OracleConnection(strConnString);
                m_OracleConnection.Open();

                strConnString = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
                return(status);
            }
            catch (OracleException e)
            {
                status.StatusComment = e.Message;
                status.StatusCode    = k_STATUS_CODE.Failed;
                status.Status        = false;
                m_OracleConnection   = null;

                strConnString = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
                return(status);
            }
            catch (ArgumentException ee)
            {
                status.StatusComment = ee.Message;
                status.StatusCode    = k_STATUS_CODE.Failed;
                status.Status        = false;
                m_OracleConnection   = null;

                strConnString = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
                return(status);
            }
            catch (Exception eee)
            {
                status.StatusComment = eee.Message;
                status.StatusCode    = k_STATUS_CODE.Failed;
                status.Status        = false;
                m_OracleConnection   = null;

                strConnString = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
                return(status);
            }
        }