DiakoniewerkEssen/Validation/ServiceRecordValidator.cs Pflichfeld Doku nur für nicht Arbeitszeit, Zukunft schon bei 1 min nach jetzt starten
SupportOID=169166
This commit is contained in:
@@ -114,6 +114,7 @@
|
|||||||
<Compile Include="Reporting\ServiceInvoiceReport67.Designer.cs">
|
<Compile Include="Reporting\ServiceInvoiceReport67.Designer.cs">
|
||||||
<DependentUpon>ServiceInvoiceReport67.cs</DependentUpon>
|
<DependentUpon>ServiceInvoiceReport67.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Validation\ServiceRecordValidator.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Data\Data.csproj">
|
<ProjectReference Include="..\..\Data\Data.csproj">
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using BeWo.Data.Access;
|
||||||
|
using BeWo.Data.Entities;
|
||||||
|
using BeWo.Service.DCEntityMapper;
|
||||||
|
using BeWo.Service.Plugins;
|
||||||
|
using BS.Shared;
|
||||||
|
using BS.Shared.DataContracts;
|
||||||
|
using BS.Shared.Extensions;
|
||||||
|
|
||||||
|
namespace DiakonieWerkEssen.Validation
|
||||||
|
{
|
||||||
|
public class BetreuwoServiceRecordValidator : ServiceRecordValidator
|
||||||
|
{
|
||||||
|
public override List<ServiceRecordValidationResultDC> ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statistics,
|
||||||
|
int maxDaysEditServiceRecordsAllowed, IList<long> employeeOids, IList<long> cb2scOids)
|
||||||
|
{
|
||||||
|
var result = base.ValidateServiceRecord(newServiceRecord, statistics, maxDaysEditServiceRecordsAllowed, employeeOids, cb2scOids);
|
||||||
|
bool hasZukunftResult = false;
|
||||||
|
|
||||||
|
foreach (var r in result)
|
||||||
|
{
|
||||||
|
if (r.ResultType == ServiceRecordValidationResult.Custom && r.Message.Contains("Zukunft"))
|
||||||
|
{
|
||||||
|
hasZukunftResult = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!hasZukunftResult)
|
||||||
|
{
|
||||||
|
if (newServiceRecord.Start.Value > DateTime.Now)
|
||||||
|
{
|
||||||
|
result.Add(new ServiceRecordValidationResultDC
|
||||||
|
{
|
||||||
|
ResultType = ServiceRecordValidationResult.Custom,
|
||||||
|
Message = "Das gewählte Datum darf nicht in der Zukunft liegen."
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dokumentationsfeld ist Pflicht - außer bei Arbeitszeiterfassung
|
||||||
|
if (!newServiceRecord.ServiceDescription.Category.Name.ToLower().Contains("arbeitszeiterfassung"))
|
||||||
|
{
|
||||||
|
if (newServiceRecord.Notice.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
result.Add(new ServiceRecordValidationResultDC
|
||||||
|
{
|
||||||
|
Allow = false,
|
||||||
|
EmployeeName = newServiceRecord.Employee.LastName + ", " + newServiceRecord.Employee.FirstName,
|
||||||
|
StartDate = newServiceRecord.Start.Value,
|
||||||
|
EndDate = newServiceRecord.End.Value,
|
||||||
|
ResultType = ServiceRecordValidationResult.Custom,
|
||||||
|
Message = "Das Dokumentationsfeld muss ausgefüllt werden."
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user