diff --git a/Dakota/Models/Daten/Datenelement.cs b/Dakota/Models/Daten/Datenelement.cs index 2ec640609..cc493c670 100644 --- a/Dakota/Models/Daten/Datenelement.cs +++ b/Dakota/Models/Daten/Datenelement.cs @@ -4,103 +4,112 @@ using System; namespace Dakota.Models.Daten { - internal class Datenelement : Dateneinheit - { - private protected string _Value; - private protected bool _IgnoreCheck; + internal class Datenelement : Dateneinheit + { + private protected string _Value; + private protected bool _IgnoreCheck; - public int MinStellen { get; set; } - public int MaxStellen { get; set; } - public Feldart Feldart { get; set; } + public int MinStellen { get; set; } + public int MaxStellen { get; set; } + public Feldart Feldart { get; set; } - public Datenelement(string title) - { - Title = title; + public Datenelement(string title) + { + Title = title; - _IgnoreCheck = false; - } - public Datenelement(string title, int min, int max, Feldart art) : this(title) - { - MinStellen = min; - MaxStellen = max; - Feldart = art; - } - public Datenelement(string title, int count, Feldart art) : this(title, count, count, art) - { + _IgnoreCheck = false; + } + public Datenelement(string title, int min, int max, Feldart art) : this(title) + { + MinStellen = min; + MaxStellen = max; + Feldart = art; + } + public Datenelement(string title, int count, Feldart art) : this(title, count, count, art) + { - } + } - public override string GetValue() - { - if (!HasValue()) - { - if (Feldart == Feldart.Muss) - { - // Auffüllen - throw new GkvException($"Das Feld \"{Title}\" muss gefüllt sein!"); - } - else - { - // Leer lassen + public override string GetValue() + { + if (!HasValue()) + { + if (Feldart == Feldart.Muss) + { + // Auffüllen + throw new GkvException($"Das Feld \"{Title}\" muss gefüllt sein!"); + } + else + { + // Leer lassen - return string.Empty; - } - } + return string.Empty; + } + } - if (!_IgnoreCheck) - { - if(_Value.Length < MinStellen) - { - throw new GkvException($"Das Feld \"{Title}\" hat bei der Auswertung {_Value.Length} Stellen ergeben! Nach Vorgabe muss es jedoch mindestens {MinStellen} Stellen haben"); - } - else if (_Value.Length > MaxStellen) - { - throw new GkvException($"Das Feld \"{Title}\" hat bei der Auswertung {_Value.Length} Stellen ergeben! Nach Vorgabe darf es jedoch maximal {MaxStellen} Stellen haben"); - } - } + if (!_IgnoreCheck) + { + if (_Value.Length < MinStellen) + { + throw new GkvException($"Das Feld \"{Title}\" hat bei der Auswertung {_Value.Length} Stellen ergeben! Nach Vorgabe muss es jedoch mindestens {MinStellen} Stellen haben"); + } + else if (_Value.Length > MaxStellen) + { + throw new GkvException($"Das Feld \"{Title}\" hat bei der Auswertung {_Value.Length} Stellen ergeben! Nach Vorgabe darf es jedoch maximal {MaxStellen} Stellen haben"); + } + } - return _Value; - } + return _Value; + } - public void ClearValue() - { - _Value = null; - } - public override bool HasValue() - { - return !string.IsNullOrEmpty(_Value); - } - public void SetValue(int value) - { - if (Feldart == Feldart.Kann && value == 0) - return; + public void ClearValue() + { + _Value = null; + } + public override bool HasValue() + { + return !string.IsNullOrEmpty(_Value); + } + public void SetValue(int value) + { + if (Feldart == Feldart.Kann && value == 0) + return; - SetValue(value.ToString()); - } - public void SetValue(Schlüssel schlussel) - { - if (schlussel is null) - return; - SetValue(schlussel.Value); - } - public void SetValue(string value) - { - if (value is null) - return; + SetValue(value.ToString()); + } + public void SetValue(Schlüssel schlussel) + { + if (schlussel is null) + return; + SetValue(schlussel.Value); + } + public void SetValue(string value) + { + try + { + if (value is null) + return; - if (value.Length < MinStellen) - { - throw new GkvException($"Das Feld \"{Title}\" hat bei der Erstellung {_Value.Length} Stellen ergeben! Nach Vorgabe muss es jedoch mindestens {MinStellen} Stellen haben"); - } + if (value.Length < MinStellen) + { + throw new GkvException($"Das Feld \"{Title}\" hat bei der Erstellung {_Value.Length} Stellen ergeben! Nach Vorgabe muss es jedoch mindestens {MinStellen} Stellen haben"); + } - if (value.Length > MaxStellen) - { - throw new GkvException($"Das Feld \"{Title}\" hat bei der Erstellung {_Value.Length} Stellen ergeben! Nach Vorgabe darf es jedoch maximal {MaxStellen} Stellen haben"); - } + if (value.Length > MaxStellen) + { + throw new GkvException($"Das Feld \"{Title}\" hat bei der Erstellung {_Value.Length} Stellen ergeben! Nach Vorgabe darf es jedoch maximal {MaxStellen} Stellen haben"); + } - var mod_value = DakotaUtils.ClearTextString(value); + var mod_value = DakotaUtils.ClearTextString(value); - _Value = mod_value; - } - } + _Value = mod_value; + } + catch (Exception e) + { + var msg = e.ToString(); + + throw new GkvException(msg, $"Fehler bei Feld {Title}"); + } + } + } } diff --git a/ReportImp/SeverinReports/SettlementReport2.cs b/ReportImp/SeverinReports/SettlementReport2.cs index f9f00ac6a..ede0f9609 100644 --- a/ReportImp/SeverinReports/SettlementReport2.cs +++ b/ReportImp/SeverinReports/SettlementReport2.cs @@ -46,10 +46,11 @@ namespace SeverinReports } pRO.RateFactor = (double)rateFactor; - if (!(pRO.Claim > 0)) + if (pRO.Claim < 0) { + pRO.FinalSentence = "Bitte verrechnen Sie die geleistete Überzahlung mit der nächsten AVIS."; lblBankverbindung.Visible = false; - } + } this.bindingSource1.DataSource = pRO; } diff --git a/Service/DCEntityMapper/MandatorDC_Mandator.cs b/Service/DCEntityMapper/MandatorDC_Mandator.cs index 57ccc0d15..b01eedfee 100644 --- a/Service/DCEntityMapper/MandatorDC_Mandator.cs +++ b/Service/DCEntityMapper/MandatorDC_Mandator.cs @@ -78,14 +78,17 @@ namespace BeWo.Service.DCEntityMapper to.Apikey = from.Apikey; to.IKLeistungserbringer = from.IKLeistungserbringer.ToNullIfEmpty(); - to.BankAccount = MapperFactory.BankAccountDC_BankAccount.MergeWithEntity(from.BankAccount, to.BankAccount, false); - to.SoziotherapieAnsprechpartner = MapperFactory.CompactEmployeeDC_Employee.MergeWithEntity(from.SoziotherapieAnsprechpartner, to.SoziotherapieAnsprechpartner, false); - to.Logo = MapperFactory.ImageDC_Image.MergeWithEntity(from.Logo, to.Logo, false); + if (from.BankAccount is object) + { + to.BankAccount = MapperFactory.BankAccountDC_BankAccount.MergeWithEntity(from.BankAccount, to.BankAccount, false); + to.SoziotherapieAnsprechpartner = MapperFactory.CompactEmployeeDC_Employee.MergeWithEntity(from.SoziotherapieAnsprechpartner, to.SoziotherapieAnsprechpartner, false); + to.Logo = MapperFactory.ImageDC_Image.MergeWithEntity(from.Logo, to.Logo, false); - to.ShowGkvBzEinzel = from.ShowGkvBzEinzel; - to.ShowGkvBzUrbelege = from.ShowGkvBzUrbelege; - to.ColorSendUrbelege = from.ColorSendUrbelege; - to.ColorWaitTooLong = from.ColorWaitTooLong; + to.ShowGkvBzEinzel = from.ShowGkvBzEinzel; + to.ShowGkvBzUrbelege = from.ShowGkvBzUrbelege; + to.ColorSendUrbelege = from.ColorSendUrbelege; + to.ColorWaitTooLong = from.ColorWaitTooLong; + } return to; }