Backend Organisation nun 3 weitere Addressen: Haus, Post und Großkunde im Bezug auf Datenannahmestelle.

This commit is contained in:
2025-05-16 13:38:48 +02:00
parent 27d882888e
commit 41ab5233c8
18 changed files with 1102 additions and 834 deletions

View File

@@ -103,6 +103,7 @@
<Compile Include="Services\IControlFactory.cs" />
<Compile Include="Services\IWindowFactory.cs" />
<Compile Include="Services\IWindowService.cs" />
<Compile Include="ViewModel\AddressVM.cs" />
<Compile Include="ViewModel\AiConfigVM.cs" />
<Compile Include="View\Detail\AI\AiConfigView.xaml.cs">
<DependentUpon>AiConfigView.xaml</DependentUpon>

View File

@@ -84,5 +84,22 @@ namespace BeWo.ViewModel
_DirtyProps.Add(pPropName);
}
}
protected bool SetProperty<T>(ref T field, T value, string propertyName, Func<T> originalValueProvider = null)
{
if (EqualityComparer<T>.Default.Equals(field, value))
return false;
field = value;
if (originalValueProvider != null)
{
bool isDirty = !EqualityComparer<T>.Default.Equals(originalValueProvider(), value);
StoreDirtyInformation(isDirty, propertyName);
}
FirePropertyChanged(propertyName);
return true;
}
}
}

115
BeWo/ViewModel/AddressVM.cs Normal file
View File

@@ -0,0 +1,115 @@
using System;
using BS.Shared.DataContracts;
namespace BeWo.ViewModel
{
public class AddressVM : AbstractDCMapperVM<AddressDC>
{
private string _AddressLine1;
private string _AddressLine2;
private string _Country;
private long? _L_Version;
private decimal? _Latitude;
private decimal? _Longitude;
private string _PostalCode;
private string _State;
private string _Street;
private string _Town;
public AddressVM() : this(new AddressDC()) { }
public AddressVM(AddressDC dc) : base(dc, dc.Oid)
{
}
public string AddressLine1
{
get => _AddressLine1;
set => SetProperty(ref _AddressLine1, value, nameof(AddressLine1), () => DataContract.AddressLine1);
}
public string AddressLine2
{
get => _AddressLine2;
set => SetProperty(ref _AddressLine2, value, nameof(AddressLine2), () => DataContract.AddressLine2);
}
public string Country
{
get => _Country;
set => SetProperty(ref _Country, value, nameof(Country), () => DataContract.Country);
}
public long? L_Version
{
get => _L_Version;
set => SetProperty(ref _L_Version, value, nameof(L_Version), () => DataContract.L_Version);
}
public decimal? Latitude
{
get => _Latitude;
set => SetProperty(ref _Latitude, value, nameof(Latitude), () => DataContract.Latitude);
}
public decimal? Longitude
{
get => _Longitude;
set => SetProperty(ref _Longitude, value, nameof(Longitude), () => DataContract.Longitude);
}
public string PostalCode
{
get => _PostalCode;
set => SetProperty(ref _PostalCode, value, nameof(PostalCode), () => DataContract.PostalCode);
}
public string State
{
get => _State;
set => SetProperty(ref _State, value, nameof(State), () => DataContract.State);
}
public string Street
{
get => _Street;
set => SetProperty(ref _Street, value, nameof(Street), () => DataContract.Street);
}
public string Town
{
get => _Town;
set => SetProperty(ref _Town, value, nameof(Town), () => DataContract.Town);
}
protected override void InitByDataContract(AddressDC pDataContract)
{
_AddressLine1 = pDataContract.AddressLine1;
_AddressLine2 = pDataContract.AddressLine2;
_Country = pDataContract.Country;
_L_Version = pDataContract.L_Version;
_Latitude = pDataContract.Latitude;
_Longitude = pDataContract.Longitude;
_PostalCode = pDataContract.PostalCode;
_State = pDataContract.State;
_Street = pDataContract.Street;
_Town = pDataContract.Town;
}
protected override AddressDC MapToDataContract(AddressDC pDataContract, bool doCommit)
{
pDataContract.AddressLine1 = _AddressLine1;
pDataContract.AddressLine2 = _AddressLine2;
pDataContract.Country = _Country;
pDataContract.L_Version = _L_Version;
pDataContract.Latitude = _Latitude;
pDataContract.Longitude = _Longitude;
pDataContract.PostalCode = _PostalCode;
pDataContract.State = _State;
pDataContract.Street = _Street;
pDataContract.Town = _Town;
return pDataContract;
}
}
}

View File

@@ -96,6 +96,10 @@ namespace BeWo.ViewModel
private GkvVerfahrensstufe? _Verfahrensstufe;
private bool _GkvAusblenden;
private AddressVM _HausanschriftDatenannahmestelle;
private AddressVM _PostfachanschriftDatenannahmestelle;
private AddressVM _GroßkundenanschriftDatenannahmestelle;
public OrganisationVM(OrganisationDC pDataContract, List<ValueListEntryDC> pAllQualifications, List<ValueListEntryDC> pPossibleFunctions, List<ValueListEntryDC> pPossibleRoleInOrganisations)
: base(pDataContract, pDataContract.OrganisationOid == null)
{
@@ -403,10 +407,15 @@ namespace BeWo.ViewModel
return false;
}
return base.IsDirty || this._CostRatePeriods.IsDirty || this._VarFields.IsDirty || (_ArbeitszeitListe != null && _ArbeitszeitListe.IsDirty) || (_Feiertage != null && _Feiertage.IsDirty);
return base.IsDirty
|| this._CostRatePeriods.IsDirty
|| this._VarFields.IsDirty
|| (_ArbeitszeitListe != null && _ArbeitszeitListe.IsDirty)
|| (_Feiertage != null && _Feiertage.IsDirty)
|| (HausanschriftDatenannahmestelle?.IsDirty ?? false)
|| (PostfachanschriftDatenannahmestelle?.IsDirty ?? false)
|| (GroßkundenanschriftDatenannahmestelle?.IsDirty ?? false);
}
}
public bool IsSingleInvoicePerCustomer
@@ -677,8 +686,6 @@ namespace BeWo.ViewModel
}
}
public ValueListEntryDC Function
{
get { return this._Function; }
@@ -836,6 +843,35 @@ namespace BeWo.ViewModel
}
}
public AddressVM HausanschriftDatenannahmestelle
{
get => _HausanschriftDatenannahmestelle;
set
{
_GroßkundenanschriftDatenannahmestelle = value;
FirePropertyChanged(nameof(HausanschriftDatenannahmestelle));
}
}
public AddressVM PostfachanschriftDatenannahmestelle
{
get => _PostfachanschriftDatenannahmestelle;
set
{
PostfachanschriftDatenannahmestelle = value;
FirePropertyChanged(nameof(PostfachanschriftDatenannahmestelle));
}
}
public AddressVM GroßkundenanschriftDatenannahmestelle
{
get => _GroßkundenanschriftDatenannahmestelle;
set
{
_GroßkundenanschriftDatenannahmestelle = value;
FirePropertyChanged(nameof(GroßkundenanschriftDatenannahmestelle));
}
}
protected void CommitContact(string pValue, ContactType pContactType)
{
List<ContactDC> lOldContactDCs;
@@ -875,7 +911,7 @@ namespace BeWo.ViewModel
{
this._VarFields = new VarFieldListVM(pDataContract.VarFields);
if (!this.IsNew)
if (!IsNew)
{
_AccountNumber = pDataContract.AccountNumber;
_BankCode = pDataContract.BankCode;
@@ -950,6 +986,19 @@ namespace BeWo.ViewModel
this._InvoiceAddressPOBox = iContactDC.ContactValue;
}
}
if (pDataContract.HausanschriftDatenannahmestelle is AddressDC dc)
HausanschriftDatenannahmestelle = new AddressVM(dc);
if (pDataContract.PostfachanschriftDatenannahmestelle is AddressDC dc2)
PostfachanschriftDatenannahmestelle = new AddressVM(dc2);
if (pDataContract.GroßkundenanschriftDatenannahmestelle is AddressDC dc3)
GroßkundenanschriftDatenannahmestelle = new AddressVM(dc3);
//HausanschriftDatenannahmestelle = pDataContract.HausanschriftDatenannahmestelle is AddressDC dc
// ? new AddressVM(dc)
// : new AddressVM();
}
VMFactory.CreateOrganisationPersonRelationListVMAsync(
@@ -1025,7 +1074,6 @@ namespace BeWo.ViewModel
CommitContact(_POBox, ContactType.business_POBox);
CommitContact(_InvoiceAddressPOBox, ContactType.private_POBox);
pDataContract.CostRatePeriods = this._CostRatePeriods.CopyToDCList(doCommit);
if (this._VarFields != null)
@@ -1043,6 +1091,15 @@ namespace BeWo.ViewModel
pDataContract.Feiertage = _Feiertage.CopyToDCList(doCommit);
}
if (HausanschriftDatenannahmestelle is object && HausanschriftDatenannahmestelle.IsDirty)
pDataContract.HausanschriftDatenannahmestelle = HausanschriftDatenannahmestelle.CommitToDataContract();
if (PostfachanschriftDatenannahmestelle is object && PostfachanschriftDatenannahmestelle.IsDirty)
pDataContract.PostfachanschriftDatenannahmestelle = PostfachanschriftDatenannahmestelle.CommitToDataContract();
if (GroßkundenanschriftDatenannahmestelle is object && GroßkundenanschriftDatenannahmestelle.IsDirty)
pDataContract.GroßkundenanschriftDatenannahmestelle = GroßkundenanschriftDatenannahmestelle.CommitToDataContract();
return pDataContract;
}
}

View File

@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using BS.Shared;
using BS.Shared;
using BS.Shared.Core;
using System;
namespace BeWo.Data.Entities
{

View File

@@ -51,22 +51,22 @@ namespace BeWo.Data.Entities
public virtual Address PostfachanschriftDatenannahmestelle { get; set; }
public virtual Address GroßkundenanschriftDatenannahmestelle { get; set; }
public virtual Address GetDatenannahmestelleAddress()
{
var addresses = new List<Address>()
{
HausanschriftDatenannahmestelle,
PostfachanschriftDatenannahmestelle,
GroßkundenanschriftDatenannahmestelle
};
//public virtual Address GetDatenannahmestelleAddress()
//{
// var addresses = new List<Address>()
// {
// HausanschriftDatenannahmestelle,
// PostfachanschriftDatenannahmestelle,
// GroßkundenanschriftDatenannahmestelle
// };
foreach (var address in addresses)
{
if (address is Address && !address.IsEmpty())
return address;
}
// foreach (var address in addresses)
// {
// if (address is Address && !address.IsEmpty())
// return address;
// }
return null;
}
// return null;
//}
}
}

View File

@@ -0,0 +1,24 @@
ALTER TABLE `organisation`
ADD COLUMN `HausanschriftAddressOid` BIGINT NULL DEFAULT NULL AFTER `CostBearerOid`,
ADD COLUMN `PostfachanschriftAddressOid` BIGINT NULL DEFAULT NULL AFTER `HausanschriftAddressOid`,
ADD COLUMN `GroßkundenanschriftAddressOid` BIGINT NULL DEFAULT NULL AFTER `PostfachanschriftAddressOid`,
ADD INDEX `FK_ORGANISA_HAUSADD_idx` (`HausanschriftAddressOid` ASC) VISIBLE,
ADD INDEX `FK_ORGANISA_POSTADD_idx` (`PostfachanschriftAddressOid` ASC) VISIBLE,
ADD INDEX `FK_ORGANISA_GROSADD_idx` (`GroßkundenanschriftAddressOid` ASC) VISIBLE;
;
ALTER TABLE `organisation`
ADD CONSTRAINT `FK_ORGANISA_HAUSADD`
FOREIGN KEY (`HausanschriftAddressOid`)
REFERENCES `address` (`Oid`)
ON DELETE CASCADE
ON UPDATE CASCADE,
ADD CONSTRAINT `FK_ORGANISA_POSTADD`
FOREIGN KEY (`PostfachanschriftAddressOid`)
REFERENCES `address` (`Oid`)
ON DELETE CASCADE
ON UPDATE CASCADE,
ADD CONSTRAINT `FK_ORGANISA_GROSADD`
FOREIGN KEY (`GroßkundenanschriftAddressOid`)
REFERENCES `address` (`Oid`)
ON DELETE CASCADE
ON UPDATE CASCADE;

View File

@@ -12,7 +12,7 @@ using BS.Shared.Extensions;
namespace BeWo.Service.DCEntityMapper
{
public abstract class AbstractIDCEntityMapper<TEntity, TDC> : IDCEntityMapper<TEntity, TDC>, IJsonMapper<TEntity, TDC>
where TDC : new() where TEntity : BeWoEntityBase, new()
where TDC : class, new() where TEntity : BeWoEntityBase, new()
{
public bool ConcurrencyCheck(long? pDataContractVersion, BeWoEntityBase pEntity)
{
@@ -31,9 +31,20 @@ namespace BeWo.Service.DCEntityMapper
}
return lResult;
}
public virtual TDC MapToNewDC(TEntity pEntity, bool ignoreNullEntity)
public virtual TDC CreateOrMapToNewDC(TEntity pEntity, bool nullDCOnNullEntity = false)
{
if (ignoreNullEntity || pEntity is object)
if (pEntity is object)
return MapToNewDC(pEntity);
if (nullDCOnNullEntity)
return null;
return CreateNewDC();
}
public virtual TDC MapToNewDC(TEntity pEntity, bool dontCreateNewDConNullEntity)
{
if (dontCreateNewDConNullEntity || pEntity is object)
return MapToNewDC(pEntity);
return CreateNewDC();
@@ -131,9 +142,9 @@ namespace BeWo.Service.DCEntityMapper
// .Select(dc => MapToNewEntity(dc)));
}
public virtual TEntity MergeWithEntity(TDC pDataContract, TEntity pEntity, bool ignoreNullDC)
public virtual TEntity MergeOrCreateWithEntity(TDC pDataContract, TEntity pEntity)
{
if (ignoreNullDC || pDataContract is object)
if (pDataContract is object)
{
if (pEntity is null)
pEntity = CreateNewEntity();

View File

@@ -0,0 +1,48 @@
using System.Linq;
using BeWo.Data.Entities;
using BS.Shared.DataContracts;
namespace BeWo.Service.DCEntityMapper
{
public class AddressDC_Address : AbstractIDCEntityMapper<Address, AddressDC>
{
public override AddressDC MergeWithDC(Address pEntity, AddressDC pDataContract)
{
pDataContract.AddressLine1 = pEntity.AddressLine1;
pDataContract.AddressLine2 = pEntity.AddressLine2;
pDataContract.Country = pEntity.Country;
pDataContract.L_Version = pEntity.L_Version;
pDataContract.Latitude = pEntity.Latitude;
pDataContract.Longitude = pEntity.Longitude;
pDataContract.PostalCode = pEntity.PostalCode;
pDataContract.State = pEntity.State;
pDataContract.Street = pEntity.Street;
pDataContract.Town = pEntity.Town;
return pDataContract;
}
public override Address MergeWithEntity(AddressDC pDataContract, Address pEntity)
{
pEntity.AddressLine1 = pDataContract.AddressLine1;
pEntity.AddressLine2 = pDataContract.AddressLine2;
pEntity.Country = pDataContract.Country;
pEntity.L_Version = pDataContract.L_Version;
pEntity.Latitude = pDataContract.Latitude;
pEntity.Longitude = pDataContract.Longitude;
pEntity.PostalCode = pDataContract.PostalCode;
pEntity.State = pDataContract.State;
pEntity.Street = pDataContract.Street;
pEntity.Town = pDataContract.Town;
return pEntity;
}
protected override bool AreDCAndEntityEqual(AddressDC pDC, Address pEntity)
{
if (pDC.Oid == null)
return false;
return pDC.Oid == pEntity.Oid;
}
}
}

View File

@@ -27,7 +27,7 @@ namespace BeWo.Service.DCEntityMapper
to.IsSchedulerAllowed = from.IsSchedulerAllowed;
to.IsMedicationAllowed = from.IsMedicationAllowed;
to.BankAccount = MapperFactory.BankAccount.MapToNewDC(from.BankAccount, false);
to.BankAccount = MapperFactory.BankAccount.CreateOrMapToNewDC(from.BankAccount);
to.AllowSbd = !string.IsNullOrEmpty(to.ClientId) && to.ClientId == "SBD";
@@ -76,9 +76,9 @@ namespace BeWo.Service.DCEntityMapper
// HACK: BankAccount ist neu, alte Clients: from.BankAccount null
if (from.BankAccount is object)
{
to.BankAccount = MapperFactory.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.BankAccount = MapperFactory.BankAccount.MergeOrCreateWithEntity(from.BankAccount, to.BankAccount);
to.SoziotherapieAnsprechpartner = MapperFactory.CompactEmployeeDC_Employee.MergeOrCreateWithEntity(from.SoziotherapieAnsprechpartner, to.SoziotherapieAnsprechpartner);
to.Logo = MapperFactory.ImageDC_Image.MergeOrCreateWithEntity(from.Logo, to.Logo);
to.ShowGkvBzEinzel = from.ShowGkvBzEinzel;
to.ShowGkvBzUrbelege = from.ShowGkvBzUrbelege;

View File

@@ -1,7 +1,4 @@
using BeWo.Data.Entities;
using BeWo.Service.DCEntityMapper.Compact;
using BS.Shared.DataContracts;
using DevExpress.CodeParser;
using BeWo.Service.DCEntityMapper.Compact;
namespace BeWo.Service.DCEntityMapper
{
@@ -811,14 +808,14 @@ namespace BeWo.Service.DCEntityMapper
_InvoiceBaseLightDC_InvoiceBaseLight ?? (_InvoiceBaseLightDC_InvoiceBaseLight = new InvoiceBaseLightDC_InvoiceBaseLight());
// REFACTOR
// Neuer Style
// - Kürzere Namen -> Länge reduzieren
// - Einfaches Init -> Bei Bedarf erweitern
// Kürzer, wird nur bei Bedarf geladen :)
public static BankAccountDC_BankAccount BankAccount { get; } = new BankAccountDC_BankAccount();
public static AiConversationDC_AiConversation AiConversation { get; } = new AiConversationDC_AiConversation();
public static AiConversationMessageDC_AiConversationMessage AiConversationMessage { get; } = new AiConversationMessageDC_AiConversationMessage();
public static AiModelDC_AiModel AiModel { get; } = new AiModelDC_AiModel();
public static AiConfigDC_AiConfig AiConfig { get; } = new AiConfigDC_AiConfig();
public static AddressDC_Address Address { get; set; } = new AddressDC_Address();
}
}

View File

@@ -1,10 +1,11 @@
using System.Linq;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Data.Entities;
using BS.Shared;
using BS.Shared.DataContracts;
using System.Linq;
namespace BeWo.Service.DCEntityMapper
{
@@ -26,7 +27,8 @@ namespace BeWo.Service.DCEntityMapper
pDataContract.Arbeitszeiten = MapperFactory.ArbeitszeitDC_Arbeitszeit.MapToNewDCs(pEntity.Arbeitszeiten);
pDataContract.Feiertage = MapperFactory.FeiertagDC_Feiertag.MapToNewDCs(pEntity.Feiertage);
pDataContract.RelatedPersons = MapperFactory.OrganisationPersonRelDC_Organisation2PersonMapper.MapToNewDCs(pEntity.Organisation2PersonList.Where(o2P => o2P.Person.IsActive != ActivationTypeId.Deleted));
pDataContract.RelatedPersons = MapperFactory.OrganisationPersonRelDC_Organisation2PersonMapper
.MapToNewDCs(pEntity.Organisation2PersonList.Where(o2P => o2P.Person.IsActive != ActivationTypeId.Deleted));
pDataContract.IKKrankenkasse = pEntity.IKKrankenkasse;
pDataContract.IKKostentrager = pEntity.IKKostentrager;
@@ -38,12 +40,12 @@ namespace BeWo.Service.DCEntityMapper
pDataContract.BusinessPartnerId = pEntity.BusinessPartnerId;
if (pEntity.Function != null)
if(pEntity.Function != null)
{
pDataContract.Function = MapperFactory.ValueListEntryDC_ValueListEntry.MapToNewDC(pEntity.Function);
}
if (pEntity.Address != null)
if(pEntity.Address != null)
{
pDataContract.AddressOid = pEntity.Address.Oid;
pDataContract.Street = pEntity.Address.Street;
@@ -53,7 +55,7 @@ namespace BeWo.Service.DCEntityMapper
pDataContract.AddressVersion = pEntity.Address.Version;
}
if (pEntity.InvoiceAddress != null)
if(pEntity.InvoiceAddress != null)
{
pDataContract.InvoiceAddressOid = pEntity.InvoiceAddress.Oid;
pDataContract.InvoiceAddressStreet = pEntity.InvoiceAddress.Street;
@@ -63,7 +65,7 @@ namespace BeWo.Service.DCEntityMapper
pDataContract.InvoiceAddressVersion = pEntity.InvoiceAddress.Version;
}
if (pEntity.CostBearer != null)
if(pEntity.CostBearer != null)
{
pDataContract.CostBearerOid = pEntity.CostBearer.Oid;
pDataContract.CostBearerVersion = pEntity.CostBearer.Version;
@@ -77,7 +79,7 @@ namespace BeWo.Service.DCEntityMapper
pDataContract.IsCalculatingWithFactor = pEntity.CostBearer.IsCalculatingWithFactor;
}
if (pEntity.BankAccount != null)
if(pEntity.BankAccount != null)
{
pDataContract.BankAccountOid = pEntity.BankAccount.Oid;
pDataContract.BankAccountVersion = pEntity.BankAccount.Version;
@@ -88,12 +90,9 @@ namespace BeWo.Service.DCEntityMapper
pDataContract.Bic = pEntity.BankAccount.Bic;
}
if (pEntity.GetDatenannahmestelleAddress() is Address address)
{
pDataContract.DatenannahmestelleStreet = address.Street;
pDataContract.DatenannahmestellePostalCode = address.PostalCode;
pDataContract.DatenannahmestelleTown = address.Town;
}
pDataContract.HausanschriftDatenannahmestelle = MapperFactory.Address.CreateOrMapToNewDC(pEntity.HausanschriftDatenannahmestelle);
pDataContract.PostfachanschriftDatenannahmestelle = MapperFactory.Address.CreateOrMapToNewDC(pEntity.PostfachanschriftDatenannahmestelle);
pDataContract.GroßkundenanschriftDatenannahmestelle = MapperFactory.Address.CreateOrMapToNewDC(pEntity.GroßkundenanschriftDatenannahmestelle);
pDataContract.ContactInformations = MapperFactory.ContactDC_Contact.MapToNewDCs(pEntity.Contacts);
@@ -125,18 +124,18 @@ namespace BeWo.Service.DCEntityMapper
pEntity.BusinessPartnerId = pDataContract.BusinessPartnerId;
if (pDataContract.Function == null)
if(pDataContract.Function == null)
{
pEntity.Function = null;
}
else if (pEntity.Function == null || pEntity.Function.Oid != pDataContract.Function.ValueListEntryOid)
else if(pEntity.Function == null || pEntity.Function.Oid != pDataContract.Function.ValueListEntryOid)
{
pEntity.Function = DAOFactory.GenericDAO.LoadByID<ValueListEntry>(pDataContract.Function.ValueListEntryOid.Value);
}
if (pDataContract.ContainsAddressData())
if(pDataContract.ContainsAddressData())
{
if (pEntity.Address == null)
if(pEntity.Address == null)
{
pEntity.Address = new Address();
}
@@ -149,7 +148,7 @@ namespace BeWo.Service.DCEntityMapper
pEntity.Address.Town = pDataContract.Town;
pEntity.Address.PostalCode = pDataContract.PostalCode;
}
else if (pEntity.Address != null)
else if(pEntity.Address != null)
{
// all-delete-orphan wird von NHibernate (noch) nicht unterstützt für many-to-one
Address lAdress = pEntity.Address;
@@ -157,9 +156,9 @@ namespace BeWo.Service.DCEntityMapper
DAOFactory.GenericDAO.Delete(lAdress);
}
if (pDataContract.ContainsInvoiceAddressData())
if(pDataContract.ContainsInvoiceAddressData())
{
if (pEntity.InvoiceAddress == null)
if(pEntity.InvoiceAddress == null)
{
pEntity.InvoiceAddress = new Address();
}
@@ -172,7 +171,7 @@ namespace BeWo.Service.DCEntityMapper
pEntity.InvoiceAddress.Town = pDataContract.InvoiceAddressTown;
pEntity.InvoiceAddress.PostalCode = pDataContract.InvoiceAddressPostalCode;
}
else if (pEntity.InvoiceAddress != null)
else if(pEntity.InvoiceAddress != null)
{
// all-delete-orphan wird von NHibernate (noch) nicht unterstützt für many-to-one
Address lInvoiceAddress = pEntity.InvoiceAddress;
@@ -180,9 +179,9 @@ namespace BeWo.Service.DCEntityMapper
DAOFactory.GenericDAO.Delete(lInvoiceAddress);
}
if (pDataContract.ContainsBankAccountData())
if(pDataContract.ContainsBankAccountData())
{
if (pEntity.BankAccount == null)
if(pEntity.BankAccount == null)
{
pEntity.BankAccount = new BankAccount();
}
@@ -197,7 +196,7 @@ namespace BeWo.Service.DCEntityMapper
pEntity.BankAccount.BankName = pDataContract.BankName;
pEntity.BankAccount.AccountNumber = pDataContract.AccountNumber;
}
else if (pEntity.BankAccount != null)
else if(pEntity.BankAccount != null)
{
// all-delete-orphan wird von NHibernate (noch) nicht unterstützt für many-to-one)
BankAccount lBankAccount = pEntity.BankAccount;
@@ -205,9 +204,9 @@ namespace BeWo.Service.DCEntityMapper
DAOFactory.GenericDAO.Delete(lBankAccount);
}
if (pDataContract.ContainsCostBearerData())
if(pDataContract.ContainsCostBearerData())
{
if (pEntity.CostBearer == null)
if(pEntity.CostBearer == null)
{
pEntity.CostBearer = new CostBearer();
}
@@ -218,13 +217,14 @@ namespace BeWo.Service.DCEntityMapper
pEntity.CostBearer.Oid = pDataContract.CostBearerOid;
pEntity.CostBearer.IsCalculatingWithFactor = pDataContract.IsCalculatingWithFactor;
MapperFactory.CostRatePeriodDC_CostRatePeriod.MergeWithEntitys(pDataContract.CostRatePeriods.Where(c => c.CostRateValue.HasValue).ToList(), pEntity.CostBearer.CostRatePeriods);
foreach (var costRatePeriod in pEntity.CostBearer.CostRatePeriods)
MapperFactory.CostRatePeriodDC_CostRatePeriod
.MergeWithEntitys(pDataContract.CostRatePeriods.Where(c => c.CostRateValue.HasValue).ToList(), pEntity.CostBearer.CostRatePeriods);
foreach(var costRatePeriod in pEntity.CostBearer.CostRatePeriods)
{
costRatePeriod.ObjectTid = TableID.CostBearer;
}
}
else if (pEntity.CostBearer != null)
else if(pEntity.CostBearer != null)
{
// all-delete-orphan wird von NHibernate (noch) nicht unterstützt für many-to-one)
CostBearer lCostBearer = pEntity.CostBearer;
@@ -238,13 +238,16 @@ namespace BeWo.Service.DCEntityMapper
MapperFactory.ArbeitszeitDC_Arbeitszeit.MergeWithEntitys(pDataContract.Arbeitszeiten, pEntity.Arbeitszeiten);
MapperFactory.FeiertagDC_Feiertag.MergeWithEntitys(pDataContract.Feiertage, pEntity.Feiertage);
MapperFactory.Address.MergeOrCreateWithEntity(pDataContract.HausanschriftDatenannahmestelle, pEntity.HausanschriftDatenannahmestelle);
MapperFactory.Address.MergeOrCreateWithEntity(pDataContract.PostfachanschriftDatenannahmestelle, pEntity.PostfachanschriftDatenannahmestelle);
MapperFactory.Address.MergeOrCreateWithEntity(pDataContract.GroßkundenanschriftDatenannahmestelle, pEntity.GroßkundenanschriftDatenannahmestelle);
return pEntity;
}
protected override bool AreDCAndEntityEqual(OrganisationDC pDC, Organisation pEntity)
{
if (pDC.OrganisationOid == null)
if(pDC.OrganisationOid == null)
{
return false;
}

View File

@@ -235,6 +235,7 @@
<Compile Include="Core\SettingsLogic.cs" />
<Compile Include="Core\Utils.cs" />
<Compile Include="DCEntityMapper\AbwesenheitsInformationPrintDC_AbwesenheitsInformationPrint.cs" />
<Compile Include="DCEntityMapper\AddressDC_Address.cs" />
<Compile Include="DCEntityMapper\AddressRouteDC_AddressRoute.cs" />
<Compile Include="DCEntityMapper\AiConversationMessageDC_AiConversationMessage.cs" />
<Compile Include="DCEntityMapper\AiConversationDC_AiConversation.cs" />

View File

@@ -221,7 +221,7 @@ namespace BeWo.Service.AI
#region LOAD Methods
private static object LoadProperty<TEntity, TDC>
(Dictionary<TableID, long[]> bewoobjects, TableID tid, AbstractIDCEntityMapper<TEntity, TDC> mapper, Func<TDC, object> getPropertyFunc)
where TDC : new() where TEntity : BeWoEntityBase, new()
where TDC : class, new() where TEntity : BeWoEntityBase, new()
{
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
return null;
@@ -235,7 +235,7 @@ namespace BeWo.Service.AI
private static Dictionary<string, object> LoadEntity<TEntity, TDC>
(Dictionary<TableID, long[]> bewoobjects, TableID tid, AbstractIDCEntityMapper<TEntity, TDC> mapper)
where TDC : new() where TEntity : BeWoEntityBase, new()
where TDC : class, new() where TEntity : BeWoEntityBase, new()
{
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
return null;
@@ -248,7 +248,7 @@ namespace BeWo.Service.AI
private static IList<Dictionary<string, object>> LoadEntities<TEntity, TDC>
(Dictionary<TableID, long[]> bewoobjects, TableID tid, AbstractIDCEntityMapper<TEntity, TDC> mapper)
where TDC : new() where TEntity : BeWoEntityBase, new()
where TDC : class, new() where TEntity : BeWoEntityBase, new()
{
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
return null;
@@ -262,7 +262,7 @@ namespace BeWo.Service.AI
private static IList<Dictionary<string, object>> LoadEntities<TEntity, TDC>
(Dictionary<TableID, long[]> bewoobjects, TableID tid, AbstractIDCEntityMapper<TEntity, TDC> mapper, Action<TEntity, TDC> afterDC)
where TDC : new() where TEntity : BeWoEntityBase, new()
where TDC : class, new() where TEntity : BeWoEntityBase, new()
{
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
return null;

View File

@@ -1,12 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;
namespace BS.Shared.DataContracts
{
public class AddressDC : BeWoDataContract
{
[DataMember] public string AddressLine1 { get; set; }
[DataMember] public string AddressLine2 { get; set; }
[DataMember] public string Country { get; set; }
[DataMember] public long? L_Version { get; set; }
[DataMember] public decimal? Latitude { get; set; }
[DataMember] public decimal? Longitude { get; set; }
[DataMember] public string PostalCode { get; set; }
[DataMember] public string State { get; set; }
[DataMember] public string Street { get; set; }
[DataMember] public string Town { get; set; }
}
}

View File

@@ -53,6 +53,5 @@ namespace BS.Shared.DataContracts
[DataMember]
public long? Version { get; set; }
}
}

View File

@@ -1,7 +1,8 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
using BS.Shared.Core;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace BS.Shared.DataContracts
{
@@ -13,96 +14,84 @@ namespace BS.Shared.DataContracts
private List<CostRatePeriodDC> _CostRatePeriods;
[DataMember] public string AccountNumber { get; set; }
[DataMember] public ActivationTypeId ActivationType { get; set; }
[DataMember] public string AddressLine1 { get; set; }
[DataMember] public long? AddressOid { get; set; }
[DataMember] public long? AddressVersion { get; set; }
[DataMember] public List<ArbeitszeitDC> Arbeitszeiten { get; set; }
[DataMember] public long? BankAccountOid { get; set; }
[DataMember] public long? BankAccountVersion { get; set; }
[DataMember] public string BankCode { get; set; }
[DataMember] public string BankName { get; set; }
[DataMember] public string Bic { get; set; }
[DataMember] public string IKKrankenkasse { get; set; }
[DataMember] public string IKKostentrager { get; set; }
[DataMember] public string IKDatenannahmestelle { get; set; }
[DataMember] public string BezDatenannahmestelle { get; set; }
[DataMember] public ActivationTypeId ActivationType { get; set; }
[DataMember] public string Bic { get; set; }
[DataMember] public string BusinessPartnerId { get; set; }
[DataMember]
public List<ContactDC> ContactInformations
{
get { return this._ContactInformations ?? (this._ContactInformations = new List<ContactDC>()); }
set { this._ContactInformations = value; }
}
[DataMember] public long? CostBearerOid { get; set; }
[DataMember] public long? CostBearerVersion { get; set; }
[DataMember] public string CostCenter { get; set; }
[DataMember]
public List<CostRatePeriodDC> CostRatePeriods
{
get { return this._CostRatePeriods ?? (this._CostRatePeriods = new List<CostRatePeriodDC>()); }
set { this._CostRatePeriods = value; }
}
[DataMember] public string DebitorNumber { get; set; }
[DataMember] public List<FeiertagDC> Feiertage { get; set; }
[DataMember] public ValueListEntryDC Function { get; set; }
[DataMember] public bool GkvAusblenden { get; set; }
[DataMember] public AddressDC GroßkundenanschriftDatenannahmestelle { get; set; }
[DataMember] public AddressDC HausanschriftDatenannahmestelle { get; set; }
[DataMember] public string IBAN { get; set; }
[DataMember] public string IKDatenannahmestelle { get; set; }
[DataMember] public string IKKostentrager { get; set; }
[DataMember] public string IKKrankenkasse { get; set; }
[DataMember] public string InvoiceAddressLine1 { get; set; }
[DataMember] public long? InvoiceAddressOid { get; set; }
[DataMember] public string InvoiceAddressPostalCode { get; set; }
[DataMember] public string InvoiceAddressStreet { get; set; }
[DataMember] public string InvoiceAddressTown { get; set; }
[DataMember] public string InvoiceAddressLine1 { get; set; }
[DataMember] public long? InvoiceAddressVersion { get; set; }
[DataMember] public bool IsCalculatingWithFactor { get; set; }
[DataMember] public bool IsSingleInvoicePerCustomer { get; set; }
[DataMember] public string Leistungserbringergruppe { get; set; }
[DataMember] public string Name { get; set; }
[DataMember] public string Name2 { get; set; }
[DataMember] public string OrganisationNotice { get; set; }
[DataMember] public long? OrganisationOid { get; set; }
[DataMember] public long? OrganisationVersion { get; set; }
[DataMember] public string PostalCode { get; set; }
[DataMember] public AddressDC PostfachanschriftDatenannahmestelle { get; set; }
[DataMember] public List<OrganisationPersonRelationDC> RelatedPersons { get; set; }
[DataMember] public string Street { get; set; }
[DataMember] public string Town { get; set; }
[DataMember] public string AddressLine1 { get; set; }
[DataMember] public string DebitorNumber { get; set; }
[DataMember] public string CostCenter { get; set; }
[DataMember] public List<VarFieldDC> VarFields { get; set; }
[DataMember] public ValueListEntryDC Function { get; set; }
[DataMember] public List<ArbeitszeitDC> Arbeitszeiten { get; set; }
[DataMember] public List<FeiertagDC> Feiertage { get; set; }
[DataMember] public string Leistungserbringergruppe { get; set; }
[DataMember] public string BusinessPartnerId { get; set; }
[DataMember] public GkvVerfahrensstufe Verfahrensstufe { get; set; }
[DataMember] public bool GkvAusblenden { get; set; }
[DataMember] public string DatenannahmestelleStreet { get; set; }
[DataMember] public string DatenannahmestelleTown { get; set; }
[DataMember] public string DatenannahmestellePostalCode { get; set; }
[DataMember]
public List<ContactDC> ContactInformations
{
get
{
return this._ContactInformations ?? (this._ContactInformations = new List<ContactDC>());
}
set
{
this._ContactInformations = value;
}
}
[DataMember]
public List<CostRatePeriodDC> CostRatePeriods
{
get
{
return this._CostRatePeriods ?? (this._CostRatePeriods = new List<CostRatePeriodDC>());
}
set
{
this._CostRatePeriods = value;
}
}
public bool ContainsAddressData()
{
return !Utils.AreAllNullOrEmpty(this.Street, this.PostalCode, this.Town, this.AddressLine1);
}
{ return !Utils.AreAllNullOrEmpty(this.Street, this.PostalCode, this.Town, this.AddressLine1); }
public bool ContainsBankAccountData()
{
return !Utils.AreAllNullOrEmpty(BankCode, BankName, AccountNumber, IBAN, Bic);
}
{ return !Utils.AreAllNullOrEmpty(BankCode, BankName, AccountNumber, IBAN, Bic); }
public bool ContainsCostBearerData()
{
return !Utils.AreAllNullOrEmpty(this._CostRatePeriods) || this.IsCalculatingWithFactor;
}
{ return !Utils.AreAllNullOrEmpty(this._CostRatePeriods) || this.IsCalculatingWithFactor; }
public bool ContainsInvoiceAddressData()
{
return !Utils.AreAllNullOrEmpty(this.InvoiceAddressStreet, this.InvoiceAddressPostalCode, this.InvoiceAddressTown, this.InvoiceAddressLine1);
return !Utils.AreAllNullOrEmpty(
this.InvoiceAddressStreet,
this.InvoiceAddressPostalCode,
this.InvoiceAddressTown,
this.InvoiceAddressLine1);
}
}
}