87 lines
3.0 KiB
C#
87 lines
3.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BeWo.Data;
|
|
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 TemplateNeuKunde.Validation
|
|
{
|
|
//public class CustomServiceRecordValidator : ServiceRecordValidator
|
|
//{
|
|
// public override string[] GetIgnoreCategoriesForOverlappingCheck()
|
|
// {
|
|
// return new[] { "Arbeitszeiterfassung" };
|
|
// }
|
|
|
|
|
|
// 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);
|
|
|
|
// if (newServiceRecord.ServiceDescription.Category.IsBillable && newServiceRecord.RoundedDuration == 0)
|
|
// {
|
|
|
|
// list.Add(new ServiceRecordValidationResultDC
|
|
// {
|
|
// ResultType = ServiceRecordValidationResult.Custom,
|
|
// Message = "Die Dauer muss größer als 0 sein."
|
|
// });
|
|
|
|
// }
|
|
|
|
// var sd = newServiceRecord.ServiceDescription.Name.ToLower();
|
|
// var cat = newServiceRecord.ServiceDescription.Category.Name.ToLower();
|
|
|
|
// if (cat.Contains("arztbesuch") ||
|
|
// cat.Contains("krank") ||
|
|
// cat.Contains("fortbildung") ||
|
|
// cat.Contains("urlaub") ||
|
|
// cat.Contains("indirekte zeiten") ||
|
|
// (cat.Contains("betrieb") && cat.Contains("zeiten")))
|
|
// {
|
|
// if (sd.Contains("abwesend"))
|
|
// {
|
|
|
|
// list.Add(new ServiceRecordValidationResultDC
|
|
// {
|
|
// ResultType = ServiceRecordValidationResult.Custom,
|
|
// Message = "Dieser Eintrag kann nur von Fachleitungen oder Bereichsleitungen angelegt werden."
|
|
// });
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
// bool hasZukunftResult = false;
|
|
|
|
// foreach (var r in list)
|
|
// {
|
|
// if (r.ResultType == ServiceRecordValidationResult.Custom && r.Message.Contains("Zukunft"))
|
|
// {
|
|
// hasZukunftResult = true;
|
|
// }
|
|
// }
|
|
// if (!hasZukunftResult)
|
|
// {
|
|
// if (newServiceRecord.End.Value > DateTime.Now.AddMinutes(20))
|
|
// {
|
|
// list.Add(new ServiceRecordValidationResultDC
|
|
// {
|
|
// ResultType = ServiceRecordValidationResult.Custom,
|
|
// Message = "Das gewählte Datum darf nicht in der Zukunft liegen."
|
|
// });
|
|
// }
|
|
// }
|
|
|
|
|
|
// return list;
|
|
// }
|
|
// }
|
|
} |