36 lines
1.3 KiB
C#
36 lines
1.3 KiB
C#
using BeWo.Service.Plugins;
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace AkggMid.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);
|
|
|
|
//Die Anzahl Tage im Folgemonat sollen hier immer geprüft werden. Das wird sonst nur für Kliententermine gemacht
|
|
if (!list.Any(m => m.ResultType == ServiceRecordValidationResult.OutOfEditLimit) && maxDaysEditServiceRecordsAllowed > 0)
|
|
{
|
|
if (maxDaysEditServiceRecordsAllowed > 0)
|
|
{
|
|
var dt = new DateTime(newServiceRecord.Start.Value.Year, newServiceRecord.Start.Value.Month, 1);
|
|
dt = dt.AddMonths(1);
|
|
dt = dt.AddDays(maxDaysEditServiceRecordsAllowed);
|
|
if (DateTime.Now >= dt)
|
|
list.Add(new ServiceRecordValidationResultDC
|
|
{
|
|
ResultType = ServiceRecordValidationResult.OutOfEditLimit
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
return list;
|
|
}
|
|
}
|
|
} |