From 41a9e2c64f0d867a8ca3c37d0e10d3c54ce83f4e Mon Sep 17 00:00:00 2001 From: Lyndon Date: Sun, 17 Dec 2017 18:52:55 -0400 Subject: [PATCH] Verbesserter Filter des Kalenders --- Data/Access/SearchDAO.cs | 2 +- Service/ServiceImplementations/ResourceServiceImp.cs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Data/Access/SearchDAO.cs b/Data/Access/SearchDAO.cs index 82971c06b..27927881f 100644 --- a/Data/Access/SearchDAO.cs +++ b/Data/Access/SearchDAO.cs @@ -2318,7 +2318,7 @@ namespace BeWo.Data.Access return criteria.List(); } - public IEnumerable LoadFilteredAppointmentsForEmployee(bool pHasRightToSeeAllEmployeeAppointments, long pEmployeeOid, DateTime pIntervalStart, DateTime pIntervalEnd, List pSelectedEmployees, List pSelectedCustomers, List pSelectedResources, bool pEmployeesOnly, bool pCustomersOnly, bool pResourcesOnly, bool pPrivateAppointmentsOnly, bool pOnlyMyAppointments) + public IEnumerable LoadFilteredAppointmentsForEmployee(long pEmployeeOid, DateTime pIntervalStart, DateTime pIntervalEnd, List pSelectedEmployees, List pSelectedCustomers, List pSelectedResources, bool pEmployeesOnly, bool pCustomersOnly, bool pResourcesOnly, bool pPrivateAppointmentsOnly, bool pOnlyMyAppointments) { var detachedCriteria = DetachedCriteria.For() .Add(Restrictions.And(Restrictions.Eq(Employee2SchedulerAppointment.PropertyName_Employee + ".Oid", pEmployeeOid), diff --git a/Service/ServiceImplementations/ResourceServiceImp.cs b/Service/ServiceImplementations/ResourceServiceImp.cs index 5e2d6e1a8..6bd3035a1 100644 --- a/Service/ServiceImplementations/ResourceServiceImp.cs +++ b/Service/ServiceImplementations/ResourceServiceImp.cs @@ -971,9 +971,12 @@ namespace BeWo.Service.ServiceImplementations { try { - var appointments = pHasRightToSeeAllEmployeeAppointments - ? DAOFactory.SearchDAO.LoadFilteredAppointments(pHasRightToSeeAllEmployeeAppointments, pEmployeeOid, pIntervalStart, pIntervalEnd, pSelectedEmployees, pSelectedCustomer, pSelectedResources, pEmployeesOnly, pCustomersOnly, pResourcesOnly, pPrivateAppointmentsOnly, pOnlyMyAppointments) - : DAOFactory.SearchDAO.LoadFilteredAppointmentsForEmployee(pHasRightToSeeAllEmployeeAppointments, pEmployeeOid, pIntervalStart, pIntervalEnd, pSelectedEmployees, pSelectedCustomer, pSelectedResources, pEmployeesOnly, pCustomersOnly, pResourcesOnly, pPrivateAppointmentsOnly, pOnlyMyAppointments); + var appointments = DAOFactory.SearchDAO.LoadFilteredAppointmentsForEmployee(pEmployeeOid, pIntervalStart, pIntervalEnd, pSelectedEmployees, pSelectedCustomer, pSelectedResources, pEmployeesOnly, pCustomersOnly, pResourcesOnly, pPrivateAppointmentsOnly, pOnlyMyAppointments).ToList(); + + var nichtAnzuzeigendeTermineFuerAndereMitarbeiter = appointments.Where(w => + w.Originator.Oid.Value.Equals(pEmployeeOid) && w.EmployeeList.Count > 0 && !w.EmployeeList.Select(s => s.Employee.Oid.Value).Contains(pEmployeeOid) && w.EmployeeList.Select(s => s.Employee.Oid.Value).Intersect(pSelectedEmployees).ToList().Count == 0).ToList(); + + appointments = appointments.Where(w => !nichtAnzuzeigendeTermineFuerAndereMitarbeiter.Select(s => s.Oid.Value).Contains(w.Oid.Value)).ToList(); return MapperFactory.SchedulerAppointmentDCSchedulerAppointment.MapToNewDCs(appointments).OrderBy(a => a.StartDate).ToList(); }