44 lines
1.7 KiB
C#
44 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Service.Plugins;
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
|
|
namespace HphBersenbrueckFreizeitUndReisen.Validation
|
|
{
|
|
public class CustomServiceRecordValidator : ServiceRecordValidator
|
|
{
|
|
public override bool CheckZukunft()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
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);
|
|
|
|
string sdName = newServiceRecord.ServiceDescription.Name.ToLower();
|
|
|
|
if (sdName.Contains("kurzurlaub") || sdName.Contains("reisen") || sdName.Contains("freizeitangebote") ||
|
|
sdName.Contains("ausflüge"))
|
|
{
|
|
|
|
if (newServiceRecord.SupportConcept != null && newServiceRecord.SupportConcept.Customer != null)
|
|
{
|
|
var c = DAOFactory.GenericDAO.LoadByID<Customer>(newServiceRecord.SupportConcept.Customer.Oid.Value);
|
|
if (!c.Pflegegrad.HasValue)
|
|
{
|
|
list.Add(new ServiceRecordValidationResultDC
|
|
{
|
|
ResultType = ServiceRecordValidationResult.Custom,
|
|
Message = "Bei dem Klient ist kein Pflegegrad hinterlegt, Preis nicht ermittelbar."
|
|
});
|
|
}
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
}
|
|
} |