Files
BeWoPlaner/ReportImp/LebenshilfeStade/Service/CustomServiceRecordValidator.cs

38 lines
1.6 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 LebenshilfeStade.Service
{
public class CustomServiceRecordValidator : ServiceRecordValidator
{
public override List<ServiceRecordValidationResultDC> ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statistics, int maxDaysEditServiceRecordsAllowed, IList<long> employeeOids, IList<long> cb2scOids)
{
var validation = base.ValidateServiceRecord(newServiceRecord, statistics, maxDaysEditServiceRecordsAllowed, employeeOids, cb2scOids);
// Prüfen, dass beim Speichern der Doku bei Kategorie "Wegezeit" nur Fahrtenbuch ausgefüllt werden muss und ansonsten alles AUßER
if (newServiceRecord.Notice2.IsNullOrEmpty())
{
var res = new ServiceRecordValidationResultDC()
{
Allow = false,
EmployeeName = newServiceRecord.Employee.LastName + ", " + newServiceRecord.Employee.FirstName,
StartDate = newServiceRecord.Start.Value,
EndDate = newServiceRecord.End.Value,
ResultType = BS.Shared.ServiceRecordValidationResult.Custom,
Message = "Das Dokumentationsfeld \"Ort der Leistung\" muss ausgefüllt werden."
};
validation.Add(res);
}
return validation;
}
}
}