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 { /// /// Az UML modell ConfigTipus entitásának megvalósítása. /// /// A kód teljes egészében generált, kézi módosítása nem megengedett! [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 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 LoadAll(ColumnFilterMode columnFilterMode, IEnumerable 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 LoadWithFilter(string filter, Dictionary commandParameters = null) { var result = new EntityCollection(); 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 LoadWithFilter(string filter, ColumnFilterMode columnFilterMode, IEnumerable columns, Dictionary commandParameters = null) { var result = new EntityCollection(); 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; /// /// Nincs definiálva megjegyzés. /// [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; /// /// Nincs definiálva megjegyzés. /// [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 m_IntezmenyConfig = null; IReadOnlyList IConfigTipus.IntezmenyConfig => IntezmenyConfig.Cast().ToList(); /// /// Nincs definiálva megjegyzés. /// /// /// Az UML modellben szereplő ConfigTipus és IntezmenyConfig entitások közötti asszociáció megvalósítása. /// [EntityProperty("IntezmenyConfig", EntityPropertyBaseType.EntityCollection, typeof(IAssociatedEntityCollection), EntityCopyMethod.DeepCopy, "ConfigTipusId")] public virtual IAssociatedEntityCollection IntezmenyConfig { get { if (m_IntezmenyConfig == null) { m_IntezmenyConfig = new AssociatedEntityCollection( new ConfigTipus_IntezmenyConfig_DA(this) ); m_IntezmenyConfig.Load(); } return m_IntezmenyConfig; } } #endregion #endregion #endregion } }