public DmsBiz() { /* * // to get the location the assembly is executing from * // (not necessarily where the it normally resides on disk) * // in the case of the using shadow copies, for instance in NUnit tests, * // this will be in a temp directory. * string path = System.Reflection.Assembly.GetExecutingAssembly().Location * //To get the location the assembly normally resides on disk or the install directory * string path = System.Reflection.Assembly.GetExecutingAssembly().CodeBase; */ string iniPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\ini\app.ini"; string encrypPasword = CfgControl.IniReadValue("DESCRYPT", "KEY", iniPath); string DataSource = AESEncrypt.AESDecrypte256(CfgControl.IniReadValue("DATABASE", "DATA_SOURCE", iniPath), encrypPasword); string DataPort = AESEncrypt.AESDecrypte256(CfgControl.IniReadValue("DATABASE", "DATA_PORT", iniPath), encrypPasword); string DefaultDB = AESEncrypt.AESDecrypte256(CfgControl.IniReadValue("DATABASE", "DATABASE", iniPath), encrypPasword); string UserID = AESEncrypt.AESDecrypte256(CfgControl.IniReadValue("DATABASE", "DB_ID", iniPath), encrypPasword); string UserPW = AESEncrypt.AESDecrypte256(CfgControl.IniReadValue("DATABASE", "DB_PW", iniPath), encrypPasword); dbCon = new PostgresqlDBControl("POSTGRESQL", DataSource, UserID, UserPW, DefaultDB, DataPort); }
public void FileRemove() { NpgsqlTransaction tran = biz.dbCon.DBBeginTrans(); try { FileControl fileCtrl = new FileControl(); string isFileDelete = biz.SysConfigValue("FILE", "IS_DEL"); if (isFileDelete != "Y") { return; } string iniPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\ini\app.ini"; string filePath = CfgControl.IniReadValue("PROCESS", "ITF_FILE_FOLDER", iniPath); int fileDelTermDay = Convert.ToInt32(biz.SysConfigValue("FILE", "DEL_TERM")); List <ItfFileInfo> fileList = biz.TermFileList(fileDelTermDay); if (fileList.Count == 0) { return; } foreach (ItfFileInfo file in fileList) { string fileFullPath = Path.Combine(filePath, file.part_no); try { fileCtrl.DeleteFile(fileFullPath, file.file_org_nm); } catch { } biz.UpdateFileStatus(tran, file.file_idx); ActionHistoryModel log = new ActionHistoryModel(); log.action_module = file.action_module; log.action_module_idx = null; log.action_type = eActionType.FileDelete; log.action_target_idx = file.target_idx; biz.UpdateLog(log); } biz.dbCon.DBCommit(tran); } catch (Exception ex) { biz.dbCon.DBRollBack(tran); throw ex; } finally { biz.dbCon.DBDisconnect(); } }