Files
BeWoPlaner/ReportImp/Lori/Plugins/CustomHomeContentGenerator.cs
2019-02-12 19:32:04 +01:00

63 lines
1.9 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 Lori
{
class CustomHomeContentGenerator : 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;
}
}
}
}
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);
}
}
}