From 1927124473f0f6ad9d8dca685f232f19cbb56f18 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Wed, 14 May 2025 10:09:17 +0200 Subject: [PATCH] =?UTF-8?q?unn=C3=B6tiges=20try=20catch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dakota/Logic/DakotaManager.cs | 155 ++++++++++++++++------------------ 1 file changed, 74 insertions(+), 81 deletions(-) diff --git a/Dakota/Logic/DakotaManager.cs b/Dakota/Logic/DakotaManager.cs index fc6917e3e..945ba52d7 100644 --- a/Dakota/Logic/DakotaManager.cs +++ b/Dakota/Logic/DakotaManager.cs @@ -10,110 +10,103 @@ using System.Threading.Tasks; namespace Dakota.Logic { - public class DakotaManager - { - public int Month { get; set; } - public int Version { get; set; } + public class DakotaManager + { + public int Month { get; set; } + public int Version { get; set; } - public DakotaInfoCreator DakotaInfoCreator { get; set; } - public bool IsSammelrechnung { get; set; } + public DakotaInfoCreator DakotaInfoCreator { get; set; } + public bool IsSammelrechnung { get; set; } - public Dictionary DakotaFileDict { get; set; } + public Dictionary DakotaFileDict { get; set; } - public Dictionary DakotaInfoNutzDict { get; set; } - public Dictionary DakotaInfoAufDict { get; set; } + public Dictionary DakotaInfoNutzDict { get; set; } + public Dictionary DakotaInfoAufDict { get; set; } - public DakotaManager() : this(DateTime.Now.Month, DateTime.Now) - { + public DakotaManager() : this(DateTime.Now.Month, DateTime.Now) + { - } - public DakotaManager(int month, DateTime dateTime, bool isSammelrechnung = false) - { - Month = month; - Version = GetVersion(dateTime); + } + public DakotaManager(int month, DateTime dateTime, bool isSammelrechnung = false) + { + Month = month; + Version = GetVersion(dateTime); - DakotaFileDict = new Dictionary(); + DakotaFileDict = new Dictionary(); - DakotaInfoNutzDict = new Dictionary(); - DakotaInfoAufDict = new Dictionary(); + DakotaInfoNutzDict = new Dictionary(); + DakotaInfoAufDict = new Dictionary(); - DakotaInfoCreator = new DakotaInfoCreator(isSammelrechnung); - IsSammelrechnung = isSammelrechnung; - } + DakotaInfoCreator = new DakotaInfoCreator(isSammelrechnung); + IsSammelrechnung = isSammelrechnung; + } - public void Add(ServiceInvoiceDC serviceInvoice, OrganisationDC organisation, CustomerDC customer, AddressInformation address, int datenaustauschreferenz, int transfernummer) - { - try - { - var ik_datenannahmestelle = organisation.IKDatenannahmestelle; - var success = DakotaInfoNutzDict.TryGetValue(ik_datenannahmestelle, out InfoDateiNutzdaten nutzdaten); + public void Add(ServiceInvoiceDC serviceInvoice, OrganisationDC organisation, CustomerDC customer, AddressInformation address, int datenaustauschreferenz, int transfernummer) + { + var ik_datenannahmestelle = organisation.IKDatenannahmestelle; + var success = DakotaInfoNutzDict.TryGetValue(ik_datenannahmestelle, out InfoDateiNutzdaten nutzdaten); - if (!success) - { - var verfahrensstufe = organisation.Verfahrensstufe; + if (!success) + { + var verfahrensstufe = organisation.Verfahrensstufe; - // Verfahrenkennung - // Erste Stelle: - // "E" - Echtdaten - // "T" - Testdaten - // Annahme: "E" auch für Erprobungsverfahrenstufe - // Zusatz: "T" bei Erprobungsverfahrenstufe + // Verfahrenkennung + // Erste Stelle: + // "E" - Echtdaten + // "T" - Testdaten + // Annahme: "E" auch für Erprobungsverfahrenstufe + // Zusatz: "T" bei Erprobungsverfahrenstufe - var isTest = verfahrensstufe == BS.Shared.GkvVerfahrensstufe.Test || verfahrensstufe == BS.Shared.GkvVerfahrensstufe.Erprobung; - var verfahrenkennung = isTest ? "TSOL0" : "ESOL0"; - var logischer_dateiname = DakotaConfig.GetLogischerDateiname(Month).Trim(); + var isTest = verfahrensstufe == BS.Shared.GkvVerfahrensstufe.Test || verfahrensstufe == BS.Shared.GkvVerfahrensstufe.Erprobung; + var verfahrenkennung = isTest ? "TSOL0" : "ESOL0"; + var logischer_dateiname = DakotaConfig.GetLogischerDateiname(Month).Trim(); - var info_nutz_add = DakotaInfoCreator.GetEmptyInfoNutzdatendatei(DakotaConfig.IKAbsender, organisation.IKDatenannahmestelle, (int)verfahrensstufe, logischer_dateiname, datenaustauschreferenz); - var info_auf_add = DakotaInfoCreator.GetEmptyInfoAuftragsdatei(organisation.IKDatenannahmestelle, logischer_dateiname, verfahrenkennung, transfernummer); + var info_nutz_add = DakotaInfoCreator.GetEmptyInfoNutzdatendatei(DakotaConfig.IKAbsender, organisation.IKDatenannahmestelle, (int)verfahrensstufe, logischer_dateiname, datenaustauschreferenz); + var info_auf_add = DakotaInfoCreator.GetEmptyInfoAuftragsdatei(organisation.IKDatenannahmestelle, logischer_dateiname, verfahrenkennung, transfernummer); - DakotaInfoNutzDict.Add(ik_datenannahmestelle, info_nutz_add); - DakotaInfoAufDict.Add(ik_datenannahmestelle, info_auf_add); + DakotaInfoNutzDict.Add(ik_datenannahmestelle, info_nutz_add); + DakotaInfoAufDict.Add(ik_datenannahmestelle, info_auf_add); - nutzdaten = info_nutz_add; - } + nutzdaten = info_nutz_add; + } - foreach (var peroid in serviceInvoice.ServiceInvoicePeriods) - { - foreach (var invoice in peroid.InvoiceItems) - { - var info_nutz_item = new InfoParameterInvoiceItem(serviceInvoice, invoice, organisation, customer, address); + foreach (var peroid in serviceInvoice.ServiceInvoicePeriods) + { + foreach (var invoice in peroid.InvoiceItems) + { + var info_nutz_item = new InfoParameterInvoiceItem(serviceInvoice, invoice, organisation, customer, address); - DakotaInfoCreator.AddInfoParameter(nutzdaten, info_nutz_item, Version); - } - } - } - catch (Exception e) - { - throw e; - } - } + DakotaInfoCreator.AddInfoParameter(nutzdaten, info_nutz_item, Version); + } + } + } - public void Apply() - { - foreach (var ik_datenannahmestelle in DakotaInfoNutzDict.Keys) - { - var file = new DakotaFile(DateTime.Now); + public void Apply() + { + foreach (var ik_datenannahmestelle in DakotaInfoNutzDict.Keys) + { + var file = new DakotaFile(DateTime.Now); - var info_nutz = DakotaInfoNutzDict[ik_datenannahmestelle]; - var info_auf = DakotaInfoAufDict[ik_datenannahmestelle]; + var info_nutz = DakotaInfoNutzDict[ik_datenannahmestelle]; + var info_auf = DakotaInfoAufDict[ik_datenannahmestelle]; - file.Nutzdatendatei.Apply(info_nutz, DakotaInfoCreator.IsSammelrechnung); - file.Auftragsdatei.Apply(info_auf); + file.Nutzdatendatei.Apply(info_nutz, DakotaInfoCreator.IsSammelrechnung); + file.Auftragsdatei.Apply(info_auf); - DakotaFileDict.Add(ik_datenannahmestelle, file); - } - } + DakotaFileDict.Add(ik_datenannahmestelle, file); + } + } - private int GetVersion(DateTime create4month) - { - if (create4month < new DateTime(2023, 7, 1)) - throw new NotImplementedException("Keine Unterstützung von Version 17 oder niedriger"); + private int GetVersion(DateTime create4month) + { + if (create4month < new DateTime(2023, 7, 1)) + throw new NotImplementedException("Keine Unterstützung von Version 17 oder niedriger"); - if (create4month < new DateTime(2024, 1, 1)) - return 18; + if (create4month < new DateTime(2024, 1, 1)) + return 18; - if (create4month < new DateTime(2024, 7, 1)) - return 19; + if (create4month < new DateTime(2024, 7, 1)) + return 19; if (create4month < new DateTime(2026, 1, 1)) return 20; @@ -123,5 +116,5 @@ namespace Dakota.Logic throw new NotImplementedException("Keine Unterstützung von Version 22 oder aufwärts"); } - } + } }