258 lines
8.1 KiB
C#
258 lines
8.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Kreta.DataAccess.Interfaces;
|
|
using Kreta.Framework;
|
|
using Kreta.Framework.Actions;
|
|
using Kreta.Framework.Collections;
|
|
using Kreta.Framework.Collections.Generic;
|
|
using Kreta.Framework.Entities;
|
|
using Kreta.Framework.Entities.Generic;
|
|
using Kreta.Framework.Exceptions;
|
|
|
|
namespace SDA.Kreta.Entities
|
|
{
|
|
/// <summary>
|
|
/// Az UML modell ConfigTipus entitásának megvalósítása.
|
|
/// </summary>
|
|
/// <remarks>A kód teljes egészében generált, kézi módosítása nem megengedett!</remarks>
|
|
[Entity("ConfigTipus")]
|
|
// alapértelmezett EntityHistoryMode
|
|
public class ConfigTipus : Entity, IConfigTipus
|
|
{
|
|
internal protected ConfigTipus()
|
|
: base()
|
|
{
|
|
}
|
|
|
|
public class AttributeInfo
|
|
{
|
|
public const string Config = "Config";
|
|
public const string Modul = "Modul";
|
|
}
|
|
|
|
public class AttributeLengthInfo
|
|
{
|
|
public const int ConfigLength = 80;
|
|
public const int ModulLength = 80;
|
|
}
|
|
|
|
#region General
|
|
private ConfigTipusDA m_DA = new ConfigTipusDA();
|
|
|
|
protected static ConfigTipus FakeConfigTipus { get; set; }
|
|
|
|
public static ConfigTipus GiveAnInstance()
|
|
{
|
|
ConfigTipus result = FakeConfigTipus == null
|
|
? new ConfigTipus()
|
|
: (ConfigTipus)FakeConfigTipus.MemberwiseClone();
|
|
result.Reset();
|
|
result.SetDefaultData();
|
|
|
|
return result;
|
|
}
|
|
|
|
protected void SetDefaultData()
|
|
{
|
|
}
|
|
|
|
protected override IEntityDataAccessor GetDataAccessor() { return m_DA; }
|
|
protected internal virtual IEntityDataAccessor InheritedDA { get { return null; } }
|
|
|
|
[Obsolete("Ezt ne használjátok, mert mindenhova bele kellene fogalmazni a tanév szűrést is! Meg fog majd szűnni!")]
|
|
public static IEntityCollection<ConfigTipus> LoadAll()
|
|
{
|
|
return LoadWithFilter("");
|
|
}
|
|
|
|
[Obsolete("Ezt ne használjátok, mert mindenhova bele kellene fogalmazni a tanév szűrést is! Meg fog majd szűnni!")]
|
|
public static IEntityCollection<ConfigTipus> LoadAll(ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
|
|
{
|
|
return LoadWithFilter("", columnFilterMode, columns);
|
|
}
|
|
|
|
[Obsolete("Ezt ne használjátok, mert mindenhova bele kellene fogalmazni a tanév szűrést is! Meg fog majd szűnni!")]
|
|
public static IEntityCollection<ConfigTipus> LoadWithFilter(string filter, Dictionary<string, object> commandParameters = null)
|
|
{
|
|
var result = new EntityCollection<ConfigTipus>();
|
|
new ConfigTipusDA().LoadWithFilter(result, filter, commandParameters);
|
|
return result;
|
|
}
|
|
|
|
[Obsolete("Ezt ne használjátok, mert mindenhova bele kellene fogalmazni a tanév szűrést is! Meg fog majd szűnni!")]
|
|
public static IEntityCollection<ConfigTipus> LoadWithFilter(string filter, ColumnFilterMode columnFilterMode, IEnumerable<string> columns, Dictionary<string, object> commandParameters = null)
|
|
{
|
|
var result = new EntityCollection<ConfigTipus>();
|
|
new ConfigTipusDA().LoadWithFilter(result, filter, columnFilterMode, columns, commandParameters);
|
|
return result;
|
|
}
|
|
|
|
protected override void StoreOriginalValues()
|
|
{
|
|
base.StoreOriginalValues();
|
|
OriginalValues.Add("Config", (object)m_Config);
|
|
OriginalValues.Add("Modul", (object)m_Modul);
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region Ellenőrzés
|
|
|
|
protected override void Validate(bool skipValidateAttributes = false)
|
|
{
|
|
base.Validate();
|
|
|
|
if (!skipValidateAttributes)
|
|
{
|
|
// korlátos hosszúságú mezők ellenőrzése...
|
|
if (m_Config != null && m_Config.Length > 80)
|
|
{
|
|
throw new InvalidEntityAttributeException("ConfigTipus", "Config", EntityAttributeError.TooLong);
|
|
}
|
|
if (m_Modul != null && m_Modul.Length > 80)
|
|
{
|
|
throw new InvalidEntityAttributeException("ConfigTipus", "Modul", EntityAttributeError.TooLong);
|
|
}
|
|
|
|
}
|
|
|
|
// kötelező asszociációk ellenőrzése...
|
|
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Alaphelyzetbe állítás
|
|
protected override void Reset()
|
|
{
|
|
base.Reset();
|
|
|
|
// alaphelyzetbe állítjuk az egyszerű mezőket
|
|
this.m_Config = "";
|
|
this.m_Modul = "";
|
|
|
|
// alaphelyzetbe állítjuk az asszociációkból származó mezőket
|
|
this.m_IntezmenyConfig = null; // EntityCollection
|
|
}
|
|
|
|
#endregion
|
|
|
|
protected override void DeAssociateBeforeDelete(bool runHandler = false)
|
|
{
|
|
// Nem kaszkád törölhető asszociációk ellenőrzése, hogy üresek-e...
|
|
|
|
if (this.IntezmenyConfig.Count > 0)
|
|
{
|
|
throw new EntityDeleteFailedException("ConfigTipus", "IntezmenyConfig", EntityUtil.GetAssociationDescription("T_INTEZMENYCONFIG_OSSZES", "C_CONFIGTIPUSID")); // nincs kapcsolotabla
|
|
}
|
|
|
|
// kaszkád törlések...
|
|
|
|
}
|
|
|
|
#region Mezők és tulajdonságok
|
|
|
|
#region Egyszerű mezők
|
|
|
|
#region Config
|
|
|
|
protected internal string m_Config;
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
[EntityProperty("Config", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
|
|
public virtual string Config
|
|
{
|
|
get
|
|
{
|
|
return m_Config;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_Config == value) return;
|
|
m_Config = value;
|
|
FieldModified("Config", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Modul
|
|
|
|
protected internal string m_Modul;
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
[EntityProperty("Modul", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
|
|
public virtual string Modul
|
|
{
|
|
get
|
|
{
|
|
return m_Modul;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_Modul == value) return;
|
|
m_Modul = value;
|
|
FieldModified("Modul", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Asszociációkkal kapcsolatos dolgok
|
|
|
|
protected internal virtual bool LoadByIntezmenyConfigId(int id)
|
|
{
|
|
return m_DA.LoadByIntezmenyConfigId(id, this);
|
|
}
|
|
|
|
#region ConfigTipus (1) -> IntezmenyConfig (*)
|
|
protected IAssociatedEntityCollection<IntezmenyConfig> m_IntezmenyConfig = null;
|
|
|
|
IReadOnlyList<IIntezmenyConfig> IConfigTipus.IntezmenyConfig => IntezmenyConfig.Cast<IIntezmenyConfig>().ToList();
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Az UML modellben szereplő ConfigTipus és IntezmenyConfig entitások közötti asszociáció megvalósítása.
|
|
/// </remarks>
|
|
[EntityProperty("IntezmenyConfig", EntityPropertyBaseType.EntityCollection, typeof(IAssociatedEntityCollection<IntezmenyConfig>), EntityCopyMethod.DeepCopy, "ConfigTipusId")]
|
|
public virtual IAssociatedEntityCollection<IntezmenyConfig> IntezmenyConfig
|
|
{
|
|
get
|
|
{
|
|
if (m_IntezmenyConfig == null)
|
|
{
|
|
m_IntezmenyConfig = new AssociatedEntityCollection<ConfigTipus, IntezmenyConfig>(
|
|
new ConfigTipus_IntezmenyConfig_DA(this)
|
|
);
|
|
m_IntezmenyConfig.Load();
|
|
}
|
|
return m_IntezmenyConfig;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|