From f978afb0bd00f90d07dc9689bd7f210bc37dae9d Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 2 Sep 2024 11:03:16 +0200 Subject: [PATCH] Button Collapse wenn Command CanExecute False ist Bereich SozialKontakte --- BeWo/Converter/BoolVisibilityConverter.cs | 24 ++++++++++++------- .../View/Detail/CustomerFalldatenView.xaml.cs | 1 + BeWo/View/Detail/CustomerWohnhilfeView.xaml | 14 +++++++++-- BeWo/ViewModel/CustomerVM.cs | 3 ++- .../ListViewModel/AbstractDCListMapperVM.cs | 18 +++++++++++--- .../ListViewModel/CustomerWohnhilfeListVM.cs | 2 +- Data/Entities/CustomerFalldaten.cs | 1 + Data/Mappings/CustomerFalldaten.hbm.xml | 2 +- Shared/Core/EnumTranslations.cs | 6 +++++ .../Wohnhilfe/BereichSozialDC.cs | 24 +++++++++++++++++-- .../Wohnhilfe => }/FalldatenDC.cs | 2 +- Shared/Shared.csproj | 2 +- TranslationUnitTest/EnumTranslationTest.cs | 4 ++-- 13 files changed, 80 insertions(+), 23 deletions(-) rename Shared/{DataContracts/Wohnhilfe => }/FalldatenDC.cs (98%) diff --git a/BeWo/Converter/BoolVisibilityConverter.cs b/BeWo/Converter/BoolVisibilityConverter.cs index 8855d37a9..4ca45f8ed 100644 --- a/BeWo/Converter/BoolVisibilityConverter.cs +++ b/BeWo/Converter/BoolVisibilityConverter.cs @@ -14,18 +14,24 @@ namespace BeWo.Converter return Visibility.Visible; } - var lMode = true; - if (parameter is string s) - { - bool.TryParse(s, out lMode); - } - - if (lMode) + if(value is bool b) { - return !(bool)value ? Visibility.Collapsed : Visibility.Visible; + var lMode = true; + if (parameter is string s) + { + bool.TryParse(s, out lMode); + } + + if (lMode) + { + return !(bool)value ? Visibility.Collapsed : Visibility.Visible; + } + + return (bool)value ? Visibility.Collapsed : Visibility.Visible; } - return (bool)value ? Visibility.Collapsed : Visibility.Visible; + // Fange Fälle ab, wo noch nicht mit Command gearbeitet wird + return Visibility.Visible; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/BeWo/View/Detail/CustomerFalldatenView.xaml.cs b/BeWo/View/Detail/CustomerFalldatenView.xaml.cs index 5b3d2fce2..11c1230c1 100644 --- a/BeWo/View/Detail/CustomerFalldatenView.xaml.cs +++ b/BeWo/View/Detail/CustomerFalldatenView.xaml.cs @@ -1,5 +1,6 @@ using BeWo.ViewModel; using BS.Shared; +using BS.Shared.DataContracts; using BS.Shared.DataContracts.Wohnhilfe; using System; using System.Collections.Generic; diff --git a/BeWo/View/Detail/CustomerWohnhilfeView.xaml b/BeWo/View/Detail/CustomerWohnhilfeView.xaml index 2b6066c47..7fe3ddf02 100644 --- a/BeWo/View/Detail/CustomerWohnhilfeView.xaml +++ b/BeWo/View/Detail/CustomerWohnhilfeView.xaml @@ -9,6 +9,16 @@ mc:Ignorable="d" d:DataContext="{d:DesignInstance Type=viewmodel:CustomerVM, IsDesignTimeCreatable=true}" d:DesignHeight="450" d:DesignWidth="800"> + + + @@ -17,7 +27,7 @@ diff --git a/BeWo/ViewModel/CustomerVM.cs b/BeWo/ViewModel/CustomerVM.cs index cf8b5a40c..76de06d2e 100644 --- a/BeWo/ViewModel/CustomerVM.cs +++ b/BeWo/ViewModel/CustomerVM.cs @@ -837,7 +837,8 @@ namespace BeWo.ViewModel return base.IsDirty || TeamRelations.IsDirty || EmployeeRelations.IsDirty || _EnvironmentPersons.IsDirty || _EnvironmentOrganisations.IsDirty || _AbsenceTimes.IsDirty || _VarFields.IsDirty || CostBearers.IsDirty || _IndividualAssessmentSheetCategories.IsDirty || - _PlacementList.IsDirty || _MedVerordnungslisten.IsDirty || _EnvironmentPersonsWithFamily.IsDirty || _Arbeitszeiten.IsDirty || _CustomerFalldatenVM.IsDirty; + _PlacementList.IsDirty || _MedVerordnungslisten.IsDirty || _EnvironmentPersonsWithFamily.IsDirty || _Arbeitszeiten.IsDirty || + _CustomerFalldatenVM.IsDirty || _CustomerWohnhilfeListVM.IsDirty; } } public bool IsFemale diff --git a/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs b/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs index a44b5533e..cb9fabcba 100644 --- a/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs +++ b/BeWo/ViewModel/ListViewModel/AbstractDCListMapperVM.cs @@ -168,9 +168,6 @@ namespace BeWo.ViewModel.ListViewModel public VMType AddNewVMToList(bool pSetAsEdit) { - // Muss hier _NewVM oder kann auch NewVM? - // Fall: _NevVM is null - // Mache unten mal neue Methode, falls das Verhalten gewünscht ist _VMList.Add(_NewVM); // _VMList.Sort(); @@ -183,6 +180,21 @@ namespace BeWo.ViewModel.ListViewModel return EditVM; } + public VMType AddNewVMToListAndSelect(bool auto_select) + { + // Wichtig! NewVM, wenn _NewVM null ist + _VMList.Add(NewVM); + + // _VMList.Sort(); + if (auto_select) + { + SelectedVM = _NewVM; + } + + NewVM = null; + return EditVM; + } + public virtual List CommitAdded() { return this.VMList.Where(vm => vm.IsNew).Select(vm => vm.CommitToDataContract()).ToList(); diff --git a/BeWo/ViewModel/ListViewModel/CustomerWohnhilfeListVM.cs b/BeWo/ViewModel/ListViewModel/CustomerWohnhilfeListVM.cs index 06a91d8a8..a72e6ab50 100644 --- a/BeWo/ViewModel/ListViewModel/CustomerWohnhilfeListVM.cs +++ b/BeWo/ViewModel/ListViewModel/CustomerWohnhilfeListVM.cs @@ -20,7 +20,7 @@ namespace BeWo.ViewModel.ListViewModel { Customer = vm; - AddWohnhilfeCommand = new DelegateCommand(() => AddNewVMToList(), CanAddWohnhilfe); + AddWohnhilfeCommand = new DelegateCommand(() => AddNewVMToListAndSelect(true), CanAddWohnhilfe); DeleteWohnhilfeCommand = new DelegateCommand(() => DeleteSelectedVM($"Wohnhilfe '{SelectedVM.Displayname}'"), CanDeleteWohnhilfe); //AddWohnhilfeCommand.RaiseCanExecuteChanged(); diff --git a/Data/Entities/CustomerFalldaten.cs b/Data/Entities/CustomerFalldaten.cs index 0b0d385a3..15231f2c1 100644 --- a/Data/Entities/CustomerFalldaten.cs +++ b/Data/Entities/CustomerFalldaten.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using BS.Shared; +using BS.Shared.DataContracts; using BS.Shared.DataContracts.Wohnhilfe; namespace BeWo.Data.Entities diff --git a/Data/Mappings/CustomerFalldaten.hbm.xml b/Data/Mappings/CustomerFalldaten.hbm.xml index c220376d7..1e6eafdb3 100644 --- a/Data/Mappings/CustomerFalldaten.hbm.xml +++ b/Data/Mappings/CustomerFalldaten.hbm.xml @@ -23,7 +23,7 @@ - + diff --git a/Shared/Core/EnumTranslations.cs b/Shared/Core/EnumTranslations.cs index 7e38efefb..a8a29a9e0 100644 --- a/Shared/Core/EnumTranslations.cs +++ b/Shared/Core/EnumTranslations.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using BS.Shared.DataContracts; using BS.Shared.DataContracts.Wohnhilfe; using BS.Shared.Extensions; using BS.Shared.Translation; @@ -924,6 +925,11 @@ namespace BS.Shared.Core dict.Add(Angebot.SonstigerStellen, "sonstiger Stellen"); dict.Add(Angebot.TragerDerSozialhilfe, "überörtlichen Träger der Sozialhilfe"); + dict.Add(SozialKontakte.Ja, "ja"); + dict.Add(SozialKontakte.KeineAngabe, "keine Angabe"); + dict.Add(SozialKontakte.Nein, "nein"); + dict.Add(SozialKontakte.NichtAbgefragt, "nicht angefragt"); + dict.Add(Krankenversicherung.JaEingeschrankt, "Ja, aber nur eingeschränkt"); dict.Add(Krankenversicherung.JaUneingeschrankt, "Ja, in uneingeschränktem Maße"); dict.Add(Krankenversicherung.KeineAngabe, "keine Angabe"); diff --git a/Shared/DataContracts/Wohnhilfe/BereichSozialDC.cs b/Shared/DataContracts/Wohnhilfe/BereichSozialDC.cs index 7e9cf7ca0..a8b2904c0 100644 --- a/Shared/DataContracts/Wohnhilfe/BereichSozialDC.cs +++ b/Shared/DataContracts/Wohnhilfe/BereichSozialDC.cs @@ -10,8 +10,20 @@ namespace BS.Shared.DataContracts.Wohnhilfe [DataContract] public class BereichSozialDC : IDataContract { - //[DataMember] public SozialeKontakte BeginnSozialeKontakte { get; set; } - //[DataMember] public SozialeKontakte EndeSozialeKontakte { get; set; } + [DataMember] public SozialKontakte BeginnSozialeKontakte { get; set; } + [DataMember] public bool BeginnKontaktPartner { get; set; } + [DataMember] public bool BeginnKontaktMindKinder { get; set; } + [DataMember] public bool BeginnKontaktVolljahrKinderElternVerwandten { get; set; } + [DataMember] public bool BeginnKontaktFreundenBekannten { get; set; } + [DataMember] public bool BeginnKontaktSelbsthilfe { get; set; } + [DataMember] public bool BeginnKontaktSonstige { get; set; } + [DataMember] public SozialKontakte EndeSozialeKontakte { get; set; } + [DataMember] public bool EndeKontaktPartner { get; set; } + [DataMember] public bool EndeKontaktMindKinder { get; set; } + [DataMember] public bool EndeKontaktVolljahrKinderElternVerwandten { get; set; } + [DataMember] public bool EndeKontaktFreundenBekannten { get; set; } + [DataMember] public bool EndeKontaktSelbsthilfe { get; set; } + [DataMember] public bool EndeKontaktSonstige { get; set; } [DataMember] public Krankenversicherung BeginnKrankenversicherung{ get; set; } [DataMember] public Krankenversicherung EndeKrankenversicherung{ get; set; } [DataMember] public KontaktArzt BeginnKontaktArzt{ get; set; } @@ -19,6 +31,14 @@ namespace BS.Shared.DataContracts.Wohnhilfe [DataMember] public VorlageSchwerbehindertenausweises VorlageSchwerbehindertenausweises { get; set; } } + public enum SozialKontakte + { + Nein = 1, + Ja = 2, + KeineAngabe = 99, + NichtAbgefragt = 0 + } + public enum Krankenversicherung { Nein = 1, diff --git a/Shared/DataContracts/Wohnhilfe/FalldatenDC.cs b/Shared/FalldatenDC.cs similarity index 98% rename from Shared/DataContracts/Wohnhilfe/FalldatenDC.cs rename to Shared/FalldatenDC.cs index 39e81b6c6..7f6ed89cb 100644 --- a/Shared/DataContracts/Wohnhilfe/FalldatenDC.cs +++ b/Shared/FalldatenDC.cs @@ -5,7 +5,7 @@ using System.Runtime.Serialization; using BS.Shared.Core; using BS.Shared.DataContracts.Compact; -namespace BS.Shared.DataContracts.Wohnhilfe +namespace BS.Shared.DataContracts { public enum FalldatenBearbeitungsstatus { diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj index 24975c940..e4c98b179 100644 --- a/Shared/Shared.csproj +++ b/Shared/Shared.csproj @@ -175,7 +175,7 @@ - + diff --git a/TranslationUnitTest/EnumTranslationTest.cs b/TranslationUnitTest/EnumTranslationTest.cs index 04cc2deda..9f76a7eb9 100644 --- a/TranslationUnitTest/EnumTranslationTest.cs +++ b/TranslationUnitTest/EnumTranslationTest.cs @@ -16,8 +16,6 @@ namespace TranslationUnitTest [TestInitialize] public void Init() { - Dict = EnumTranslations.UserRightType2Translations; - UserRightTypesVersion1dot0 = new List() { UserRightType.None, UserRightType.DeleteAll, @@ -252,6 +250,8 @@ UserRightType.Signature_ProvideMonthlySignatureByProxy, [TestMethod] public void DictionaryComplete() { + Dict = EnumTranslations.UserRightType2Translations; + foreach (UserRightType item in Enum.GetValues(typeof(UserRightType))) { if (item != UserRightType.None && !Dict.ContainsKey(item))