public Constants() { PATH_CONFIG = PATH_ROOT + PATH_CONFIG; PATH_DB = PATH_ROOT + PATH_DB; PATH_CERT = PATH_ROOT + PATH_CERT; ENCRYPT_CERT_FILE = PATH_CERT + ENCRYPT_CERT_FILE; PATH_CONFIG_FILE = PATH_CONFIG + PATH_CONFIG_FILE; PATH_DB_FILE = PATH_DB + PATH_DB_FILE; CONF_MANAGER = GTF_ConfigManager.Instance(null); CONF_MANAGER.loadAppConfig(PATH_CONFIG_FILE); LDB_MANAGER = GTF_LocalDBManager.Instance(); LDB_MANAGER.dbOpen(PATH_DB_FILE); PASSPORT_TYPE = "".Equals(LDB_MANAGER.selectConfigData("PASSPORT_TYPE")) ? -1 : Int32.Parse(LDB_MANAGER.selectConfigData("PASSPORT_TYPE")); PRINTER_TYPE = LDB_MANAGER.selectConfigData("PRINTER_TYPE"); PRINTER_OPOS_TYPE = LDB_MANAGER.selectConfigData("PRINTER_OPOS_TYPE"); PRINTER_SELECT = LDB_MANAGER.selectConfigData("PRINTER_SELECT"); SLIP_TYPE = "".Equals(LDB_MANAGER.selectConfigData("SLIP_TYPE")) ? -1 : Int32.Parse(LDB_MANAGER.selectConfigData("SLIP_TYPE")); SYSTEM_LANGUAGE = CONF_MANAGER.getAppValue("DEFAULT_LANG"); //터미널 기본언어 세팅 IS_DEV = "Y".Equals(CONF_MANAGER.getAppValue("DEV")); //개발여부 SERVER_URL = CONF_MANAGER.getAppValue("SERVER_URL"); APPEND_KEY = CONF_MANAGER.getAppValue("APPEND_KEY"); SCAN_TIMEOUT = int.Parse(CONF_MANAGER.getAppValue("SCAN_TIMEOUT")); SERVER_TIMEOUT = int.Parse(CONF_MANAGER.getAppValue("SERVER_TIMEOUT")); OUTLET_TYPE = CONF_MANAGER.getAppValue("OUTLET_TYPE"); //국가별 화면 디스크립트 load CONF_MANAGER.loadCustomConfig("ScreenText", PATH_CONFIG + "ScreenText.xml"); //국가별Message load CONF_MANAGER.loadCustomConfig("Message", PATH_CONFIG + "Message.xml"); //ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //LOGGER 는 단말기 프로잭트 내에선 Constants 클래스 호출해서 사용 //타 패키지에서는 생성자에서 Logger 를 세팅. log4net.Config.BasicConfigurator.Configure(); XmlConfigurator.Configure(new System.IO.FileInfo(PATH_CONFIG + "\\" + CONF_MANAGER.getAppValue("LOG4NET_CONFIG"))); // <- Application base 디렉토리의 log4net.xml을 읽어들일 때. LOGGER_DOC = log4net.LogManager.GetLogger("DOC"); LOGGER_SCREEN = log4net.LogManager.GetLogger("SCREEN"); LOGGER_MAIN = log4net.LogManager.GetLogger("MAIN"); ILog dd = log4net.LogManager.GetLogger("ConsoleAppender"); log4net.Config.BasicConfigurator.Configure(); }
public static JArray ARR_RATE_INFO = null; //환급율 public Constants(Control cParent) { try { ONLINE_STATUS = false; LOGIN_YN = false; CODE_DOWNLOAD = false; string appPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath); PATH_ROOT = appPath + PATH_ROOT; PATH_CONFIG = PATH_ROOT + PATH_CONFIG; PATH_DB = PATH_ROOT + PATH_DB; ////로컬 DB 폴더 if (!System.IO.Directory.Exists(PATH_DB)) { System.IO.Directory.CreateDirectory(PATH_DB); } //TEMP 폴더 PATH_TEMP = PATH_ROOT + PATH_TEMP; if (!System.IO.Directory.Exists(PATH_TEMP)) { System.IO.Directory.CreateDirectory(PATH_TEMP); } PATH_CONFIG_FILE = PATH_CONFIG + PATH_CONFIG_FILE; //PATH_CONFIG_FILE = "C:/Users/GTF_HCH/workspace/GTF_GRIM_HOTEL/GTF_GRIM_HOTEL/Config/Config.xml"; PATH_DB_FILE = PATH_DB + PATH_DB_FILE; LOGGER_DOC = log4net.LogManager.GetLogger("DOC"); LOGGER_SCREEN = log4net.LogManager.GetLogger("SCREEN"); LOGGER_MAIN = log4net.LogManager.GetLogger("MAIN"); log4net.Config.BasicConfigurator.Configure(); CONF_MANAGER = GTF_ConfigManager.Instance(LOGGER_MAIN); if (!CONF_MANAGER.loadAppConfig(PATH_CONFIG_FILE)) { MessageBox.Show(cParent, "환결설정 파일을 읽을 수 없습니다.", "Config", MessageBoxButtons.OK, MessageBoxIcon.Warning); Application.ExitThread(); Environment.Exit(0); return; } LDB_MANAGER = GTF_LocalDBManager.Instance(LOGGER_MAIN); if (!LDB_MANAGER.dbOpen(PATH_DB_FILE)) { MessageBox.Show(cParent, "로컬 DB 파일을 읽을 수 없습니다.", "Config", MessageBoxButtons.OK, MessageBoxIcon.Warning); Application.ExitThread(); Environment.Exit(0); return; } //환경설정 읽음 TML_ID = LDB_MANAGER.selectConfigData("TML_ID"); PASSPORT_TYPE = string.Empty.Equals(LDB_MANAGER.selectConfigData("PASSPORT_TYPE")) ? -1 : Int32.Parse(LDB_MANAGER.selectConfigData("PASSPORT_TYPE")); PRINTER_SELECT_TYPE = string.Empty.Equals(LDB_MANAGER.selectConfigData("PRINTER_SELECT_TYPE")) ? -1 : Int32.Parse(LDB_MANAGER.selectConfigData("PRINTER_SELECT_TYPE")); SIGN_PAD_TYPE = string.Empty.Equals(LDB_MANAGER.selectConfigData("SIGN_PAD_TYPE")) ? -1 : Int32.Parse(LDB_MANAGER.selectConfigData("SIGN_PAD_TYPE")); SHOP_NAME = LDB_MANAGER.selectConfigData("SHOP_NAME"); STANDARD_SELL_PRICE = string.Empty.Equals(LDB_MANAGER.selectConfigData("STANDARD_SELL_PRICE")) ? 0 : Int32.Parse(LDB_MANAGER.selectConfigData("STANDARD_SELL_PRICE")); //2019.10.31 추가 SUITE_SELL_PRICE = string.Empty.Equals(LDB_MANAGER.selectConfigData("SUITE_SELL_PRICE")) ? 0 : Int32.Parse(LDB_MANAGER.selectConfigData("SUITE_SELL_PRICE")); //2019.10.31 추가 PRINTER_TYPE = LDB_MANAGER.selectConfigData("PRINTER_TYPE"); PRINTER_OPOS_TYPE = LDB_MANAGER.selectConfigData("PRINTER_OPOS_TYPE"); SLIP_TYPE = LDB_MANAGER.selectConfigData("SLIP_TYPE"); //SYSTEM_LANGUAGE = CONF_MANAGER.getAppValue("DEFAULT_LANG"); //터미널 기본언어 세팅 IS_DEV = "Y".Equals(CONF_MANAGER.getAppValue("DEV")); //개발여부 SERVER_URL = CONF_MANAGER.getAppValue("SERVER_URL"); SERVER_IP = CONF_MANAGER.getAppValue("SERVER_IP"); SERVER_PORT = CONF_MANAGER.getAppValue("SERVER_PORT"); //국가별 화면 디스크립트 load CONF_MANAGER.loadCustomConfig("ScreenText", PATH_CONFIG + "ScreenText.xml"); //국가별Message load CONF_MANAGER.loadCustomConfig("Message", PATH_CONFIG + "Message.xml"); filePath_QR = Directory.GetCurrentDirectory() + "/../Image/gtf_qr.bmp"; filePath_LOGO = Directory.GetCurrentDirectory() + "/../Image/gtf_logo.bmp"; filePath_ROUND_LOGO = Directory.GetCurrentDirectory() + "/../Image/gtf_logo_round.bmp"; filePath_ROUND_LOGO_NORMAL = Directory.GetCurrentDirectory() + "/../Image/gtf_logo_round_normal.bmp"; filePath_Combine = Directory.GetCurrentDirectory() + "/../Image/combine_QR.jpg"; filePath_Sign = Directory.GetCurrentDirectory() + "/../Image/signprint.jpg"; Boolean bInit = false; //환급율 조회 try { Transaction tran = new Transaction(); JObject obj = new JObject(); obj.Add("tax_type_code", "1"); JArray rateArr = tran.sendServer_arr(obj.ToString(), tran.url_RefundRate, 60, false); if (rateArr != null && rateArr.Count > 0) { ARR_RATE_INFO = rateArr; bInit = true; } else { bInit = false; } } catch (Exception ee) { bInit = false; } finally { if (!bInit) { MessageBox.Show(cParent, "\n초기 기동에 실패하였습니다. \n계속해서 동일한 현상이 발생하면 네트워크 상태를 확인해보시기 바랍니다.", "Config", MessageBoxButtons.OK, MessageBoxIcon.Warning); Application.ExitThread(); Environment.Exit(0); } } } catch (Exception ex) { MessageBox.Show(cParent, "\n초기 기동에 실패하였습니다. \n계속해서 동일한 현상이 발생하면 네트워크 상태를 확인해보시기 바랍니다.", "Config", MessageBoxButtons.OK, MessageBoxIcon.Warning); System.Diagnostics.Debug.WriteLine("에러 : " + ex); Application.ExitThread(); Environment.Exit(0); return; } }
public Constants(Control cParent) { try { CLOSING_YN = false; LOGIN_YN = false; CODE_DOWNLOAD = false; string appPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath); PATH_ROOT = appPath + PATH_ROOT; PATH_CONFIG = PATH_ROOT + PATH_CONFIG; PATH_DB = PATH_ROOT + PATH_DB; ////로컬 DB 폴더 if (!System.IO.Directory.Exists(PATH_DB)) { System.IO.Directory.CreateDirectory(PATH_DB); } //TEMP 폴더 PATH_TEMP = PATH_ROOT + PATH_TEMP; if (!System.IO.Directory.Exists(PATH_TEMP)) { System.IO.Directory.CreateDirectory(PATH_TEMP); } PATH_CONFIG_FILE = PATH_CONFIG + PATH_CONFIG_FILE; PATH_DB_FILE = PATH_DB + PATH_DB_FILE; //PATH_SQLITE_FILE = PATH_DB + PATH_SQLITE_FILE; LOGGER_DOC = log4net.LogManager.GetLogger("DOC"); LOGGER_SCREEN = log4net.LogManager.GetLogger("SCREEN"); LOGGER_MAIN = log4net.LogManager.GetLogger("MAIN"); log4net.Config.BasicConfigurator.Configure(); CONF_MANAGER = GTF_ConfigManager.Instance(LOGGER_MAIN); //Boolean AccessExists = true; //string Migration_Flag = string.Empty; if (!CONF_MANAGER.loadAppConfig(PATH_CONFIG_FILE)) { MessageBox.Show(cParent, "初期化エラーです。プログラムを再起動してください。", "Config", MessageBoxButtons.OK, MessageBoxIcon.Warning); Application.ExitThread(); Environment.Exit(0); return; } LDB_MANAGER = GTF_LocalDBManager.Instance(LOGGER_MAIN); if (!LDB_MANAGER.dbOpen(PATH_DB_FILE)) { //AccessExists = false; MessageBox.Show(cParent, "初期化エラーです。プログラムを再起動してください。", "Config", MessageBoxButtons.OK, MessageBoxIcon.Warning); Application.ExitThread(); Environment.Exit(0); return; } //1.SQLite DB 파일이 존재하는지 체크한다. /******************************************************************************************************* * SQLITE_MANAGER = GTF_SQLiteDBManager.Instance(LOGGER_MAIN); * //if (SQLITE_MANAGER.SQLite_Exists(PATH_SQLITE_FILE)) * if (!SQLITE_MANAGER.dbOpen(PATH_SQLITE_FILE)) MessageBox.Show(cParent, "SQLite DBアクセスに失敗しました!", "Config", MessageBoxButtons.OK, MessageBoxIcon.Warning); * * //2. Migration Check 테이블의 플래그를 체크한다. * if (!AccessExists) * { * if (!SQLITE_MANAGER.updateMigration_Flag("Y")) MessageBox.Show(cParent, "Migrationコードの更新に失敗しました!ITチームにお問い合わせください!", "Config", MessageBoxButtons.OK, MessageBoxIcon.Warning); * } * else Migration_Flag = SQLITE_MANAGER.getMigration_Flag(); * if (Migration_Flag.Equals("N")) //Migration 작업을 시작한다. * { * //JArray에 TML_CONFIG 데이터를 가지고 와서 담아온다. * string tablename = string.Empty; * string str_FailedTalbeName = string.Empty; * for (int i = 0; i < 8; i++) * { * switch (i) * { * case 0: tablename = "TML_CONFIG"; break; * case 1: tablename = "ID_CREATION_RULE"; break; * case 2: tablename = "BIN"; break; * //case 3: tablename = "CODE"; break; * //case 4: tablename = "ITEM"; break; * //case 5: tablename = "MERCHANT"; break; * case 3: tablename = "REFUNDSLIP"; break; * case 4: tablename = "SALES_GOODS"; break; * case 5: tablename = "SLIP_PRINT_DOCS"; break; * case 6: tablename = "TAXOFFICE"; break; * case 7: tablename = "USERINFO"; break; * } * if (tablename.Length > 1) * { * JArray arrTemp = LDB_MANAGER.get_data_AccessDB(tablename); * * if (!(SQLITE_MANAGER.data_Migration(arrTemp, tablename))) str_FailedTalbeName = tablename; * //MessageBox.Show(cParent, tablename + " コピーに失敗しました!", "Config", MessageBoxButtons.OK, MessageBoxIcon.Warning); * * } * } * if (!SQLITE_MANAGER.updateMigration_Flag("Y")) MessageBox.Show(cParent, "Migrationに失敗しました!ITチームにお問い合わせください!", "Config", MessageBoxButtons.OK, MessageBoxIcon.Warning); * else MessageBox.Show(cParent, "Migration 成功!!", "Config", MessageBoxButtons.OK, MessageBoxIcon.Warning); * } *****************************************************************************************************************************************/ TML_ID = LDB_MANAGER.selectConfigData("TML_ID"); PASSPORT_TYPE = string.Empty.Equals(LDB_MANAGER.selectConfigData("PASSPORT_TYPE")) ? -1 : Int32.Parse(LDB_MANAGER.selectConfigData("PASSPORT_TYPE")); PRINTER_TYPE = LDB_MANAGER.selectConfigData("PRINTER_TYPE"); PRINTER_OPOS_TYPE = LDB_MANAGER.selectConfigData("PRINTER_OPOS_TYPE"); SLIP_TYPE = LDB_MANAGER.selectConfigData("SLIP_TYPE"); SYSTEM_LANGUAGE = CONF_MANAGER.getAppValue("DEFAULT_LANG"); //터미널 기본언어 세팅 IS_DEV = "Y".Equals(CONF_MANAGER.getAppValue("DEV")); //개발여부 SERVER_URL = CONF_MANAGER.getAppValue("SERVER_URL"); SERVER_IP = CONF_MANAGER.getAppValue("SERVER_IP"); SERVER_PORT = CONF_MANAGER.getAppValue("SERVER_PORT"); SIGNPAD_USE = LDB_MANAGER.selectConfigData("SIGNPAD_USE"); RCT_ADD = LDB_MANAGER.selectConfigData("RCT_ADD"); PRINT_TYPE = LDB_MANAGER.selectConfigData("PRINT_TYPE"); TAX_TYPE = LDB_MANAGER.selectConfigData("TAX_TYPE"); //국가별 화면 디스크립트 load CONF_MANAGER.loadCustomConfig("ScreenText", PATH_CONFIG + "ScreenText.xml"); //국가별Message load CONF_MANAGER.loadCustomConfig("Message", PATH_CONFIG + "Message.xml"); Boolean taxCalTypeColumn = Constants.LDB_MANAGER.ExitsTableColumn("SALES_GOODS", "TAX_CAL_TYPE"); if (!taxCalTypeColumn) { Constants.LDB_MANAGER.alterTable("SALES_GOODS", "TAX_CAL_TYPE"); } if (!string.Empty.Equals(LDB_MANAGER.selectConfigData("PRINT_SETTING"))) { PRINT_SETTING = LDB_MANAGER.selectConfigData("PRINT_SETTING"); } else { PRINT_SETTING = "0"; // PRINT_ALL :: 0 EXCEPT_DIGITIZE :: 1 } } catch (Exception ex) { MessageBox.Show(cParent, "初期化エラーです。プログラムを再起動してください。\n" + ex.Message, "Config", MessageBoxButtons.OK, MessageBoxIcon.Warning); Application.ExitThread(); Environment.Exit(0); return; } }