Files
BeWoPlaner/ReportImp/SynpraxReports/CustomSupportConceptAnalysisCreator.cs
Christian c3eb925f6b cb
2022-08-25 12:51:53 +02:00

71 lines
1.9 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;
namespace SynpraxReports
{
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)
{
var liste = base.GetSupportConceptAnalysis2(c2sOids, employeeOid, teamOid, catOid, startDate, endDate, expiredMonths, showArchivedScs);
; DateTime dt = DateTime.Now;
if (endDate.HasValue)
{
dt = endDate.Value;
}
List<SupportConceptOverviewDC> result = new List<SupportConceptOverviewDC>();
foreach (var dc in liste)
{
DateTime startdate = DateTime.MinValue;
DateTime enddate = DateTime.MaxValue;
if (dc.ApprovedStartDate.HasValue)
{
startdate = dc.ApprovedStartDate.Value;
}
else if (dc.RequestedStartDate.HasValue)
{
startdate = dc.RequestedStartDate.Value;
}
if (dc.ApprovedEndDate.HasValue)
{
enddate = dc.ApprovedEndDate.Value;
}
else if (dc.RequestedEndDate.HasValue)
{
enddate = dc.RequestedEndDate.Value;
}
if (startdate <= dt && dt <= enddate)
{
result.Add(dc);
}
}
return result;
}
}
}