MH: VKM Hamm Doku 10 min in Zukunft speichern

This commit is contained in:
2024-12-23 13:58:38 +01:00
parent 8eeb099b9a
commit 1a5111a78e
2 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Service.Plugins;
using BS.Shared;
using BS.Shared.DataContracts;
namespace VkmHamm.Validation
{
public class CustomServiceRecordValidator : ServiceRecordValidator
{
public override bool CheckZukunft()
{
return false;
}
public override List<ServiceRecordValidationResultDC> ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statistics,
int maxDaysEditServiceRecordsAllowed, IList<long> employeeOids, IList<long> cb2scOids)
{
var list = base.ValidateServiceRecord(newServiceRecord, statistics, maxDaysEditServiceRecordsAllowed, employeeOids, cb2scOids);
if (newServiceRecord.End.HasValue && newServiceRecord.End.Value > DateTime.Now.AddMinutes(10))
{
list.Add(new ServiceRecordValidationResultDC
{
ResultType = ServiceRecordValidationResult.Custom,
Message = "Das Ende des dokumentierten Termins darf nicht mehr als 10 Minuten in der Zukunft liegen."
});
}
return list;
}
}
}

View File

@@ -163,6 +163,7 @@
<DependentUpon>Teamstundenkonto.cs</DependentUpon>
</Compile>
<Compile Include="Translation\TranslationDictionary.cs" />
<Compile Include="Validation\ServiceRecordValidator.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Data\Data.csproj">