71 lines
2.8 KiB
C#
71 lines
2.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Security;
|
|
using BeWo.Service.Plugins;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts.Compact;
|
|
|
|
namespace SozialeDienstleistungenBeckerReports.Service
|
|
{
|
|
public class CustomHomeContentGenerator : HomeContentGenerator
|
|
{
|
|
public override List<CompactSupportConceptDC> GetExpiringSupportConcepts(long? employeeOid, DateTime expiredUntil)
|
|
{
|
|
List<CompactSupportConceptDC> result = new List<CompactSupportConceptDC>();
|
|
var cs = new CustomerService();
|
|
|
|
var loggedInUser = UserRightHelper.GetLoggedInUser();
|
|
if (loggedInUser.UserGroups != null && loggedInUser.UserGroups.Count > 0)
|
|
{
|
|
if (loggedInUser.UserGroups.Count == 1)
|
|
{
|
|
if (loggedInUser.UserGroups[0].Name.ToLower().Trim().Contains("admin"))
|
|
{
|
|
var list = DAOFactory.SearchDAO.FindExpiringSupportConcepts(null, DateTime.Now.Date, expiredUntil);
|
|
|
|
foreach (var sc in list)
|
|
{
|
|
foreach (var c2s in sc.CostBearer2SupportConceptList)
|
|
{
|
|
var fsc = cs.CreateFlatSupportConcept(sc, c2s);
|
|
if (fsc.EndDate.HasValue && fsc.EndDate.Value >= DateTime.Now.Date && fsc.EndDate.Value <= expiredUntil)
|
|
{
|
|
result.Add(fsc);
|
|
}
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
else if (loggedInUser.UserGroups.Count > 1)
|
|
{
|
|
if (loggedInUser.UserGroups.Any(u => u.Name.ToLower().Trim().Contains("admin")))
|
|
{
|
|
var list = DAOFactory.SearchDAO.FindExpiringSupportConcepts(null, DateTime.Now.Date, expiredUntil);
|
|
|
|
foreach (var sc in list)
|
|
{
|
|
foreach (var c2s in sc.CostBearer2SupportConceptList)
|
|
{
|
|
var fsc = cs.CreateFlatSupportConcept(sc, c2s);
|
|
if (fsc.EndDate.HasValue && fsc.EndDate.Value >= DateTime.Now.Date && fsc.EndDate.Value <= expiredUntil)
|
|
{
|
|
result.Add(fsc);
|
|
}
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
|
|
return base.GetExpiringSupportConcepts(employeeOid, expiredUntil);
|
|
}
|
|
}
|
|
}
|