init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
35
Kreta.DataAccessManual/EntityHandlers/TeremEntityHandler.cs
Normal file
35
Kreta.DataAccessManual/EntityHandlers/TeremEntityHandler.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Kreta.Core;
|
||||
using Kreta.Framework.Entities;
|
||||
using Kreta.Framework.Util;
|
||||
using Kreta.Resources;
|
||||
using SDA.Kreta.Entities;
|
||||
|
||||
namespace Kreta.DataAccessManual.EntityHandlers
|
||||
{
|
||||
[EntityHandler("Terem")]
|
||||
public class TeremEntityHandler : EntityHandler
|
||||
{
|
||||
public override void BeforeUpdate(Entity entity)
|
||||
{
|
||||
base.BeforeUpdate(entity);
|
||||
var terem = entity as Terem;
|
||||
if (terem.State == EntityState.Modified)
|
||||
{
|
||||
var originalSzervezetId = (int?)terem.GetOriginalValue("SzervezetId");
|
||||
if (terem.SzervezetId.IsEntityId() && originalSzervezetId.IsEntityId() && terem.SzervezetId != originalSzervezetId)
|
||||
{
|
||||
var kapcsolatok = EntityUtils.GetEntitiesConnections(new List<int> { terem.ID }, new List<string> { terem.GetEntityName() });
|
||||
if (kapcsolatok.Count > 0 && kapcsolatok[terem.ID].Count > 0)
|
||||
{
|
||||
throw new EntityDeleteFailedException(string.Format(ErrorResource.ATeremNemModosithatoMertEgyVagyTobbKapcsolodasaVanKapcsolodoTablakConnections, terem.Nev), kapcsolatok[terem.ID]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue