36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Service.Plugins;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
using BS.Shared.Services;
|
|
|
|
namespace ShgSchwerte.Calculations
|
|
{
|
|
|
|
public class DefaultSaveInterceptor : SaveInterceptor
|
|
{
|
|
public override void BeforeSaveServiceRecord(ServiceRecord sr)
|
|
{
|
|
var duration = (decimal)sr.End.Value.Subtract(sr.Start.Value).TotalMinutes;
|
|
|
|
if (duration == 5)
|
|
{
|
|
if (sr.CostBearer2SupportConcept != null && sr.CostBearer2SupportConcept.CostBearer != null)
|
|
{
|
|
var cr = sr.CostBearer2SupportConcept.CostBearer.GetCostRatePeriodForDate(
|
|
CostRatePeriodType.MinutesIntervall, sr.Start.Value);
|
|
if (cr != null && cr.CostRateValue.HasValue && cr.CostRateValue.Value > duration)
|
|
{
|
|
sr.RoundedDuration = cr.CostRateValue.Value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
} |