From 369b7d9b053d1606856afb07c8181e562de207ec Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Wed, 29 Jan 2025 15:48:49 +0100 Subject: [PATCH] DB Interaktion von DC weg. Tooptip zu VM, bool Flag zu entity --- BeWo/ViewModel/MandatorVM.cs | 15 +++++++++-- Data/Entities/Mandator.cs | 18 +++++++++++++ Service/DCEntityMapper/MandatorDC_Mandator.cs | 26 +++---------------- Shared/DataContracts/MandatorDC.cs | 1 - 4 files changed, 34 insertions(+), 26 deletions(-) diff --git a/BeWo/ViewModel/MandatorVM.cs b/BeWo/ViewModel/MandatorVM.cs index 8c96e8997..a26afe292 100644 --- a/BeWo/ViewModel/MandatorVM.cs +++ b/BeWo/ViewModel/MandatorVM.cs @@ -675,8 +675,6 @@ namespace BeWo.ViewModel _BankName = pDataContract.BankAccount.BankName; _Bic = pDataContract.BankAccount.Bic; _IBAN = pDataContract.BankAccount.IBAN; - CanEditIKLeistungserbringer = pDataContract.CanEditIKLeistungserbringer; - CanEditIKLeistungserbringerTooltip = pDataContract.CanEditIKLeistungserbringerTooltip; _SoziotherapieAnsprechpartner = pDataContract.SoziotherapieAnsprechpartner; _ColorWaitTooLong = ColorExtensions.ParseSolidColorBrush(pDataContract.ColorWaitTooLong); _ColorWaitTooLongStr = pDataContract.ColorWaitTooLong; @@ -688,6 +686,19 @@ namespace BeWo.ViewModel if(pDataContract.Logo is object) Logo = new ImageVM(pDataContract.Logo); + if (pDataContract.CanEditIKLeistungserbringer) + { + CanEditIKLeistungserbringer = true; + CanEditIKLeistungserbringerTooltip = null; + } + else + { + CanEditIKLeistungserbringer = false; + CanEditIKLeistungserbringerTooltip = "Mit dem Senden mind. einer GKV Abrechnung haben Sie sich bereits\n" + + "mit dieser IK bei uns registiert. Bei Änderungswunsch wenden Sie\n" + + "sich bitte an unseren Support."; + } + if (_Settings == null) { _TimeUntilUILock = 30; diff --git a/Data/Entities/Mandator.cs b/Data/Entities/Mandator.cs index 136be2dca..0e89ed093 100644 --- a/Data/Entities/Mandator.cs +++ b/Data/Entities/Mandator.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using BeWo.Data.Access; using BS.Shared; namespace BeWo.Data.Entities @@ -44,6 +45,22 @@ namespace BeWo.Data.Entities public Mandator() { this._Tid = TableID.Mandator; + + LoadCanEditIKLeistungserbringer(); + } + + public void LoadCanEditIKLeistungserbringer() + { + try + { + var can_edit = DAOFactory.GenericDAO.GetRowCount() == 0; + + CanEditIKLeistungserbringer = can_edit; + } + catch(Exception e) + { + + } } public virtual BankAccount BankAccount { get; set; } @@ -53,6 +70,7 @@ namespace BeWo.Data.Entities public virtual string ColorSendUrbelege { get; set; } public virtual bool? ShowGkvBzEinzel { get; set; } public virtual bool? ShowGkvBzUrbelege { get; set; } + public virtual bool CanEditIKLeistungserbringer { get; set; } public virtual long BeWoClientType { diff --git a/Service/DCEntityMapper/MandatorDC_Mandator.cs b/Service/DCEntityMapper/MandatorDC_Mandator.cs index b01eedfee..6c9bd595e 100644 --- a/Service/DCEntityMapper/MandatorDC_Mandator.cs +++ b/Service/DCEntityMapper/MandatorDC_Mandator.cs @@ -41,13 +41,8 @@ namespace BeWo.Service.DCEntityMapper #endif to.Apikey = from.Apikey; to.IKLeistungserbringer = from.IKLeistungserbringer; - var can_edit = GetCanEditIKLeistungserbringer(); - - to.CanEditIKLeistungserbringer = can_edit; - to.CanEditIKLeistungserbringerTooltip = can_edit ? null : - "Mit dem Senden mind. einer GKV Abrechnung haben Sie sich bereits\n" + - "mit dieser IK bei uns registiert. Bei Änderungswunsch wenden Sie\n" + - "sich bitte an unseren Support."; + + to.CanEditIKLeistungserbringer = from.CanEditIKLeistungserbringer; if (from.SoziotherapieAnsprechpartner is object) to.SoziotherapieAnsprechpartner = MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(from.SoziotherapieAnsprechpartner); @@ -78,6 +73,7 @@ namespace BeWo.Service.DCEntityMapper to.Apikey = from.Apikey; to.IKLeistungserbringer = from.IKLeistungserbringer.ToNullIfEmpty(); + // HACK: BankAccount ist neu, alte Clients: from.BankAccount null if (from.BankAccount is object) { to.BankAccount = MapperFactory.BankAccountDC_BankAccount.MergeWithEntity(from.BankAccount, to.BankAccount, false); @@ -102,21 +98,5 @@ namespace BeWo.Service.DCEntityMapper return pDC.MandatorOid == pEntity.Oid; } - - private bool GetCanEditIKLeistungserbringer() - { - try - { - var row_count = DAOFactory.GenericDAO.GetRowCount(); - - return row_count == 0; - } - catch (Exception) - { - - } - - return true; - } } } \ No newline at end of file diff --git a/Shared/DataContracts/MandatorDC.cs b/Shared/DataContracts/MandatorDC.cs index e914be9ba..1bdd3815e 100644 --- a/Shared/DataContracts/MandatorDC.cs +++ b/Shared/DataContracts/MandatorDC.cs @@ -29,7 +29,6 @@ namespace BS.Shared.DataContracts [DataMember] public string Apikey { get; set; } [DataMember] public string IKLeistungserbringer { get; set; } [DataMember] public bool CanEditIKLeistungserbringer { get; set; } - [DataMember] public string CanEditIKLeistungserbringerTooltip { get; set; } [DataMember] public CompactEmployeeDC SoziotherapieAnsprechpartner { get; set; } [DataMember] public ImageDC Logo { get; set; } [DataMember] public string ColorWaitTooLong { get; set; }