/// <summary> /// 데이터베이스 문자열 데이터를 Enum형식으로 변경한다. /// </summary> /// <param name="_strDatabaseKind">데이터베이스 종류 문자열</param> /// <returns></returns> public static BaseEnumClass.SelectedDatabaseKind GetDatabaseKindValueByEnumType(string _strDatabaseKind) { try { BaseEnumClass.SelectedDatabaseKind enumDatabaseKind = BaseEnumClass.SelectedDatabaseKind.NONE; switch (_strDatabaseKind.ToUpper()) { case "ORACLE": enumDatabaseKind = BaseEnumClass.SelectedDatabaseKind.ORACLE; break; case "MSSQL": enumDatabaseKind = BaseEnumClass.SelectedDatabaseKind.MS_SQL; break; case "MARIADB": enumDatabaseKind = BaseEnumClass.SelectedDatabaseKind.MARIA_DB; break; } return(enumDatabaseKind); } catch { throw; } }
/// <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; } }
/// <summary> /// 공통 데이터 조회 (데이터베이스가 지정된 경우) /// </summary> /// <param name="_enumSelectedDatabaseKind">데이터베이스 지정값</param> /// <param name="_strCommonCode">공통코드</param> /// <param name="_arrComboBoxInputParam">공통코드 조회 파라메터</param> /// <param name="_isfirstRowEmpty">전체 Row 여부</param> /// <returns></returns> public static DataTable GetCommonData( BaseEnumClass.SelectedDatabaseKind _enumSelectedDatabaseKind , string _strCommonCode , string[] _arrComboBoxInputParam , bool _isfirstRowEmpty ) { DataTable dtCommonData = null; var strProcedureName = "PK_COMMON.SP_COM_UI_CMB"; Dictionary <string, object> dicInputParam = new Dictionary <string, object>(); string[] arrOutputParam = { "O_CMB_LIST", "O_RSLT" }; if (_arrComboBoxInputParam == null) { dicInputParam.Add("P_TYPE_CD", _strCommonCode); // 공통코드 dicInputParam.Add("P_ATTR_ONE", string.Empty); // 공통코드 조회 파라메터 1 dicInputParam.Add("P_ATTR_TWO", string.Empty); // 공통코드 조회 파라메터 2 dicInputParam.Add("P_ATTR_THREE", string.Empty); // 공통코드 조회 파라메터 3 dicInputParam.Add("P_ATTR_FOUR", string.Empty); // 공통코드 조회 파라메터 4 } else if (_arrComboBoxInputParam != null && _arrComboBoxInputParam.Length > 0) { dicInputParam.Add("P_TYPE_CD", _strCommonCode); // 공통코드 dicInputParam.Add("P_ATTR_ONE", _arrComboBoxInputParam[0]); // 공통코드 조회 파라메터 1 dicInputParam.Add("P_ATTR_TWO", _arrComboBoxInputParam[1]); // 공통코드 조회 파라메터 2 dicInputParam.Add("P_ATTR_THREE", _arrComboBoxInputParam[2]); // 공통코드 조회 파라메터 3 dicInputParam.Add("P_ATTR_FOUR", _arrComboBoxInputParam[3]); // 공통코드 조회 파라메터 4 } using (BaseDataAccess da = new BaseDataAccess(_enumSelectedDatabaseKind)) { dtCommonData = da.GetSpDataTable(strProcedureName, dicInputParam, arrOutputParam); } if (_isfirstRowEmpty == true) { DataRow drNewRow = dtCommonData.NewRow(); drNewRow["CODE"] = "ALL"; //drNewRow["NAME"] = HelperClass.GetCurrentCultureInfo(); drNewRow["NAME"] = GetAllValueByLanguage(HelperClass.GetCurrentCultureInfo()); dtCommonData.Rows.Add(drNewRow); } return(dtCommonData); }
/// <summary> /// 공통코드 콤보박스 설정 (데이터베이스가 지정된 경우) /// </summary> /// <param name="_ctrlComboBox">콤보박스 컨트롤</param> /// <param name="_enumSelectedDatabaseKind">데이터베이스 지정값</param> /// <param name="_strCommonCode">공통코드</param> /// <param name="_arrComboBoxInputParam">공통코드 조회 파라메터</param> /// <param name="_isFirstRowEmpty">전체 Row 여부</param> public static void BindingCommonComboBox( ComboBoxEdit _ctrlComboBox , BaseEnumClass.SelectedDatabaseKind _enumSelectedDatabaseKind , string _strCommonCode , string[] _arrComboBoxInputParam , bool _isFirstRowEmpty ) { DataTable dtCommonData = GetCommonData(_enumSelectedDatabaseKind, _strCommonCode, _arrComboBoxInputParam, _isFirstRowEmpty); if (dtCommonData != null) { _ctrlComboBox.ItemsSource = Data.ConvertDataTableToList.DataTableToList <ComboBoxInfo>(dtCommonData); if (dtCommonData.Rows.Count > 0) { _ctrlComboBox.SelectedIndex = 0; } } }