78 lines
2.4 KiB
C#
78 lines
2.4 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 DerKarrenSbd
|
|
{
|
|
class CustomHomeContentGenerator : HomeContentGenerator
|
|
{
|
|
public override List<CompactSupportConceptDC> GetExpiringSupportConcepts(long? employeeOid, DateTime expiredUntil)
|
|
{
|
|
Employee emp = null;
|
|
|
|
if (employeeOid.HasValue)
|
|
{
|
|
emp = DAOFactory.GenericDAO.LoadByID<Employee>(employeeOid.Value);
|
|
}
|
|
|
|
|
|
IEnumerable<SupportConcept> result = DAOFactory.SearchDAO.FindExpiringSupportConcepts(null, DateTime.Now.AddYears(-1), expiredUntil);
|
|
|
|
if (emp.LeadingTeams.Count > 0)
|
|
{
|
|
Dictionary<long, long> teamEmployeeDict = new Dictionary<long, long>();
|
|
teamEmployeeDict.Add(employeeOid.Value, employeeOid.Value);
|
|
foreach (var team in emp.LeadingTeams)
|
|
{
|
|
foreach (var member in team.MemberList)
|
|
{
|
|
if (!teamEmployeeDict.ContainsKey(member.Oid.Value))
|
|
{
|
|
teamEmployeeDict.Add(member.Oid.Value, member.Oid.Value);
|
|
}
|
|
}
|
|
}
|
|
|
|
List<SupportConcept> listeTemp = new List<SupportConcept>();
|
|
foreach (var sc in result)
|
|
{
|
|
bool add = false;
|
|
foreach (var e2c in sc.Customer.Employee2CustomerList)
|
|
{
|
|
if (teamEmployeeDict.ContainsKey(e2c.EmployeeOid.Value))
|
|
{
|
|
add = true;
|
|
}
|
|
}
|
|
|
|
if (add)
|
|
{
|
|
listeTemp.Add(sc);
|
|
}
|
|
}
|
|
|
|
result = listeTemp;
|
|
}
|
|
|
|
|
|
List<SupportConcept> liste = new List<SupportConcept>();
|
|
foreach (var sc in result)
|
|
{
|
|
if (!sc.RenewalSendDate.HasValue)
|
|
{
|
|
liste.Add(sc);
|
|
}
|
|
}
|
|
|
|
|
|
return MapperFactory.CompactSupportConceptDC_SupportConcept.MapToNewDCs(liste);
|
|
}
|
|
}
|
|
}
|