72 lines
2.0 KiB
C#
72 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Service.DCEntityMapper;
|
|
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using BS.Shared.Extensions;
|
|
using BS.Shared.Services;
|
|
using BeWo.Service.Configuration;
|
|
using BeWo.Data.Security;
|
|
|
|
using SecurityUtils = BeWo.Service.Security.SecurityUtils;
|
|
using BeWo.Service.ServiceImplementations;
|
|
|
|
namespace BeWo.Service.Plugins
|
|
{
|
|
public class SupportConceptValidator
|
|
{
|
|
public virtual List<ValidationResultDC> ValidateSupportConcept(SupportConceptDC supportConcept)
|
|
{
|
|
var result = new List<ValidationResultDC>();
|
|
|
|
bool isNew = !supportConcept.SupportConceptOid.HasValue;
|
|
|
|
|
|
// 1. Prüfe Datumsbereiche. Startdatum darf nicht größer als Enddatum sein
|
|
|
|
//ValidationResultDC resultDc = new ValidationResultDC();
|
|
//resultDc.Message = "Alles doof! Darfst nicht speichern!";
|
|
//resultDc.AllowSave = true;
|
|
// result.Add(resultDc);
|
|
|
|
return result;
|
|
}
|
|
|
|
public virtual List<ValidationResultDC> ValidateSupportConceptDeletion(long supportConceptOid)
|
|
{
|
|
var result = new List<ValidationResultDC>();
|
|
|
|
var os = new OperationsServiceImp();
|
|
|
|
var list = os.GetSupportConceptInfosForSupportConceptOid(supportConceptOid);
|
|
|
|
if (list != null && list.Count > 0)
|
|
{
|
|
var containsServiceRecords = false;
|
|
foreach (var info in list.Where(info => info.RecordedHours > 0))
|
|
{
|
|
containsServiceRecords = true;
|
|
}
|
|
|
|
if (containsServiceRecords)
|
|
{
|
|
|
|
ValidationResultDC resultDc = new ValidationResultDC();
|
|
resultDc.Message = "Für den gewählten Hilfeplan wurden bereits Leistungen hinterlegt.";
|
|
resultDc.AllowSave = true;
|
|
result.Add(resultDc);
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
}
|
|
} |