From 591ce4c888ed3d8908e6b0b4623c19e811289e83 Mon Sep 17 00:00:00 2001 From: HirschleM Date: Mon, 3 Nov 2025 14:19:19 +0100 Subject: [PATCH] =?UTF-8?q?MH:=20Varfields=20f=C3=BCr=20Wohnheime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/View/Detail/WohnheimView.xaml | 6 +++++ BeWo/View/Detail/WohnheimView.xaml.cs | 7 ++++++ BeWo/ViewModel/WohnheimVM.cs | 25 ++++++++++++++++++- Data/Entities/Wohnheim.cs | 21 ++++++++++++++++ Data/Mappings/Wohnheim.hbm.xml | 4 +++ Service/DCEntityMapper/WohnheimDC_Wohnheim.cs | 8 +++++- Service/Plugins/TranslationDictionary.cs | 1 + Shared/DataContracts/WohnheimDC.cs | 3 +++ 8 files changed, 73 insertions(+), 2 deletions(-) diff --git a/BeWo/View/Detail/WohnheimView.xaml b/BeWo/View/Detail/WohnheimView.xaml index d1aa064e3..90a9352ca 100644 --- a/BeWo/View/Detail/WohnheimView.xaml +++ b/BeWo/View/Detail/WohnheimView.xaml @@ -16,6 +16,7 @@ xmlns:localWohneinheit="clr-namespace:BeWo.View.Detail.Wohneinheit" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:t="clr-namespace:BeWo.MultiLanguage.Markup" + xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup" xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" xmlns:uvc="clr-namespace:BeWo.View.Controls" xmlns:val="clr-namespace:BeWo.Validation" @@ -319,6 +320,11 @@ + + + + + diff --git a/BeWo/View/Detail/WohnheimView.xaml.cs b/BeWo/View/Detail/WohnheimView.xaml.cs index 98430d75f..ee5dfa5f3 100644 --- a/BeWo/View/Detail/WohnheimView.xaml.cs +++ b/BeWo/View/Detail/WohnheimView.xaml.cs @@ -48,6 +48,8 @@ namespace BeWo.View.Detail ViewModel = vm; + + _Customers = vm.Customers; InitializeComponent(); @@ -100,6 +102,11 @@ namespace BeWo.View.Detail root_wohneinheit.SelectedIndex = 2; } #endif + if (vm.VarFields == null || vm.VarFields.VMList.Count == 0) + { + tabitem_varFields.Visibility = Visibility.Collapsed; + } + } private void UserControl_GotFocus(object sender, RoutedEventArgs e) diff --git a/BeWo/ViewModel/WohnheimVM.cs b/BeWo/ViewModel/WohnheimVM.cs index 79368ccc8..6a1275fc6 100644 --- a/BeWo/ViewModel/WohnheimVM.cs +++ b/BeWo/ViewModel/WohnheimVM.cs @@ -35,6 +35,8 @@ namespace BeWo.ViewModel public static string PropertyName_StandardZeilenanzahl = "StandardZeilenanzahl"; public static string PropertyName_Sortierungsart = "Sortierungsart"; public static string PropertyName_AbsteigendeSortierung = "AbsteigendeSortierung"; + public static string PropertyName_VarFields = "VarFields"; + //################################################################## #endregion @@ -51,6 +53,7 @@ namespace BeWo.ViewModel private int _Sortierungsart; private int _AbsteigendeSortierung; private bool _IsArchived; + private VarFieldListVM _VarFields; //################################################################## @@ -90,6 +93,7 @@ namespace BeWo.ViewModel { return base.IsDirty || WohnheimEmployeeRelations.IsDirty || WohnheimCustomerRelations.IsDirty + || this._VarFields.IsDirty || WohneinheitListVM.IsDirty || WohneinheitBelegungListVM.IsDirty; } @@ -342,8 +346,20 @@ namespace BeWo.ViewModel FirePropertyChanged(PropertyName_WohnheimTeamRelations); } } + public VarFieldListVM VarFields + { + get { return this._VarFields; } + + set + { + if (this.AreDifferent(this._VarFields, value)) + { + this._VarFields = value; + this.FirePropertyChanged(PropertyName_VarFields); + } + } + } - public bool AddBelegung(object wohneinheit_oid = null, DateTime? start = null) { @@ -389,6 +405,8 @@ namespace BeWo.ViewModel protected override void InitByDataContract(WohnheimDC pDataContract) { + this._VarFields = new VarFieldListVM(pDataContract.VarFields); + _WohnheimName = pDataContract.WohnheimName; _Strasse = pDataContract.Strasse; _PLZ = pDataContract.PLZ; @@ -435,6 +453,11 @@ namespace BeWo.ViewModel //pDataContract.Wohneinheiten = _WohneinheitListVM.CopyToDCList(doCommit); + if (this._VarFields != null) + { + pDataContract.VarFields = this._VarFields.CopyToDCList(doCommit); + } + pDataContract.Wohneinheiten = null; var einheit_vm2dc = new Dictionary(); foreach (var vm in _WohneinheitListVM.VMList) diff --git a/Data/Entities/Wohnheim.cs b/Data/Entities/Wohnheim.cs index 7f6cff9fd..d80054c4b 100644 --- a/Data/Entities/Wohnheim.cs +++ b/Data/Entities/Wohnheim.cs @@ -31,12 +31,16 @@ namespace BeWo.Data.Entities public static string PropertyName_AbsteigendeSortierung = "AbsteigendeSortierung"; + public static string PropertyName_VarFieldValueList = "VarFieldValueList"; + private IList _Employee2WohnheimList; private IList _Customer2WohnheimList; private IList _Wohneinheiten; + private IList _VarFieldValueList; + public virtual string WohnheimName { get; set; } public virtual string Strasse { get; set; } @@ -58,6 +62,23 @@ namespace BeWo.Data.Entities public virtual int Sortierungsart { get; set; } public virtual int AbsteigendeSortierung { get; set; } + public Wohnheim() + { + this._Tid = TableID.Wohnheim; + } + + public virtual IList VarFieldValueList + { + get { return _VarFieldValueList ?? (_VarFieldValueList = new List()); } + + set + { + if (AreDifferent(_VarFieldValueList, value)) + { + _VarFieldValueList = value; + } + } + } public virtual IList Employee2WohnheimList diff --git a/Data/Mappings/Wohnheim.hbm.xml b/Data/Mappings/Wohnheim.hbm.xml index 3cb3fd022..56af445fd 100644 --- a/Data/Mappings/Wohnheim.hbm.xml +++ b/Data/Mappings/Wohnheim.hbm.xml @@ -37,5 +37,9 @@ + + + + \ No newline at end of file diff --git a/Service/DCEntityMapper/WohnheimDC_Wohnheim.cs b/Service/DCEntityMapper/WohnheimDC_Wohnheim.cs index 68c9fc7d3..ee934f51f 100644 --- a/Service/DCEntityMapper/WohnheimDC_Wohnheim.cs +++ b/Service/DCEntityMapper/WohnheimDC_Wohnheim.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Linq; - +using BeWo.Data.Access; using BeWo.Data.Entities; using BS.Shared; @@ -32,6 +32,9 @@ namespace BeWo.Service.DCEntityMapper pDataContract.RelatedCustomers = MapperFactory.CustomerWohnheimRelDC_Customer2WohnheimMapper.MapToNewDCs(pEntity.Customer2WohnheimList); pDataContract.Wohneinheiten = MapperFactory.WohneinheitDC_Wohneinheit.MapToNewDCs(pEntity.Wohneinheiten); + var defs = DAOFactory.SearchDAO.GetVarFieldDefs(TableID.Wohnheim); + pDataContract.VarFields = MapperFactory.VarFieldDC_VarField.VarFieldMapToDCs(defs, pEntity.VarFieldValueList); + return pDataContract; } @@ -51,10 +54,13 @@ namespace BeWo.Service.DCEntityMapper pEntity.Sortierungsart = pDataContract.Sortierungsart; pEntity.AbsteigendeSortierung = pDataContract.AbsteigendeSortierung; + pEntity.VarFieldValueList = MapperFactory.VarFieldDC_VarField.VarFieldMergeToEntity(pEntity.VarFieldValueList, pDataContract.VarFields, pEntity); + MapperFactory.EmployeeWohnheimRelDC_Employee2WohnheimMapper.MergeWithEntitys(pDataContract.RelatedEmployees, pEntity.Employee2WohnheimList); MapperFactory.CustomerWohnheimRelDC_Customer2WohnheimMapper.MergeWithEntitys(pDataContract.RelatedCustomers, pEntity.Customer2WohnheimList); MapperFactory.WohneinheitDC_Wohneinheit.MergeWithEntitys(pDataContract.Wohneinheiten, pEntity.Wohneinheiten, pEntity); + return pEntity; } diff --git a/Service/Plugins/TranslationDictionary.cs b/Service/Plugins/TranslationDictionary.cs index ac0b2b946..7d0f33c1a 100644 --- a/Service/Plugins/TranslationDictionary.cs +++ b/Service/Plugins/TranslationDictionary.cs @@ -67,6 +67,7 @@ namespace BeWo.Service.Plugins AddOrReplaceTranslation(dict, "OrganisationVarFieldsTitle", "Weitere Eigenschaften"); AddOrReplaceTranslation(dict, "PersonVarFieldsTitle", "Weitere Eigenschaften"); AddOrReplaceTranslation(dict, "TeamVarFieldsTitle", "Weitere Eigenschaften"); + AddOrReplaceTranslation(dict, "WohnheimVarFieldsTitle", "Weitere Eigenschaften"); AddOrReplaceTranslation(dict, "NotizenHeader", "Notizen"); AddOrReplaceTranslation(dict, "CustomerNotizen", "Notizen"); diff --git a/Shared/DataContracts/WohnheimDC.cs b/Shared/DataContracts/WohnheimDC.cs index c088847ff..3e8a225e2 100644 --- a/Shared/DataContracts/WohnheimDC.cs +++ b/Shared/DataContracts/WohnheimDC.cs @@ -54,6 +54,9 @@ namespace BS.Shared.DataContracts [DataMember] public List Wohneinheiten { get; set; } + [DataMember] + public List VarFields { get; set; } + public override string ToString() { return WohnheimName;