29 lines
1.2 KiB
C#
29 lines
1.2 KiB
C#
using BeWo.Service.Plugins;
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace KcmGmbH.Service
|
|
{
|
|
public class CustomServiceRecordValidator : ServiceRecordValidator
|
|
{
|
|
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);
|
|
DateTime start = newServiceRecord.Start.Value;
|
|
bool noTime = (start.Hour == 0 && start.Minute == 0 && start.Second == 1); //Keine Zeit angegeben
|
|
var duration = (decimal)newServiceRecord.End.Value.Subtract(newServiceRecord.Start.Value).TotalMinutes;
|
|
if (noTime && duration != 0 && newServiceRecord.ServiceDescription.Category.IsBillable)
|
|
{
|
|
list.Add(new ServiceRecordValidationResultDC
|
|
{
|
|
ResultType = ServiceRecordValidationResult.Custom,
|
|
Message = "Der Zeiterfassungseintrag muss eine Startzeit haben."
|
|
});
|
|
}
|
|
return list;
|
|
}
|
|
}
|
|
} |