diff --git a/Data/Access/SearchDAO.cs b/Data/Access/SearchDAO.cs index 0ce18fd6f..58d7ebe10 100644 --- a/Data/Access/SearchDAO.cs +++ b/Data/Access/SearchDAO.cs @@ -546,6 +546,27 @@ namespace BeWo.Data.Access Restrictions.And(Restrictions.IsNotNull("c.TerminationDate"), Restrictions.Between("c.TerminationDate", minDate, expiredUntil)))) .List().Distinct().ToList(); } + public IEnumerable FindExpiringNotApprovedSupportConcepts(long? employeeOid, DateTime minDate, DateTime expiredUntil) + { + var c = CreateCriteriaIsActive(); + if (employeeOid == null) + { + return c + .CreateCriteria(SupportConcept.PropertyName_CostBearer2SupportConceptList, JoinType.InnerJoin) + .Add(Restrictions.Between(CostBearer2SupportConcept.PropertyName_RequestedEndDate, minDate, 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.Eq("e2c." + Employee2Customer.PropertyName_EmployeeOid, employeeOid.Value)) + .Add(Restrictions.Or( + Restrictions.Between("cb2sc." + CostBearer2SupportConcept.PropertyName_RequestedEndDate, minDate, expiredUntil), + Restrictions.And(Restrictions.IsNotNull("c.TerminationDate"), Restrictions.Between("c.TerminationDate", minDate, expiredUntil)))) + .List().Distinct().ToList(); + } public IEnumerable FindSupportConceptsWithConferenceDate(long? employeeOid, DateTime conferenceDateUntil) { diff --git a/Service/Plugins/HomeContentGenerator.cs b/Service/Plugins/HomeContentGenerator.cs index 73866cb11..c3e6a222d 100644 --- a/Service/Plugins/HomeContentGenerator.cs +++ b/Service/Plugins/HomeContentGenerator.cs @@ -31,6 +31,9 @@ namespace BeWo.Service.Plugins var list = MapperFactory.CompactSupportConceptDC_SupportConcept.MapToNewDCs( DAOFactory.SearchDAO.FindExpiringSupportConcepts(employeeOid, DateTime.Now.Date, expiredUntil)); + list.AddRange(MapperFactory.CompactSupportConceptDC_SupportConcept.MapToNewDCs( + DAOFactory.SearchDAO.FindExpiringNotApprovedSupportConcepts(employeeOid, DateTime.Now.Date, expiredUntil))); + return list.Where(s => s.StartDate.HasValue && s.EndDate.HasValue).ToList(); }