Files
BeWoPlaner/ReportImp/SPZLeverkusen/Service/CustomSupportConceptAnalysisCreator.cs

53 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Service.DCEntityMapper;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using BS.Shared.Services;
using BeWo.Service.Configuration;
using BeWo.Service.Plugins;
using BeWo.Data;
using BeWo.Data.Security;
namespace SPZLeverkusen.Service
{
public class CustomSupportConceptAnalysisCreator : SupportConceptAnalysisCreator
{
public override List<SupportConceptOverviewDC> GetSupportConceptAnalysis2(IList<long> c2sOids, long? employeeOid, long? teamOid, long? catOid, DateTime? startDate, DateTime? endDate, int? expiredMonths, bool showArchivedScs)
{
ApplicationUser loggedInUser = UserRightHelper.GetLoggedInUser();
if ((employeeOid.HasValue && !teamOid.HasValue) || (!employeeOid.HasValue && !teamOid.HasValue))
{
if (!UserRightHelper.LoggedInUserHasRight(UserRightType.SupportConcept_ViewAllSupportConcepts) && UserRightHelper.LoggedInUserHasRight(UserRightType.SupportConcept_ViewMyTeams))
{
if (!employeeOid.HasValue)
{
employeeOid = loggedInUser.Employee.Oid;
}
var teams = DAOFactory.SearchDAO.FindAllActiveTeamsOfEmployee(employeeOid.Value);
if (teams.Count > 0)
{
var result = new List<SupportConceptOverviewDC>();
foreach (var team in teams)
{
result.AddRange(base.GetSupportConceptAnalysis2(c2sOids, employeeOid, team.Oid, catOid, startDate, endDate, expiredMonths, showArchivedScs));
}
return result;
}
}
}
return base.GetSupportConceptAnalysis2(c2sOids, employeeOid, teamOid, catOid, startDate, endDate, expiredMonths, showArchivedScs);
}
}
}