/// <summary>
        /// 데이터베이스가 지정되는 경우 - Parameter로 넘어온 값으로 데이터베이스를 연결한다.
        /// </summary>
        /// <param name="_enumSelectedDatabaseKind">연결 데이터베이스 종류</param>
        public BaseDataAccess(BaseEnumClass.SelectedDatabaseKind _enumSelectedDatabaseKind)
        {
            try
            {
                // 메인(기준) 데이터베이스가 아닌 업무별로 접속 데이터베이스 종류가 다른 경우 Parameter로 받은 데이터베이스 종류 정보를
                // Attribute에 저장한다.
                this.SelectedDatabaseKindEnum = _enumSelectedDatabaseKind;

                switch (SelectedDatabaseKindEnum)
                {
                case BaseEnumClass.SelectedDatabaseKind.ORACLE:
                    this.ConnectionStringDecryptValue = Cryptography.AES.DecryptAES256(this.DatabaseConnectionStringEncryptValue_ORACLE);
                    this.g_oracleLibrary = new OracleLibrary();
                    break;

                case BaseEnumClass.SelectedDatabaseKind.MS_SQL:
                    this.ConnectionStringDecryptValue = Cryptography.AES.DecryptAES256(this.DatabaseConnectionStringEncryptValue_MSSQL);
                    this.g_msSqlLibrary = new MSSqlLibrary();
                    break;

                case BaseEnumClass.SelectedDatabaseKind.MARIA_DB:
                    this.ConnectionStringDecryptValue = Cryptography.AES.DecryptAES256(this.DatabaseConnectionStringEncryptValue_MariaDB);
                    this.g_mariaDBLibrary             = new MariaDBLibrary();
                    break;
                }
            }
            catch { throw; }
        }
Beispiel #2
0
        public FirstDataAccess()
        {
            try
            {
                // App.config에 저장된 메인(기준) 데이터베이스 정보를 가져온다.
                var strMainDatabaseValue = this.BaseClass.MainDatabase;

                // 현재 접속한 데이터베이스 종류를 Attribute에 저장한다.
                // 동일 세션내에서 계속 사용하기 위해 Attribute에 저장
                this.SelectedDatabaseKindEnum = HelperClass.GetDatabaseKindValueByEnumType(strMainDatabaseValue);

                // 데이터베이스 연결 문자열 (복호화 된 데이터)
                this.ConnectionStringDecryptValue = Configuration.GetConnectionStringDecryptValue();

                switch (this.SelectedDatabaseKindEnum)
                {
                case BaseEnumClass.SelectedDatabaseKind.ORACLE:
                    this.g_oracleLibrary = new OracleLibrary();
                    break;

                case BaseEnumClass.SelectedDatabaseKind.MS_SQL:
                    this.g_msSqlLibrary = new MSSqlLibrary();
                    break;

                case BaseEnumClass.SelectedDatabaseKind.MARIA_DB:
                    this.g_mariaDBLibrary = new MariaDBLibrary();
                    break;
                }
            }
            catch { throw; }
        }
        /// <summary>
        /// 데이터베이스가 지정되지 않은 경우 - App.config 파일내 MainDatabase값으로 데이터베이스를 연결한다.
        /// </summary>
        public BaseDataAccess()
        {
            try
            {
                // App.config에 저장된 메인(기준) 데이터베이스 정보를 가져온다.
                var strMainDatabaseValue = this.BaseClass.MainDatabase;

                // 현재 접속한 데이터베이스 종류를 Attribute에 저장한다.
                // 동일 세션내에서 계속 사용하기 위해 Attribute에 저장
                this.SelectedDatabaseKindEnum = HelperClass.GetDatabaseKindValueByEnumType(strMainDatabaseValue);

                // 로그인 화면 오픈할 때 조회한 각 데이터베이스 연결 문자열 (암호화 데이터)을 복호화하여 Attribute에 저장한다.
                // 데이터베이스 연결 및 트랜잭션에 복호화 한 문자열을 사용한다.
                switch (this.SelectedDatabaseKindEnum)
                {
                case BaseEnumClass.SelectedDatabaseKind.ORACLE:
                    this.ConnectionStringDecryptValue = Cryptography.AES.DecryptAES256(this.DatabaseConnectionStringEncryptValue_ORACLE);
                    this.g_oracleLibrary = new OracleLibrary();
                    break;

                case BaseEnumClass.SelectedDatabaseKind.MS_SQL:
                    this.ConnectionStringDecryptValue = Cryptography.AES.DecryptAES256(this.DatabaseConnectionStringEncryptValue_MSSQL);
                    this.g_msSqlLibrary = new MSSqlLibrary();
                    break;

                case BaseEnumClass.SelectedDatabaseKind.MARIA_DB:
                    this.ConnectionStringDecryptValue = Cryptography.AES.DecryptAES256(this.DatabaseConnectionStringEncryptValue_MariaDB);
                    this.g_mariaDBLibrary             = new MariaDBLibrary();
                    break;
                }
            }
            catch { throw; }
        }
Beispiel #4
0
        /// <summary>
        /// 데이터 테이블 형식으로 반환
        /// </summary>
        /// <param name="_strProcedureName">프로시저명</param>
        /// <param name="_dicInputParam">Input 파라메터</param>
        /// <param name="_arrOutputParam">Output 파라메터</param>
        /// <returns></returns>
        public DataTable GetSpDataTable(string _strProcedureName, Dictionary <string, object> _dicInputParam)
        {
            try
            {
                if (this.g_mariaDBLibrary == null)
                {
                    this.g_mariaDBLibrary = new MariaDBLibrary();
                }

                return(this.g_mariaDBLibrary.GetDataTable(this.ConnectionStringDecryptValue, _strProcedureName, _dicInputParam));
            }
            catch { throw; }
        }
Beispiel #5
0
        public void BeginTransaction()
        {
            try
            {
                switch (this.SelectedDatabaseKindEnum)
                {
                case BaseEnumClass.SelectedDatabaseKind.ORACLE:
                    if (this.g_oracleLibrary == null)
                    {
                        using (this.g_oracleLibrary = new OracleLibrary())
                        {
                            this.g_oracleLibrary.BeginTransaction(this.ConnectionStringDecryptValue);
                        }
                    }
                    else
                    {
                        this.g_oracleLibrary.BeginTransaction(this.ConnectionStringDecryptValue);
                    }
                    break;

                case BaseEnumClass.SelectedDatabaseKind.MS_SQL:
                    if (this.g_msSqlLibrary == null)
                    {
                        using (this.g_msSqlLibrary = new MSSqlLibrary())
                        {
                            this.g_msSqlLibrary.BeginTransaction(this.ConnectionStringDecryptValue);
                        }
                    }
                    else
                    {
                        this.g_msSqlLibrary.BeginTransaction(this.ConnectionStringDecryptValue);
                    }
                    break;

                case BaseEnumClass.SelectedDatabaseKind.MARIA_DB:
                    if (this.g_mariaDBLibrary == null)
                    {
                        using (this.g_mariaDBLibrary = new MariaDBLibrary())
                        {
                            this.g_mariaDBLibrary.BeginTransaction(this.ConnectionStringDecryptValue);
                        }
                    }
                    else
                    {
                        this.g_mariaDBLibrary.BeginTransaction(this.ConnectionStringDecryptValue);
                    }
                    break;
                }
            }
            catch { throw; }
        }
Beispiel #6
0
 /// <summary>
 /// 트랜잭션
 /// </summary>
 public void BeginTransaction()
 {
     if (this.g_mariaDBLibrary == null)
     {
         using (this.g_mariaDBLibrary = new MariaDBLibrary())
         {
             this.g_mariaDBLibrary.BeginTransaction(this.ConnectionStringDecryptValue);
         }
     }
     else
     {
         this.g_mariaDBLibrary.BeginTransaction(this.ConnectionStringDecryptValue);
     }
 }
Beispiel #7
0
        /// <summary>
        /// 데이터 테이블 형식으로 반환 (키오스크용)
        /// </summary>
        /// <param name="_strProcedureName">프로시저명</param>
        /// <param name="_dicInputParam">Input 파라메터</param>
        /// <param name="_arrOutputParam">Output 파라메터</param>
        /// <param name="_enumScreenType">화면 타입</param>
        /// <returns></returns>
        public DataTable GetSpDataTable(string _strProcedureName, Dictionary <string, object> _dicInputParam, string[] _arrOutputParam, BaseEnumClass.ScreenType _enumScreenType)
        {
            try
            {
                var dtRtnValue = new DataTable();

                var strSelectedDatabaseKind = this.SelectedDatabaseKindEnum.ToString();
                var strCenterCD             = BaseClass.CenterCD;

                Utility.HelperClass.ProcedureLogInfo(strSelectedDatabaseKind, strCenterCD, _strProcedureName, _dicInputParam, _enumScreenType);

                switch (this.SelectedDatabaseKindEnum)
                {
                case BaseEnumClass.SelectedDatabaseKind.ORACLE:
                    if (this.g_oracleLibrary == null)
                    {
                        this.g_oracleLibrary = new OracleLibrary();
                    }

                    dtRtnValue = this.g_oracleLibrary.GetDataTable(this.ConnectionStringDecryptValue, _strProcedureName, _dicInputParam, _arrOutputParam);
                    break;

                case BaseEnumClass.SelectedDatabaseKind.MS_SQL:
                    if (this.g_msSqlLibrary == null)
                    {
                        this.g_msSqlLibrary = new MSSqlLibrary();
                    }

                    dtRtnValue = this.g_msSqlLibrary.GetDataTable(this.ConnectionStringDecryptValue, _strProcedureName, _dicInputParam);
                    break;

                case BaseEnumClass.SelectedDatabaseKind.MARIA_DB:
                    if (this.g_mariaDBLibrary == null)
                    {
                        this.g_mariaDBLibrary = new MariaDBLibrary();
                    }

                    dtRtnValue = this.g_mariaDBLibrary.GetDataTable(this.ConnectionStringDecryptValue, _strProcedureName, _dicInputParam);
                    break;
                }

                return(dtRtnValue);
            }
            catch { throw; }
        }
        /// <summary>
        /// CLOB 데이터를 파라메터로 받은 후 데이터 테이블 형식으로 반환
        /// </summary>
        /// <param name="_strProcedureName">프로시저명</param>
        /// <param name="_dicInputParam">Input 파라메터</param>
        /// <param name="_swCLOBData">CLOB 데이터</param>
        /// <param name="_arrOutputParam">Output 파라메터</param>
        /// <returns></returns>
        public DataTable GetSpDataTableCLOB(string _strProcedureName, Dictionary <string, object> _dicInputParam, StringWriter _swCLOBData, string[] _arrOutputParam)
        {
            try
            {
                var dtRtnValue = new DataTable();

                switch (this.SelectedDatabaseKindEnum)
                {
                case BaseEnumClass.SelectedDatabaseKind.ORACLE:
                    if (this.g_oracleLibrary == null)
                    {
                        this.g_oracleLibrary = new OracleLibrary();
                    }

                    dtRtnValue = this.g_oracleLibrary.GetDataTableCLOB(this.ConnectionStringDecryptValue, _strProcedureName, _dicInputParam, _swCLOBData, _arrOutputParam);
                    break;

                case BaseEnumClass.SelectedDatabaseKind.MS_SQL:
                    if (this.g_msSqlLibrary == null)
                    {
                        this.g_msSqlLibrary = new MSSqlLibrary();
                    }

                    dtRtnValue = this.g_msSqlLibrary.GetDataTable(this.ConnectionStringDecryptValue, _strProcedureName, _dicInputParam);
                    break;

                case BaseEnumClass.SelectedDatabaseKind.MARIA_DB:
                    if (this.g_mariaDBLibrary == null)
                    {
                        this.g_mariaDBLibrary = new MariaDBLibrary();
                    }

                    dtRtnValue = this.g_mariaDBLibrary.GetDataTable(this.ConnectionStringDecryptValue, _strProcedureName, _dicInputParam);
                    break;
                }

                return(dtRtnValue);
            }
            catch { throw; }
        }