From bb607b18542cbedf4e8f2aca6bab420e3486630b Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Thu, 22 Aug 2024 14:35:06 +0200 Subject: [PATCH] =?UTF-8?q?Sortiert=20Einheiten=20Bug:=20Einf=C3=BCgen=20v?= =?UTF-8?q?on=20Wohneinheiten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/ViewModel/VMFactory.cs | 2 ++ BeWo/ViewModel/WohneinheitVM.cs | 18 ++++++++++++++++++ BeWo/ViewModel/WohnheimVM.cs | 6 ++++++ Data/Security/UserRightHelper.cs | 1 - Shared/Core/EnumTranslations.cs | 2 -- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/BeWo/ViewModel/VMFactory.cs b/BeWo/ViewModel/VMFactory.cs index 0627c0b98..ef34318d1 100644 --- a/BeWo/ViewModel/VMFactory.cs +++ b/BeWo/ViewModel/VMFactory.cs @@ -899,6 +899,8 @@ namespace BeWo.ViewModel beleg_vm.Wohneinheit = beleg_dc2einheit_vm[beleg_dc]; } + + einheit_vm_list.VMList.Sort(WohneinheitVM.Compare); } } } \ No newline at end of file diff --git a/BeWo/ViewModel/WohneinheitVM.cs b/BeWo/ViewModel/WohneinheitVM.cs index 3aaa5274a..0d08af8fc 100644 --- a/BeWo/ViewModel/WohneinheitVM.cs +++ b/BeWo/ViewModel/WohneinheitVM.cs @@ -255,6 +255,24 @@ namespace BeWo.ViewModel return string.IsNullOrEmpty(Zimmername); } + public static int Compare(WohneinheitVM vm1, WohneinheitVM vm2) + { + if (vm1 is null) + return 1; + + if (vm2 is null) + return -1; + + var compare1 = vm1.Wohnname.CompareTo(vm2.Wohnname); + + if (compare1 != 0) + return compare1; + + var compare2 = vm1.Zimmername.CompareTo(vm2.Zimmername); + + return compare2; + } + protected override void InitByDataContract(WohneinheitDC pDataContract) { _Oid = pDataContract.Oid; diff --git a/BeWo/ViewModel/WohnheimVM.cs b/BeWo/ViewModel/WohnheimVM.cs index 80e7d8ad8..19f2e8d8c 100644 --- a/BeWo/ViewModel/WohnheimVM.cs +++ b/BeWo/ViewModel/WohnheimVM.cs @@ -488,7 +488,13 @@ namespace BeWo.ViewModel { var dc = doCommit ? vm.CommitToDataContract() : vm.CopyToEmptyDataContract(); + if (pDataContract.Wohneinheiten is null) + pDataContract.Wohneinheiten = new List(); + einheit_vm2dc.Add(vm, dc); + + if(!pDataContract.Wohneinheiten.Contains(dc)) + pDataContract.Wohneinheiten.Add(dc); } foreach (var vm in _WohneinheitBelegungListVM.VMList) diff --git a/Data/Security/UserRightHelper.cs b/Data/Security/UserRightHelper.cs index 322adc57c..076e1bbcb 100644 --- a/Data/Security/UserRightHelper.cs +++ b/Data/Security/UserRightHelper.cs @@ -126,7 +126,6 @@ namespace BeWo.Data.Security ug.Rights.Add(r); } } - } public static bool IsCorrectVersion(UserRightType r, string version) diff --git a/Shared/Core/EnumTranslations.cs b/Shared/Core/EnumTranslations.cs index 074b0b59f..327fefade 100644 --- a/Shared/Core/EnumTranslations.cs +++ b/Shared/Core/EnumTranslations.cs @@ -967,13 +967,11 @@ namespace BS.Shared.Core dict.Add(Berufsschulabschluss.NichtAbgefragt, "nicht abgefragt"); dict.Add(Berufsschulabschluss.SonstigerAbschluss, "sonstiger Abschluss"); - dict.Add(ErwerbsfahigkeitSinnSGB.Ja, "ja"); dict.Add(ErwerbsfahigkeitSinnSGB.KeineAngabe, "keine Angabe"); dict.Add(ErwerbsfahigkeitSinnSGB.Nein, "nein"); dict.Add(ErwerbsfahigkeitSinnSGB.NichtAbgefragt, "nicht angefragt"); - dict.Add(Beschaftigungsstatus.Arbeitslos, "arbeitslos"); dict.Add(Beschaftigungsstatus.DritterArbeitsmarkt, "dritter Arbeitsmarkt"); dict.Add(Beschaftigungsstatus.ErsterArbeitsmarkt, "erster Arbeitsmarkt");