75 lines
2.4 KiB
C#
75 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using BeWo.Data;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace FabEv
|
|
{
|
|
public class FabEvReportCreator : DefaultReportCreator
|
|
{
|
|
public override XtraReport CreateAuslastungReport(long? employeeOid, IList<long> teamOids, DateTime startDate, DateTime endDate)
|
|
{
|
|
IBeWoReport<MitarbeiterauslastungRO> report;
|
|
if (teamOids != null && teamOids.Count > 0)
|
|
report = FindReportImp<MitarbeiterauslastungRO>("Teamauslastung");
|
|
else
|
|
report = FindReportImp<MitarbeiterauslastungRO>("Mitarbeiterauslastung");
|
|
if (startDate.Year == 2007)
|
|
{
|
|
startDate = new DateTime(2018, startDate.Month, 1);
|
|
endDate = startDate.AddMonths(1);
|
|
}
|
|
var x = MitarbeiterauslastungRO.Create(employeeOid, teamOids, startDate, endDate);
|
|
report.SetReportDataSource(x);
|
|
|
|
return report as XtraReport;
|
|
}
|
|
|
|
public override IList<long> GetMeineKlientenOids()
|
|
{
|
|
IList<long> customerOids = new List<long>();
|
|
|
|
ApplicationUser loggedInUser = null;
|
|
|
|
if (LoggedInUserOperationContextExt.Current != null && LoggedInUserOperationContextExt.Current.User != null)
|
|
{
|
|
loggedInUser = LoggedInUserOperationContextExt.Current.User;
|
|
}
|
|
else
|
|
{
|
|
loggedInUser = SessionFacade.LoggedInUser;
|
|
}
|
|
|
|
if (loggedInUser != null && loggedInUser.Employee != null)
|
|
{
|
|
foreach (var e2c in loggedInUser.Employee.Employee2CustomerList)
|
|
{
|
|
if (e2c.Customer.IsActive == ActivationTypeId.Active)
|
|
{
|
|
foreach (var v2o in e2c.ValueList)
|
|
{
|
|
if (v2o.Entry.Type == ValueListEntryType.StaffRoleType)
|
|
{
|
|
if (!customerOids.Contains(e2c.Customer.Oid.Value))
|
|
{
|
|
customerOids.Add(e2c.Customer.Oid.Value);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return customerOids;
|
|
}
|
|
}
|
|
}
|