DB Interaktion von DC weg. Tooptip zu VM, bool Flag zu entity

This commit is contained in:
2025-01-29 15:48:49 +01:00
parent 742e21e69a
commit 369b7d9b05
4 changed files with 34 additions and 26 deletions

View File

@@ -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;

View File

@@ -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<GkvTransferProtokoll>() == 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
{

View File

@@ -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<GkvTransferProtokoll>();
return row_count == 0;
}
catch (Exception)
{
}
return true;
}
}
}

View File

@@ -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; }