66 lines
2.5 KiB
C#
66 lines
2.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BeWo.Data;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Service.DCEntityMapper;
|
|
using BeWo.Service.Plugins;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace DomizielAnsbach.Service
|
|
{
|
|
public class CustomOperationService : OperationService
|
|
{
|
|
private ServiceDescription standardLeistung;
|
|
private ServiceDescription pausenLeistung;
|
|
|
|
public override List<ServiceRecord> ErstelleStundenplanEintraege(DateTime start, DateTime ende, CostBearer2SupportConcept c2s, VacationService vs)
|
|
{
|
|
SetzeStandardLeistungen(c2s);
|
|
return base.ErstelleStundenplanEintraege(start, ende, c2s, vs);
|
|
}
|
|
protected override IList<ServiceRecord> CreateServiceRecords(Arbeitszeit arbeitszeit, DateTime datum, CostBearer2SupportConcept c2s, ServiceDescription defaultSd)
|
|
{
|
|
return base.CreateServiceRecords(arbeitszeit, datum, c2s, defaultSd);
|
|
}
|
|
public override ServiceRecord CreateServiceRecord(ArbeitszeitEintrag ae, DateTime datum, CostBearer2SupportConcept c2s, ServiceDescription defaultSd)
|
|
{
|
|
var sr = base.CreateServiceRecord(ae, datum, c2s, standardLeistung);
|
|
|
|
if (ae.Notice == "Pause")
|
|
{
|
|
double dauer = Convert.ToDouble(sr.RoundedDuration);
|
|
sr.Start = new DateTime(sr.Start.Value.Year, sr.Start.Value.Month, sr.Start.Value.Day, 0, 0, 1);
|
|
sr.End = sr.Start.Value.AddMinutes(dauer);
|
|
sr.ServiceDescription = pausenLeistung;
|
|
}
|
|
return sr;
|
|
}
|
|
|
|
public void SetzeStandardLeistungen(CostBearer2SupportConcept c2s)
|
|
{
|
|
foreach (var ap in c2s.ApprovalPeriodList)
|
|
{
|
|
if (ap.ServiceCategory != null)
|
|
{
|
|
var desc = DAOFactory.SearchDAO.FindServiceDescriptionForCategory(ap.ServiceCategory.Oid.Value);
|
|
|
|
standardLeistung = desc.Where(a => a.Name == "Beschäftigungszeit").First();
|
|
pausenLeistung = desc.Where(a => a.Name == "Pause").First();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public override ServiceDescription GetDefaultServiceDescription(CostBearer2SupportConcept c2s)
|
|
{
|
|
return standardLeistung;
|
|
}
|
|
|
|
}
|
|
} |