From 3b4c849fa13a33fc33ff93a7f86f25923f7a0d1b Mon Sep 17 00:00:00 2001 From: Waldi Date: Tue, 22 Nov 2016 14:11:31 +0100 Subject: [PATCH] Hilfeplan Fristen Aktualisiert --- BeWo/View/HomeDragPanelView.xaml | 4 +++- Data/Access/SearchDAO.cs | 8 ++++--- .../CompactCustomerDC_Customer.cs | 4 ++++ .../CompactCustomerDC_CustomerCompact.cs | 2 ++ .../CustomerServiceImp.cs | 3 +++ .../ClientPartials/CompactSupportConceptDC.cs | 21 +++++++++++++++++++ .../Compact/CompactCustomerDC.cs | 3 +++ 7 files changed, 41 insertions(+), 4 deletions(-) diff --git a/BeWo/View/HomeDragPanelView.xaml b/BeWo/View/HomeDragPanelView.xaml index c6cf9093f..290f2d661 100644 --- a/BeWo/View/HomeDragPanelView.xaml +++ b/BeWo/View/HomeDragPanelView.xaml @@ -370,9 +370,11 @@ - + + + diff --git a/Data/Access/SearchDAO.cs b/Data/Access/SearchDAO.cs index e81f986b4..89d1d2258 100644 --- a/Data/Access/SearchDAO.cs +++ b/Data/Access/SearchDAO.cs @@ -374,14 +374,16 @@ namespace BeWo.Data.Access .CreateCriteria(SupportConcept.PropertyName_CostBearer2SupportConceptList, JoinType.InnerJoin) .Add(Restrictions.Between(CostBearer2SupportConcept.PropertyName_ApprovedEndDate, DateTime.Now, expiredUntil)) .List(); - } + } return c .CreateAlias(SupportConcept.PropertyName_CostBearer2SupportConceptList, "cb2sc", JoinType.InnerJoin) .CreateAlias(SupportConcept.PropertyName_Customer, "c", JoinType.InnerJoin) - .CreateAlias("c.Employee2CustomerList", "e2c", JoinType.InnerJoin) - .Add(Restrictions.Between("cb2sc." + CostBearer2SupportConcept.PropertyName_ApprovedEndDate, DateTime.Now.Date, expiredUntil)) + .CreateAlias("c.Employee2CustomerList", "e2c", JoinType.InnerJoin) .Add(Restrictions.Eq("e2c." + Employee2Customer.PropertyName_EmployeeOid, employeeOid.Value)) + .Add(Restrictions.Or( + Restrictions.Between("cb2sc." + CostBearer2SupportConcept.PropertyName_ApprovedEndDate, DateTime.Now.Date, expiredUntil), + Restrictions.And(Restrictions.IsNotNull("c.TerminationDate"), Restrictions.Between("c.TerminationDate", DateTime.Now.Date, expiredUntil)))) .List().Distinct().ToList(); } diff --git a/Service/DCEntityMapper/CompactCustomerDC_Customer.cs b/Service/DCEntityMapper/CompactCustomerDC_Customer.cs index 9cedb56b6..e0b690d72 100644 --- a/Service/DCEntityMapper/CompactCustomerDC_Customer.cs +++ b/Service/DCEntityMapper/CompactCustomerDC_Customer.cs @@ -21,6 +21,10 @@ namespace BeWo.Service.DCEntityMapper pDataContract.Sex = pEntity.Person.Sex; pDataContract.ActivationType = pEntity.IsActive; pDataContract.TerminationDate = pEntity.TerminationDate; + + if (pEntity.TerminationReason != null) + pDataContract.TerminationReason = pEntity.TerminationReason.Value; + pDataContract.AssistanceBegin = pEntity.AssistanceBegin; pDataContract.EquityContribution = pEntity.EquityContribution; pDataContract.CustomerAlias = pEntity.CustomerAlias; diff --git a/Service/DCEntityMapper/CompactCustomerDC_CustomerCompact.cs b/Service/DCEntityMapper/CompactCustomerDC_CustomerCompact.cs index af9df1be7..f080f9479 100644 --- a/Service/DCEntityMapper/CompactCustomerDC_CustomerCompact.cs +++ b/Service/DCEntityMapper/CompactCustomerDC_CustomerCompact.cs @@ -20,6 +20,8 @@ namespace BeWo.Service.DCEntityMapper pDataContract.ActivationType = pEntity.IsActive; pDataContract.AssistanceBegin = pEntity.AssistanceBegin; pDataContract.TerminationDate = pEntity.TerminationDate; + + pDataContract.EquityContribution = pEntity.EquityContribution; pDataContract.RelatedTeamOids = pEntity.Team2CustomerList.Select(t2c => t2c.CustomerOid.Value).ToList(); pDataContract.CustomerAlias = pEntity.CustomerAlias; diff --git a/Service/ServiceImplementations/CustomerServiceImp.cs b/Service/ServiceImplementations/CustomerServiceImp.cs index 84e4c9ce2..8b168332c 100644 --- a/Service/ServiceImplementations/CustomerServiceImp.cs +++ b/Service/ServiceImplementations/CustomerServiceImp.cs @@ -1975,6 +1975,9 @@ namespace BeWo.Service.ServiceImplementations customerDC.ActivationType = cust.IsActive; customerDC.TerminationDate = cust.TerminationDate; + if (cust.TerminationReason != null) + customerDC.TerminationReason = cust.TerminationReason.Value; + if (cust.Person.Address != null) { customerDC.Street = cust.Person.Address.Street; diff --git a/Shared/DataContracts/Compact/ClientPartials/CompactSupportConceptDC.cs b/Shared/DataContracts/Compact/ClientPartials/CompactSupportConceptDC.cs index 98b460999..c0d84f9c8 100644 --- a/Shared/DataContracts/Compact/ClientPartials/CompactSupportConceptDC.cs +++ b/Shared/DataContracts/Compact/ClientPartials/CompactSupportConceptDC.cs @@ -120,6 +120,13 @@ namespace BS.Shared.DataContracts.Compact DateTime? date = this.EndDate; + if (this.Customer.TerminationDate.HasValue) + { + if (this.Customer.TerminationDate < date) + { + date = this.Customer.TerminationDate; + } + } if (date != null) { expires = date < DateTime.Now.AddMonths(BS.Shared.Settings.ApplicationSettings.SupportConceptExpirationLimitInMonths); @@ -210,6 +217,14 @@ namespace BS.Shared.DataContracts.Compact DateTime? date = this.EndDate; + if (this.Customer.TerminationDate.HasValue) + { + if (this.Customer.TerminationDate < date) + { + date = this.Customer.TerminationDate; + } + } + if (date != null) { expires = date < DateTime.Now.AddDays(7); // TODO anz Tage einstellbar machen @@ -349,6 +364,7 @@ namespace BS.Shared.DataContracts.Compact sb.Append(end.Value.ToShortDateString()); } + return sb.ToString(); } @@ -382,6 +398,11 @@ namespace BS.Shared.DataContracts.Compact cbstr.Append(to.Value.ToShortDateString()); } + if (this.Customer.TerminationDate.HasValue) + { + cbstr.Append(" ("+Customer.TerminationReason+")"); + } + if (cbstr.Length > 0) { cbstr.Append(" "); diff --git a/Shared/DataContracts/Compact/CompactCustomerDC.cs b/Shared/DataContracts/Compact/CompactCustomerDC.cs index a1c72c559..46e34fed4 100644 --- a/Shared/DataContracts/Compact/CompactCustomerDC.cs +++ b/Shared/DataContracts/Compact/CompactCustomerDC.cs @@ -130,5 +130,8 @@ namespace BS.Shared.DataContracts.Compact } set{} } + + [DataMember] + public string TerminationReason { get; set; } } } \ No newline at end of file