Files
BeWoPlaner/ReportImp/ArcheTecklenburg/CustomHomeContentGenerator.cs
Alexandra c652278a65 ArcheTecklenburg/CustomHomeContentGenerator.cs - HPs für Admin auf Startseite,
ArcheTecklenburg/Invoicing/CollectiveInvoiceCreation.cs - nochmal die doofen Abwesenheiten
2025-02-11 16:46:15 +01:00

68 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.Plugins;
using BS.Shared.DataContracts.Compact;
namespace ArcheTecklenburg
{
class SDNHomeContentGenerator : HomeContentGenerator
{
public override List<CompactSupportConceptDC> GetExpiringSupportConcepts(long? employeeOid, DateTime expiredUntil)
{
bool showAll = false;
ApplicationUser user = null;
Employee emp = null;
if (employeeOid.HasValue)
{
emp = DAOFactory.GenericDAO.LoadByID<Employee>(employeeOid.Value);
user = DAOFactory.SearchDAO.FindUserForEmployee(emp);
if (user != null)
{
foreach (var ug in user.UserGroups)
{
if (ug.Name == "Administratoren")
{
showAll = true;
}
else if (ug.Name == "Büro")
{
showAll = true;
}
else if (ug.Name == "Leitungen")
{
showAll = true;
}
}
}
}
IEnumerable<SupportConcept> result = null;
if (showAll)
{
result = DAOFactory.SearchDAO.FindExpiringSupportConcepts(null, DateTime.Now.Date, expiredUntil);
}
else
{
result = DAOFactory.SearchDAO.FindExpiringSupportConcepts(employeeOid, DateTime.Now.Date, expiredUntil);
}
List<SupportConcept> liste = new List<SupportConcept>();
foreach (var sc in result)
{
//if (!sc.RenewalSendDate.HasValue)
//{
liste.Add(sc);
//}
}
return MapperFactory.CompactSupportConceptDC_SupportConcept.MapToNewDCs(liste);
}
}
}