This commit is contained in:
skidoodle 2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

View file

@ -0,0 +1,596 @@
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 CsoportTipus 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("CsoportTipus")]
// alapértelmezett EntityHistoryMode
public class CsoportTipus : DictionaryItemBase, ICsoportTipus
{
internal protected CsoportTipus()
: base()
{
}
public new class AttributeInfo : DictionaryItemBase.AttributeInfo
{
public const string IsTanoraiCelu = "IsTanoraiCelu";
public const string OraPerc = "OraPerc";
public const string IsMuveszeti = "IsMuveszeti";
}
public new class AttributeLengthInfo : DictionaryItemBase.AttributeLengthInfo
{
}
#region General
private CsoportTipusDA m_DA = new CsoportTipusDA();
protected static CsoportTipus FakeCsoportTipus { get; set; }
public static new CsoportTipus GiveAnInstance()
{
CsoportTipus result = FakeCsoportTipus == null
? new CsoportTipus()
: (CsoportTipus)FakeCsoportTipus.MemberwiseClone();
result.Reset();
result.SetDefaultData();
return result;
}
protected new void SetDefaultData()
{
if (UserContext.Instance != null)
{
if (UserContext.Instance.IntezmenyId > 0)
{
IntezmenyId = UserContext.Instance.IntezmenyId;
AlIntezmenyId = UserContext.Instance.IntezmenyId;
}
if (UserContext.Instance.AktivTanevId > 0)
{
TanevId = UserContext.Instance.AktivTanevId;
AlTanevId = UserContext.Instance.AktivTanevId;
}
m_State = EntityState.Uninitialized;
}
}
protected override IEntityDataAccessor GetDataAccessor() { return m_DA; }
protected internal new IEntityDataAccessor InheritedDA { get { return base.GetDataAccessor(); } }
[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 new IEntityCollection<CsoportTipus> 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 new IEntityCollection<CsoportTipus> 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 new IEntityCollection<CsoportTipus> LoadWithFilter(string filter, Dictionary<string, object> commandParameters = null)
{
var result = new EntityCollection<CsoportTipus>();
new CsoportTipusDA().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 new IEntityCollection<CsoportTipus> LoadWithFilter(string filter, ColumnFilterMode columnFilterMode, IEnumerable<string> columns, Dictionary<string, object> commandParameters = null)
{
var result = new EntityCollection<CsoportTipus>();
new CsoportTipusDA().LoadWithFilter(result, filter, columnFilterMode, columns, commandParameters);
return result;
}
protected override void StoreOriginalValues()
{
base.StoreOriginalValues();
OriginalValues.Add("IsTanoraiCelu", (object)m_IsTanoraiCelu);
OriginalValues.Add("OraPerc", (OraPerc == null ? (object)DBNull.Value : (object)m_OraPerc));
OriginalValues.Add("IsMuveszeti", (object)m_IsMuveszeti);
OriginalValues.Add("AlIntezmenyId", (m_AlIntezmenyId < 0 ? (object)DBNull.Value : (object)m_AlIntezmenyId));
OriginalValues.Add("AlTanevId", (m_AlTanevId < 0 ? (object)DBNull.Value : (object)m_AlTanevId));
}
#endregion
#region Ellenőrzés
protected override void Validate(bool skipValidateAttributes = false)
{
base.Validate();
// Védett kódtétel...
//if (m_Protected == false) { throw new InvalidEntityAttributeException("CsoportTipus", "Protected", EntityAttributeError.Unknown); }
if (m_Protected && (HasChanged("Name") || HasChanged("Code")))
{
throw new ProtectedDictionaryItemException("CsoportTipus", ID);
}
if (!skipValidateAttributes)
{
// korlátos hosszúságú mezők ellenőrzése...
}
// kötelező asszociációk ellenőrzése...
if (m_AlIntezmenyId == -1) { throw new InvalidEntityAttributeException("CsoportTipus", "AlIntezmenyId", EntityAttributeError.Empty); }
if (m_AlTanevId == -1) { throw new InvalidEntityAttributeException("CsoportTipus", "AlTanevId", EntityAttributeError.Empty); }
}
#endregion
#region Alaphelyzetbe állítás
protected override void Reset()
{
base.Reset();
// alaphelyzetbe állítjuk az egyszerű mezőket
this.m_IsTanoraiCelu = false;
this.m_OraPerc = null;
this.m_IsMuveszeti = false;
// alaphelyzetbe állítjuk az asszociációkból származó mezőket
this.m_AlIntezmenyId = -1;
this.m_AlIntezmeny = null; // Entity
this.m_AlTanevId = -1;
this.m_AlTanev = null; // Entity
}
#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.FoglalkozasTipus.Count > 0)
{
throw new EntityDeleteFailedException("CsoportTipus", "FoglalkozasTipus", EntityUtil.GetAssociationDescription("T_CSOPORTTIPUS_FOGLALKOZASTIPU_OSSZES", "C_FOGLALKOZASTIPUSID"));
}
// AlIntezmeny esetében mi mutatunk a másikra: startrole: *, endrole: 1
// AlTanev esetében mi mutatunk a másikra: startrole: *, endrole: 1
// kaszkád törlések...
base.DeAssociateBeforeDelete(runHandler);
}
#region Mezők és tulajdonságok
#region Egyszerű mezők
#region IsTanoraiCelu
protected internal bool m_IsTanoraiCelu;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("IsTanoraiCelu", EntityPropertyBaseType.ValueType, typeof(bool), EntityCopyMethod.ShallowCopy)]
public virtual bool IsTanoraiCelu
{
get
{
return m_IsTanoraiCelu;
}
set
{
CheckModifyable();
if (m_IsTanoraiCelu == value) return;
m_IsTanoraiCelu = value;
FieldModified("IsTanoraiCelu", value);
}
}
#endregion
#region OraPerc
protected internal int? m_OraPerc;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("OraPerc", EntityPropertyBaseType.ValueType, typeof(int), EntityCopyMethod.ShallowCopy)]
public virtual int? OraPerc
{
get
{
return m_OraPerc;
}
set
{
CheckModifyable();
if (m_OraPerc == value) return;
m_OraPerc = value;
FieldModified("OraPerc", value);
}
}
#endregion
#region IsMuveszeti
protected internal bool m_IsMuveszeti;
/// <summary>
/// AMI muvészeti csoport jelölo flag
/// </summary>
[EntityProperty("IsMuveszeti", EntityPropertyBaseType.ValueType, typeof(bool), EntityCopyMethod.ShallowCopy)]
public virtual bool IsMuveszeti
{
get
{
return m_IsMuveszeti;
}
set
{
CheckModifyable();
if (m_IsMuveszeti == value) return;
m_IsMuveszeti = value;
FieldModified("IsMuveszeti", value);
}
}
#endregion
#endregion
#region Asszociációkkal kapcsolatos dolgok
#region CsoportTipus (*) -> Intezmeny (1)
protected internal int m_AlIntezmenyId = -1;
/// <summary>
/// A(z) AlIntezmeny asszociáció végpontjának ID-ja.
/// </summary>
/// <remarks>
/// - Insert() előtt célszerű kitölteni
/// - Update() nincs rá hatással: ezt a mezőt nem frissíti
/// - LoadByID() felhozza ezt a mezőt
/// </remarks>
public virtual int AlIntezmenyId
{
get
{
return InternalAlIntezmenyId;
}
set
{
InternalAlIntezmenyId = value;
}
}
/// <summary>
/// Ez egy külön bejárat a DA számára
/// <summary>
internal int InternalAlIntezmenyId
{
get
{
if (m_AlIntezmeny != null)
{
return m_AlIntezmeny.ID;
}
else
{
return m_AlIntezmenyId;// XXX az meg nem teljesen OK
}
}
set
{
CheckModifyable();
if (m_AlIntezmenyId != value)
{
m_AlIntezmenyId = value;
m_AlIntezmeny = null;
FieldModified("AlIntezmenyId", value);
}
}
}
/// <summary>
/// Ez egy külön bejárat a DA számára
/// <summary>
internal void ModifyAlIntezmeny(Intezmeny value)
{
m_AlIntezmenyId = value != null ? value.ID : -1;
m_AlIntezmeny = value;
FieldModified("AlIntezmenyId", value != null ? (object)value.ID : DBNull.Value);
}
protected internal void SetAlIntezmeny(Intezmeny value)
{
m_AlIntezmeny = value;
if (value != null)
{
m_AlIntezmenyId = value.ID;
}
else
{
m_AlIntezmenyId = -1;
}
}
protected Intezmeny m_AlIntezmeny = null;
IIntezmeny ICsoportTipus.AlIntezmeny
{
get { return AlIntezmeny; }
set { AlIntezmeny = value as Intezmeny; }
}
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
/// <remarks>
/// Az UML modellben szereplő CsoportTipus és Intezmeny entitások közötti asszociáció megvalósítása.
/// </remarks>
[EntityProperty("AlIntezmeny", EntityPropertyBaseType.Entity, typeof(Intezmeny), EntityCopyMethod.ShallowCopy)]
public virtual Intezmeny AlIntezmeny
{
get
{
if ((m_AlIntezmeny == null) && (m_AlIntezmenyId != -1))
{
SDA.Kreta.Entities.Intezmeny partner = SDA.Kreta.Entities.Intezmeny.GiveAnInstance();
partner.LoadByID(m_AlIntezmenyId);
this.SetAlIntezmeny(partner);
}
// természetesen null-t adunk vissza, ha nem tudtunk felhozni semmit
return m_AlIntezmeny;
}
set
{
CheckModifyable();
if (value != null)
{
if ((m_AlIntezmeny == null) || (value.ID != m_AlIntezmeny.ID))
{
if (value.State != EntityState.Initialized)
{
throw new EntityStateException(value.State);
}
if ((this.State != EntityState.New))
{
// Lista van a másik oldalon, úgyhogy a lista DA-ját használjuk
SDA.Kreta.Entities.Intezmeny_CsoportTipus_DA da = new Intezmeny_CsoportTipus_DA(value);
da.AddItem(this);
this.SetAlIntezmeny(value);
}
else
{
this.SetAlIntezmeny(value);
}
FieldModified("AlIntezmenyId", value.ID);
}
}
else
{
// ki kell törölni a kapcsolatot az adatbázisban
this.SetAlIntezmeny(null);
UpdateAssociations();
FieldModified("AlIntezmenyId", DBNull.Value);
}
}
}
#endregion
#region CsoportTipus (*) -> Tanev (1)
protected internal int m_AlTanevId = -1;
/// <summary>
/// A(z) AlTanev asszociáció végpontjának ID-ja.
/// </summary>
/// <remarks>
/// - Insert() előtt célszerű kitölteni
/// - Update() nincs rá hatással: ezt a mezőt nem frissíti
/// - LoadByID() felhozza ezt a mezőt
/// </remarks>
public virtual int AlTanevId
{
get
{
return InternalAlTanevId;
}
set
{
InternalAlTanevId = value;
}
}
/// <summary>
/// Ez egy külön bejárat a DA számára
/// <summary>
internal int InternalAlTanevId
{
get
{
if (m_AlTanev != null)
{
return m_AlTanev.ID;
}
else
{
return m_AlTanevId;// XXX az meg nem teljesen OK
}
}
set
{
CheckModifyable();
if (m_AlTanevId != value)
{
m_AlTanevId = value;
m_AlTanev = null;
FieldModified("AlTanevId", value);
}
}
}
/// <summary>
/// Ez egy külön bejárat a DA számára
/// <summary>
internal void ModifyAlTanev(Tanev value)
{
m_AlTanevId = value != null ? value.ID : -1;
m_AlTanev = value;
FieldModified("AlTanevId", value != null ? (object)value.ID : DBNull.Value);
}
protected internal void SetAlTanev(Tanev value)
{
m_AlTanev = value;
if (value != null)
{
m_AlTanevId = value.ID;
}
else
{
m_AlTanevId = -1;
}
}
protected Tanev m_AlTanev = null;
ITanev ICsoportTipus.AlTanev
{
get { return AlTanev; }
set { AlTanev = value as Tanev; }
}
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
/// <remarks>
/// Az UML modellben szereplő CsoportTipus és Tanev entitások közötti asszociáció megvalósítása.
/// </remarks>
[EntityProperty("AlTanev", EntityPropertyBaseType.Entity, typeof(Tanev), EntityCopyMethod.ShallowCopy)]
public virtual Tanev AlTanev
{
get
{
if ((m_AlTanev == null) && (m_AlTanevId != -1))
{
SDA.Kreta.Entities.Tanev partner = SDA.Kreta.Entities.Tanev.GiveAnInstance();
partner.LoadByID(m_AlTanevId);
this.SetAlTanev(partner);
}
// természetesen null-t adunk vissza, ha nem tudtunk felhozni semmit
return m_AlTanev;
}
set
{
CheckModifyable();
if (value != null)
{
if ((m_AlTanev == null) || (value.ID != m_AlTanev.ID))
{
if (value.State != EntityState.Initialized)
{
throw new EntityStateException(value.State);
}
if ((this.State != EntityState.New))
{
// Lista van a másik oldalon, úgyhogy a lista DA-ját használjuk
SDA.Kreta.Entities.Tanev_CsoportTipus_DA da = new Tanev_CsoportTipus_DA(value);
da.AddItem(this);
this.SetAlTanev(value);
}
else
{
this.SetAlTanev(value);
}
FieldModified("AlTanevId", value.ID);
}
}
else
{
// ki kell törölni a kapcsolatot az adatbázisban
this.SetAlTanev(null);
UpdateAssociations();
FieldModified("AlTanevId", DBNull.Value);
}
}
}
#endregion
public override int TanevId
{
get
{
return base.TanevId;
}
set
{
InternalAlTanevId = value;
base.TanevId = value;
}
}
protected internal IAssociatedEntityCollection<CsoportTipus_FoglalkozasTipus> m_FoglalkozasTipus = null;
IReadOnlyList<ICsoportTipus_FoglalkozasTipus> ICsoportTipus.FoglalkozasTipus => FoglalkozasTipus.Cast<ICsoportTipus_FoglalkozasTipus>().ToList();
/// <summary>
///
/// </summary>
#region CsoportTipus (*) -> FoglalkozasTipus (*) CsoportTipus_FoglalkozasTipus
[EntityProperty("FoglalkozasTipus", EntityPropertyBaseType.EntityCollection, typeof(IAssociatedEntityCollection<CsoportTipus_FoglalkozasTipus>), EntityCopyMethod.DeepCopy, "CsoportTipusId")]
public virtual IAssociatedEntityCollection<CsoportTipus_FoglalkozasTipus> FoglalkozasTipus
{
get
{
if (m_FoglalkozasTipus == null)
{
m_FoglalkozasTipus = new AssociatedEntityCollection<CsoportTipus, CsoportTipus_FoglalkozasTipus>(
new CsoportTipus_FoglalkozasTipus_DA(this)
);
m_FoglalkozasTipus.Load();
}
return m_FoglalkozasTipus;
}
}
#endregion
#endregion
#endregion
}
}