Files
BeWoPlaner/ReportImp/Humanitas/Service/CustomServiceRecordValidator.cs
2026-07-21 12:08:19 +02:00

34 lines
1.4 KiB
C#

using BeWo.Service.Plugins;
using BS.Shared.DataContracts;
using BS.Shared.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Humanitas.Service
{
public class CustomServiceRecordValidator : ServiceRecordValidator
{
public override List<ServiceRecordValidationResultDC> ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statisticsXX, int maxDaysEditServiceRecordsAllowed, IList<long> employeeOids, IList<long> cb2scOids)
{
var list = base.ValidateServiceRecord(newServiceRecord, statisticsXX, maxDaysEditServiceRecordsAllowed, employeeOids, cb2scOids);
if (newServiceRecord.ServiceDescription.Category.IsBillable && (newServiceRecord.Start == null && newServiceRecord.End == null ||
newServiceRecord.Start.HasValue && newServiceRecord.Start.Value.Second == 1 &&
newServiceRecord.End.HasValue && newServiceRecord.End.Value.Second == 1))
{
list.Add(new ServiceRecordValidationResultDC()
{
Allow = false,
ResultType = BS.Shared.ServiceRecordValidationResult.Custom,
Message = "Sie können den Eintrag nicht speichern, ohne eine Start- und Endzeit einzugeben."
});
}
return list;
}
}
}