43 lines
2.1 KiB
C#
43 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BeWo.Service.Plugins;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using BS.Shared.Extensions;
|
|
using BS.Shared.Services;
|
|
|
|
namespace ChristopherusHaus.Validation
|
|
{
|
|
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, ob beim Speichern der Doku das Dokufeld "Quittierungsbeleg" eingetragen ist, wenn Leistungskategorie "Direkte Betreuung" ist.
|
|
if (newServiceRecord.ServiceDescription.Category.Abbreviation != null
|
|
&& newServiceRecord.ServiceDescription.Category.Abbreviation.ToLower().Contains("fls")
|
|
&& (newServiceRecord.ServiceDescription.Name.ToLower().Contains("betreuung in der wohnung") ||
|
|
newServiceRecord.ServiceDescription.Name.ToLower().Contains("betreuung außerhalb der wohnung") ||
|
|
newServiceRecord.ServiceDescription.Name.ToLower().Contains("telefonkontakt")) &&
|
|
newServiceRecord.Notice4.IsNullOrEmpty())
|
|
{
|
|
validation.Add(new ServiceRecordValidationResultDC()
|
|
{
|
|
Allow = false,
|
|
EmployeeName = newServiceRecord.Employee.LastName + ", " + newServiceRecord.Employee.FirstName,
|
|
StartDate = newServiceRecord.Start.Value,
|
|
EndDate = newServiceRecord.End.Value,
|
|
ResultType = ServiceRecordValidationResult.Custom,
|
|
Message = "Bei der gewählten Leistung ist Quittierungsbeleg ein Pflichtfeld, bitte füllen Sie dieses aus."
|
|
});
|
|
}
|
|
return validation;
|
|
}
|
|
}
|
|
} |