From 3498680a06cbd8737f5efc3a6aefb71a7ba79c78 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Tue, 17 Aug 2021 15:30:54 +0200 Subject: [PATCH 1/8] =?UTF-8?q?Mit=20=C3=A4nderbarem=20Preis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/View/Detail/PreisView.xaml | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/BeWo/View/Detail/PreisView.xaml b/BeWo/View/Detail/PreisView.xaml index f1a15846b..8b952fd83 100644 --- a/BeWo/View/Detail/PreisView.xaml +++ b/BeWo/View/Detail/PreisView.xaml @@ -12,27 +12,25 @@ - - - - + + - + - - + + - - + + - + From 0b34ccb9fcf2bfeb6f182890191b47c95f78898a Mon Sep 17 00:00:00 2001 From: Alexandra Date: Tue, 17 Aug 2021 15:31:02 +0200 Subject: [PATCH 2/8] =?UTF-8?q?Mit=20=C3=A4nderbarem=20Preis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/View/Detail/PreisView.xaml.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/BeWo/View/Detail/PreisView.xaml.cs b/BeWo/View/Detail/PreisView.xaml.cs index 53dd07199..d4141740a 100644 --- a/BeWo/View/Detail/PreisView.xaml.cs +++ b/BeWo/View/Detail/PreisView.xaml.cs @@ -38,7 +38,6 @@ namespace BeWo.View.Detail get { return "Preise"; } } - // TODO internal override DependencyObject ValidationOnSaveRootElement { get { return button_addPreis; } @@ -85,7 +84,8 @@ namespace BeWo.View.Detail private void ReloadViewModel() { - VMFactory.CreatePreisListVMAsync(r => this.Dispatch(delegate { ViewModel = r; })); + //Cache.GetInstance().ClearServiceCategoryDescriptions(); + VMFactory.CreatePreisListVMAsync(r => this.Dispatch(delegate { ViewModel = r; })); } private void Button_addPreis_Click(object sender, RoutedEventArgs e) @@ -96,6 +96,22 @@ namespace BeWo.View.Detail } } + private void PART_Editor_Click(object sender, RoutedEventArgs e) + { + RowData data = DatagridRegions.View.FocusedRowData; + + if (data != null && data.RowHandle != null) + { + var vm = DatagridRegions.GetRow(data.RowHandle.Value) as PreisVM; + + if (vm != null) + { + ViewModel.EditVM = vm; + popup_costrateperiods.IsOpen = true; + } + } + } + private void button_edit_Click(object sender, RoutedEventArgs e) { popup_costrateperiods.IsOpen = false; From 939ed275bf1ac162af74a15a8a9213a7106021f3 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Tue, 17 Aug 2021 15:31:19 +0200 Subject: [PATCH 3/8] =?UTF-8?q?Mit=20=C3=A4nderbarem=20Preis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/ViewModel/PreisVM.cs | 184 +++++++++++++++++++++++++++++++++++--- 1 file changed, 170 insertions(+), 14 deletions(-) diff --git a/BeWo/ViewModel/PreisVM.cs b/BeWo/ViewModel/PreisVM.cs index 8e5f5f2f0..0cbc13e1e 100644 --- a/BeWo/ViewModel/PreisVM.cs +++ b/BeWo/ViewModel/PreisVM.cs @@ -1,10 +1,12 @@ using BS.Shared; +using BS.Shared.Core; using BS.Shared.DataContracts; using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; -using System.Text; -using System.Threading.Tasks; +using BeWo.Validation; +using BeWo.ViewModel.ListViewModel; namespace BeWo.ViewModel { @@ -16,6 +18,26 @@ namespace BeWo.ViewModel private SystemEntryID? _PreisSystemEntryID; private string _Name; private decimal? _Betrag; + public static string PropertyName_BillableAmount = "BillableAmount"; + + public static string PropertyName_CostRatePeriods = "CostRatePeriods"; + + public static string PropertyName_CurrentAmount = "CurrentAmount"; + + public static string PropertyName_IsDefault = "IsDefault"; + + public static string PropertyName_DoNotCheckOverlapping = "DoNotCheckOverlapping"; + + private bool _IsDeleteable = true; + + private decimal _BillableAmount; + + private bool _IsDefault; + + private bool _DoNotCheckOverlapping; + + private CostRatePeriodListVM _CostRatePeriods; + public PreisVM(PreisDC preisDC) : base(preisDC, preisDC.PreisOid == null) { } @@ -89,24 +111,158 @@ namespace BeWo.ViewModel } } + public bool IsDeleteable + { + get { return _IsDeleteable; } + } + + public decimal BillableAmount + { + get { return _BillableAmount; } + + set + { + if (AreDifferent(_BillableAmount, value)) + { + _BillableAmount = value; + StoreDirtyInformation(AreDifferent(DataContract.BillableAmount, value), PropertyName_BillableAmount); + FirePropertyChanged(PropertyName_BillableAmount); + } + } + } + + public CostRatePeriodListVM CostRatePeriods + { + get { return _CostRatePeriods; } + + set + { + if (AreDifferent(_CostRatePeriods, value)) + { + _CostRatePeriods = value; + if ( _CostRatePeriods != null && _CostRatePeriods.VMList.Count > 0) + FirePropertyChanged(PropertyName_CostRatePeriods); + } + } + } + + public bool IsDefault + { + get { return this._IsDefault; } + + set + { + if (this.AreDifferent(this._IsDefault, value)) + { + this._IsDefault = value; + this.StoreDirtyInformation(this.AreDifferent(this.DataContract.IsDefault, value), PropertyName_IsDefault); + this.FirePropertyChanged(PropertyName_IsDefault); + } + } + } + + public bool DoNotCheckOverlapping + { + get { return this._DoNotCheckOverlapping; } + + set + { + if (this.AreDifferent(this._DoNotCheckOverlapping, value)) + { + this._DoNotCheckOverlapping = value; + this.StoreDirtyInformation(this.AreDifferent(this.DataContract.IsDefault, value), PropertyName_DoNotCheckOverlapping); + this.FirePropertyChanged(PropertyName_DoNotCheckOverlapping); + } + } + } + + public CostRatePeriodVM CurrentAmount + { + get { return CostRatePeriods.GetCurrentlyValidRate(CostRatePeriodType.AmountOfMoney); } + } + + public override bool IsDirty + { + get + { + if (_CostRatePeriods == null) + { + return false; + } + + return base.IsDirty || _CostRatePeriods.IsDirty; + } + } + protected override void InitByDataContract(PreisDC bDataContract) { - _PreisOid = bDataContract.PreisOid; - _PreisVersion = bDataContract.PreisVersion; - _PreisSystemEntryID = bDataContract.PreisSystemEntryID; - Name = bDataContract.Name; - Betrag = bDataContract.Betrag; - PreisInsTs = bDataContract.PreisInsTs; + if (!IsNew) + { + _IsDeleteable = !bDataContract.IsSystemEntry; + _BillableAmount = bDataContract.BillableAmount; + _IsDefault = bDataContract.IsDefault; + _DoNotCheckOverlapping = bDataContract.DoNotCheckOverlapping; + _PreisOid = bDataContract.PreisOid; + _PreisVersion = bDataContract.PreisVersion; + _PreisSystemEntryID = bDataContract.PreisSystemEntryID; + Name = bDataContract.Name; + Betrag = bDataContract.Betrag; + PreisInsTs = bDataContract.PreisInsTs; + } + + if (bDataContract.CostRatePeriods == null) + { + bDataContract.CostRatePeriods = new List(); + } + + Utils.GetAllEnumValues().ToList().ForEach( + t => + { + if (t == CostRatePeriodType.AmountOfMoney && !bDataContract.CostRatePeriods.Exists(i => i.CostRateType == t)) + { + bDataContract.CostRatePeriods.Add( + new CostRatePeriodDC + { + CostRateType = t + }); + } + }); + + _CostRatePeriods = new CostRatePeriodListVM(bDataContract.CostRatePeriods); + + _CostRatePeriods.VMList.ListChanged += (s, e) => + { + if (e.ListChangedType != ListChangedType.ItemChanged) + { + FirePropertyChanged(PropertyName_CostRatePeriods); + + } + FirePropertyChanged(PropertyName_CurrentAmount); + }; + } protected override PreisDC MapToDataContract(PreisDC bDataContract, bool doCommit) { - bDataContract.PreisOid = _PreisOid; - bDataContract.PreisVersion = _PreisVersion; - bDataContract.PreisSystemEntryID = _PreisSystemEntryID; - bDataContract.Name = _Name; - bDataContract.Betrag = _Betrag; - bDataContract.PreisInsTs = _PreisInsTs; + bDataContract.IsDefault = _IsDefault; + bDataContract.BillableAmount = _BillableAmount; + bDataContract.DoNotCheckOverlapping = _DoNotCheckOverlapping; + bDataContract.PreisOid = _PreisOid; + bDataContract.PreisVersion = _PreisVersion; + bDataContract.PreisSystemEntryID = _PreisSystemEntryID; + bDataContract.Name = _Name; + bDataContract.Betrag = _Betrag; + bDataContract.PreisInsTs = _PreisInsTs; + + bDataContract.CostRatePeriods = new List(); + + List crpList = _CostRatePeriods.CopyToDCList(doCommit); + foreach (var costRatePeriodDc in crpList) + { + if (costRatePeriodDc.CostRateValue.HasValue && costRatePeriodDc.CostRateValue.Value > 0) + bDataContract.CostRatePeriods.Add(costRatePeriodDc); + } + return bDataContract; } } From 19e82a26957b88fb55e7a18ee3c987261e1dbf3b Mon Sep 17 00:00:00 2001 From: Alexandra Date: Tue, 17 Aug 2021 15:31:37 +0200 Subject: [PATCH 4/8] =?UTF-8?q?Mit=20=C3=A4nderbarem=20Preis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/ViewModel/ListViewModel/PreisListVM.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/BeWo/ViewModel/ListViewModel/PreisListVM.cs b/BeWo/ViewModel/ListViewModel/PreisListVM.cs index a67138657..32456ee1d 100644 --- a/BeWo/ViewModel/ListViewModel/PreisListVM.cs +++ b/BeWo/ViewModel/ListViewModel/PreisListVM.cs @@ -1,7 +1,5 @@ using System.Collections.Generic; -using BS.Shared; -using BS.Shared.Core; using BS.Shared.DataContracts; namespace BeWo.ViewModel.ListViewModel From 862226d5019d9925ca9ce294ec69134020c984a8 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Tue, 17 Aug 2021 15:32:01 +0200 Subject: [PATCH 5/8] =?UTF-8?q?Mit=20=C3=A4nderbarem=20Preis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Shared/DataContracts/PreisDC.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Shared/DataContracts/PreisDC.cs b/Shared/DataContracts/PreisDC.cs index 62a5eee6f..ac649d2af 100644 --- a/Shared/DataContracts/PreisDC.cs +++ b/Shared/DataContracts/PreisDC.cs @@ -10,6 +10,9 @@ namespace BS.Shared.DataContracts { private List _CostRatePeriods; + [DataMember] + public bool IsSystemEntry { get; set; } + [DataMember] public long? PreisOid { get; set; } @@ -63,24 +66,20 @@ namespace BS.Shared.DataContracts return GetType().Name.GetHashCode() ^ PreisOid.GetHashCode(); } + [DataMember] + public bool IsDefault { get; set; } + public bool DoNotCheckOverlapping { get; set; } [DataMember] public List CostRatePeriods { - get - { - return this._CostRatePeriods ?? (this._CostRatePeriods = new List()); - } + get => this._CostRatePeriods ?? (this._CostRatePeriods = new List()); - set - { - this._CostRatePeriods = value; - } + set => this._CostRatePeriods = value; } - [DataMember] public ActivationTypeId ActivationType { get; set; } } From 785aae4d9a1fbe39819471348281048836e91b75 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Tue, 17 Aug 2021 15:32:30 +0200 Subject: [PATCH 6/8] =?UTF-8?q?Mit=20=C3=A4nderbarem=20Preis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/DCEntityMapper/PreisDC_Preis.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Service/DCEntityMapper/PreisDC_Preis.cs b/Service/DCEntityMapper/PreisDC_Preis.cs index f59e98518..86049ab3c 100644 --- a/Service/DCEntityMapper/PreisDC_Preis.cs +++ b/Service/DCEntityMapper/PreisDC_Preis.cs @@ -23,6 +23,7 @@ namespace BeWo.Service.DCEntityMapper bDataContract.PreisSystemEntryID = bEntity.SystemEntryID; bDataContract.Name = bEntity.Name; bDataContract.Betrag = bEntity.Betrag; + bDataContract.IsSystemEntry = bEntity.SystemEntryID != null; bDataContract.DoNotCheckOverlapping = bEntity.DoNotCheckOverlapping.HasValue && bEntity.DoNotCheckOverlapping.Value; bDataContract.ActivationType = bEntity.IsActive; bDataContract.CostRatePeriods = MapperFactory.CostRatePeriodDC_CostRatePeriod.MapToNewDCs(bEntity.CostRatePeriods); @@ -45,7 +46,7 @@ namespace BeWo.Service.DCEntityMapper MapperFactory.CostRatePeriodDC_CostRatePeriod.MergeWithEntitys(bDataContract.CostRatePeriods, bEntity.CostRatePeriods); foreach (var costRatePeriod in bEntity.CostRatePeriods) { - costRatePeriod.ObjectTid = TableID.ServiceDescription; + costRatePeriod.ObjectTid = TableID.Preis; } return bEntity; From 4f40b22f75e5c54f530f3b7708b2dd93ef8cb922 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Tue, 17 Aug 2021 15:52:30 +0200 Subject: [PATCH 7/8] =?UTF-8?q?Preis=20aufger=C3=A4umt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeWo/View/Detail/PreisView.xaml | 45 ++++++++++++++------- BeWo/View/Detail/PreisView.xaml.cs | 9 ++--- BeWo/ViewModel/PreisVM.cs | 52 ------------------------- Data/Entities/Preis.cs | 50 ++++++++---------------- Service/DCEntityMapper/PreisDC_Preis.cs | 8 ++-- Service/Plugins/PluginLoader.cs | 12 +++--- Shared/DataContracts/PreisDC.cs | 3 -- 7 files changed, 62 insertions(+), 117 deletions(-) diff --git a/BeWo/View/Detail/PreisView.xaml b/BeWo/View/Detail/PreisView.xaml index 8b952fd83..9c39d040a 100644 --- a/BeWo/View/Detail/PreisView.xaml +++ b/BeWo/View/Detail/PreisView.xaml @@ -10,28 +10,48 @@ Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True"> - + - - + - + - + + + + + + + + + + - - + + + + + + + + + + + + -