62 lines
2.3 KiB
C#
62 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Service.Plugins;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
using BS.Shared.Services;
|
|
|
|
namespace TemplateNeuKunde.Validation
|
|
{
|
|
|
|
//public class DefaultSaveInterceptor : SaveInterceptor
|
|
// {
|
|
// public override string AllowSaveCustomer(CustomerDC c)
|
|
// {
|
|
// if (c.CustomerOid.HasValue)
|
|
// {
|
|
// return null;
|
|
// }
|
|
|
|
// if (!c.DateOfBirth.HasValue)
|
|
// {
|
|
// return "Bitte geben Sie ein Geburtsdatum an.";
|
|
// }
|
|
|
|
// if (!String.IsNullOrWhiteSpace(c.FirstName) && !String.IsNullOrWhiteSpace(c.LastName) && c.DateOfBirth.HasValue)
|
|
// {
|
|
// var duplicates = DAOFactory.SearchDAO.FindCustomer(c.FirstName, c.LastName, c.DateOfBirth.Value);
|
|
// if (duplicates != null && duplicates.Count > 0)
|
|
// {
|
|
// var dc = duplicates[0];
|
|
// String archiviert = "";
|
|
|
|
|
|
// if (dc.Person.Sex.HasValue && dc.Person.Sex.Value == Sex.Female)
|
|
// {
|
|
// if (dc.IsActive == ActivationTypeId.Archived)
|
|
// {
|
|
// archiviert = "archivierte ";
|
|
// }
|
|
// return String.Format(
|
|
// "Es gibt bereits eine {3}Klientin {0} {1}, geb. am {2:dd.MM.yyyy}.", dc.Person.FirstName, dc.Person.LastName, dc.Person.DateOfBirth, archiviert);
|
|
// }
|
|
// else
|
|
// {
|
|
// if (dc.IsActive == ActivationTypeId.Archived)
|
|
// {
|
|
// archiviert = "archivierten ";
|
|
// }
|
|
// return String.Format(
|
|
// "Es gibt bereits einen {3}Klienten {0} {1}, geb. am {2:dd.MM.yyyy}.", dc.Person.FirstName, dc.Person.LastName, dc.Person.DateOfBirth, archiviert);
|
|
// }
|
|
// }
|
|
// }
|
|
// return base.AllowSaveCustomer(c);
|
|
// }
|
|
// }
|
|
} |