diff --git a/DakotaSender/App.config b/DakotaSender/App.config index e1c540102..a45c0d022 100644 --- a/DakotaSender/App.config +++ b/DakotaSender/App.config @@ -4,9 +4,14 @@ - - - + + + + + + + + diff --git a/DakotaSender/Config.cs b/DakotaSender/Config.cs index 5ffea00a1..9fd6fa3a3 100644 --- a/DakotaSender/Config.cs +++ b/DakotaSender/Config.cs @@ -10,22 +10,44 @@ namespace DakotaSender { internal static class Config { - public static string GkvSecretKey { get; set; } = ConfigurationManager.AppSettings.Get("GkvSecretKey"); + public static DirectoryInfo ResultFolder { get; } + = new DirectoryInfo(ConfigurationManager.AppSettings.Get("GkvAbrechnungResultFolderPath") ?? @"C:\GkvAbrechnung\Results\"); + + public static DirectoryInfo QueueFolder { get; } + = new DirectoryInfo(ConfigurationManager.AppSettings.Get("GkvAbrechnungQueueFolderPath") ?? @"C:\GkvAbrechnung\Data\Queue\"); + + public static DirectoryInfo CopyFolder { get; } + = new DirectoryInfo(ConfigurationManager.AppSettings.Get("GkvAbrechnungCopyFolderPath") ?? @"C:\GkvAbrechnung\Data\Copy\"); + + public static DirectoryInfo FailedFolder { get; } + = new DirectoryInfo(ConfigurationManager.AppSettings.Get("GkvAbrechnungFailedFolderPath") ?? @"C:\GkvAbrechnung\Data\Failed\"); + + public static DirectoryInfo SuccessFolder { get; } + = new DirectoryInfo(ConfigurationManager.AppSettings.Get("GkvAbrechnungSuccessFolderPath") ?? @"C:\GkvAbrechnung\Data\Success\"); + + public static bool CopySave { get; } + = bool.Parse(ConfigurationManager.AppSettings.Get("GkvAbrechnungCopySave") ?? bool.TrueString); + + public static bool FailedSave { get; } + = bool.Parse(ConfigurationManager.AppSettings.Get("GkvAbrechnungFailedSave") ?? bool.TrueString); + + public static bool SuccessSave { get; } + = bool.Parse(ConfigurationManager.AppSettings.Get("GkvAbrechnungSuccessSave") ?? bool.TrueString); + + public static FileInfo DakotaExe { get; } + = new FileInfo(ConfigurationManager.AppSettings.Get("DakotaExePath") ?? @"C:\Program Files (x86)\ITSG\dakotale\dakota30.exe"); + + public static DirectoryInfo DakotaFolder { get; } + = new DirectoryInfo(ConfigurationManager.AppSettings.Get("DakotaFolder") ?? @"C:\dakotale\"); + + public static int ProcessWaitForExitMs { get; } + = int.Parse(ConfigurationManager.AppSettings.Get("ProcessWaitForExitMs") ?? "10000"); public static string LogPath { get; } = ConfigurationManager.AppSettings.Get("LogPath") ?? @"C:\GkvAbrechnung\Sender\log.txt"; - public static int ProcessWaitForExitMs { get; } - = int.Parse(ConfigurationManager.AppSettings.Get("ProcessWaitForExitMs") ?? "10000"); - public static FileInfo DakotaExe { get; } - = new FileInfo(ConfigurationManager.AppSettings.Get("DakotaExePath") ?? @"C:\Program Files (x86)\ITSG\dakotale\dakota30.exe"); - public static DirectoryInfo DakotaFolder { get; } - = new DirectoryInfo(ConfigurationManager.AppSettings.Get("DakotaFolder") ?? @"C:\dakotale\"); - public static DirectoryInfo QueueFolder { get; } - = new DirectoryInfo(ConfigurationManager.AppSettings.Get("GkvAbrechnungQueueFolderPath") ?? @"C:\GkvAbrechnung\Queue\"); - public static DirectoryInfo ResultFolder { get; } - = new DirectoryInfo(ConfigurationManager.AppSettings.Get("GkvAbrechnungResultFolderPath") ?? @"C:\GkvAbrechnung\Results\"); - public static DirectoryInfo FailedFolder { get; } - = new DirectoryInfo(ConfigurationManager.AppSettings.Get("GkvAbrechnungFailedFolderPath") ?? @"C:\GkvAbrechnung\Failed\"); + + public static string GkvSecretKey { get; set; } = ConfigurationManager.AppSettings.Get("GkvSecretKey"); + public static bool IsDatenannahmestelleValid(string datenannahmestelle) { diff --git a/DakotaSender/FileController.cs b/DakotaSender/FileController.cs index cff8b00a1..319d5cab2 100644 --- a/DakotaSender/FileController.cs +++ b/DakotaSender/FileController.cs @@ -10,13 +10,36 @@ namespace DakotaSender { internal static class FileController { + internal static void CopyFileToCopy(DakotaSystemFile file) + { + if (!Config.CopySave) + return; + + var folder = Config.CopyFolder; + + CopyFileTo(file.SourceAuftragsdatei, folder.FullName); + CopyFileTo(file.SourceNutzdatendatei, folder.FullName); + } internal static void CopyFileToFailed(DakotaSystemFile file) { + if (!Config.FailedSave) + return; + var failed_folder = Config.FailedFolder; CopyFileTo(file.SourceAuftragsdatei, failed_folder.FullName); CopyFileTo(file.SourceNutzdatendatei, failed_folder.FullName); } + internal static void CopyFileToSuccesss(DakotaSystemFile file) + { + if (!Config.SuccessSave) + return; + + var success_folder = Config.SuccessFolder; + + CopyFileTo(file.SourceAuftragsdatei, success_folder.FullName); + CopyFileTo(file.SourceNutzdatendatei, success_folder.FullName); + } internal static void CopyFileToDestination(DakotaSystemFile file) { var folder = Config.LoadDatenannahmestelleFolder(file.Datenannahmestelle); diff --git a/DakotaSender/Program.cs b/DakotaSender/Program.cs index d3c4f40e9..9978933ef 100644 --- a/DakotaSender/Program.cs +++ b/DakotaSender/Program.cs @@ -263,6 +263,10 @@ namespace DakotaSender PrintLine(msg); Add2Results(file, GkvTransferResultType.Success); + + FileController.CopyFileToCopy(file); + + FileController.CopyFileToSuccesss(file); } else { @@ -272,6 +276,8 @@ namespace DakotaSender Add2Results(file, GkvTransferResultType.FailSoft, msg, "DS:Fehler"); + FileController.CopyFileToCopy(file); + FileController.CopyFileToFailed(file); } } diff --git a/Host/Web.config b/Host/Web.config index 1e8c1bf05..5f53a6506 100644 --- a/Host/Web.config +++ b/Host/Web.config @@ -237,7 +237,7 @@ - +