kreta/Kreta.DataAccessGenerated/Entities/TbJogviszony.cs
2024-03-13 00:33:46 +01:00

820 lines
26 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 TbJogviszony 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("TbJogviszony")]
// alapértelmezett EntityHistoryMode
public class TbJogviszony : Entity, ITbJogviszony
{
internal protected TbJogviszony()
: base()
{
}
public class AttributeInfo
{
public const string IsAktiv = "IsAktiv";
public const string JogvKeletkezeseJogcimTipusId = "JogvKeletkezeseJogcimTipusId";
public const string JogvMegszuneseJogcimTipusId = "JogvMegszuneseJogcimTipusId";
public const string Kezdete = "Kezdete";
public const string Megjegyzes = "Megjegyzes";
public const string TbJogviszonyTipusId = "TbJogviszonyTipusId";
public const string Vege = "Vege";
}
public class AttributeLengthInfo
{
public const int MegjegyzesLength = 150;
}
#region General
private TbJogviszonyDA m_DA = new TbJogviszonyDA();
protected static TbJogviszony FakeTbJogviszony { get; set; }
public static TbJogviszony GiveAnInstance()
{
TbJogviszony result = FakeTbJogviszony == null
? new TbJogviszony()
: (TbJogviszony)FakeTbJogviszony.MemberwiseClone();
result.Reset();
result.SetDefaultData();
return result;
}
protected void SetDefaultData()
{
if (UserContext.Instance != null)
{
if (UserContext.Instance.IntezmenyId > 0)
{
IntezmenyId = UserContext.Instance.IntezmenyId;
}
if (UserContext.Instance.AktivTanevId > 0)
{
TanevId = UserContext.Instance.AktivTanevId;
}
m_State = EntityState.Uninitialized;
}
}
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<TbJogviszony> 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<TbJogviszony> 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<TbJogviszony> LoadWithFilter(string filter, Dictionary<string, object> commandParameters = null)
{
var result = new EntityCollection<TbJogviszony>();
new TbJogviszonyDA().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<TbJogviszony> LoadWithFilter(string filter, ColumnFilterMode columnFilterMode, IEnumerable<string> columns, Dictionary<string, object> commandParameters = null)
{
var result = new EntityCollection<TbJogviszony>();
new TbJogviszonyDA().LoadWithFilter(result, filter, columnFilterMode, columns, commandParameters);
return result;
}
protected override void StoreOriginalValues()
{
base.StoreOriginalValues();
OriginalValues.Add("IsAktiv", (object)m_IsAktiv);
OriginalValues.Add("JogvKeletkezeseJogcimTipusId", (JogvKeletkezeseJogcimTipusId == null ? (object)DBNull.Value : (object)m_JogvKeletkezeseJogcimTipusId));
OriginalValues.Add("JogvMegszuneseJogcimTipusId", (JogvMegszuneseJogcimTipusId == null ? (object)DBNull.Value : (object)m_JogvMegszuneseJogcimTipusId));
OriginalValues.Add("Kezdete", (Kezdete == null ? (object)DBNull.Value : (object)m_Kezdete));
OriginalValues.Add("Megjegyzes", (Megjegyzes == null ? (object)DBNull.Value : (object)m_Megjegyzes));
OriginalValues.Add("TbJogviszonyTipusId", (TbJogviszonyTipusId == null ? (object)DBNull.Value : (object)m_TbJogviszonyTipusId));
OriginalValues.Add("Vege", (Vege == null ? (object)DBNull.Value : (object)m_Vege));
OriginalValues.Add("TanuloId", (m_TanuloId < 0 ? (object)DBNull.Value : (object)m_TanuloId));
OriginalValues.Add("IntezmenyId", (m_IntezmenyId < 0 ? (object)DBNull.Value : (object)m_IntezmenyId));
OriginalValues.Add("TanevId", (m_TanevId < 0 ? (object)DBNull.Value : (object)m_TanevId));
}
#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_Megjegyzes != null && m_Megjegyzes.Length > 150)
{
throw new InvalidEntityAttributeException("TbJogviszony", "Megjegyzes", EntityAttributeError.TooLong);
}
}
// kötelező asszociációk ellenőrzése...
if (m_TanuloId == -1) { throw new InvalidEntityAttributeException("TbJogviszony", "TanuloId", EntityAttributeError.Empty); }
if (m_IntezmenyId == -1) { throw new InvalidEntityAttributeException("TbJogviszony", "IntezmenyId", EntityAttributeError.Empty); }
if (m_TanevId == -1) { throw new InvalidEntityAttributeException("TbJogviszony", "TanevId", EntityAttributeError.Empty); }
}
#endregion
#region Alaphelyzetbe állítás
protected override void Reset()
{
base.Reset();
// alaphelyzetbe állítjuk az egyszerű mezőket
this.m_IsAktiv = true;
this.m_JogvKeletkezeseJogcimTipusId = null;
this.m_JogvMegszuneseJogcimTipusId = null;
this.m_Kezdete = null;
this.m_Megjegyzes = null;
this.m_TbJogviszonyTipusId = null;
this.m_Vege = null;
// alaphelyzetbe állítjuk az asszociációkból származó mezőket
this.m_TanuloId = -1;
this.m_Tanulo = null; // Entity
this.m_IntezmenyId = -1;
this.m_Intezmeny = null; // Entity
this.m_TanevId = -1;
this.m_Tanev = 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...
// Tanulo esetében mi mutatunk a másikra: startrole: *, endrole: 1
// Intezmeny esetében mi mutatunk a másikra: startrole: *, endrole: 1
// Tanev esetében mi mutatunk a másikra: startrole: *, endrole: 1
// kaszkád törlések...
}
#region Mezők és tulajdonságok
#region Egyszerű mezők
#region IsAktiv
protected internal bool m_IsAktiv;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("IsAktiv", EntityPropertyBaseType.ValueType, typeof(bool), EntityCopyMethod.ShallowCopy)]
public virtual bool IsAktiv
{
get
{
return m_IsAktiv;
}
set
{
CheckModifyable();
if (m_IsAktiv == value) return;
m_IsAktiv = value;
FieldModified("IsAktiv", value);
}
}
#endregion
#region JogvKeletkezeseJogcimTipusId
protected internal int? /* DictionaryItem */ m_JogvKeletkezeseJogcimTipusId;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("JogvKeletkezeseJogcimTipusId", EntityPropertyBaseType.ValueType, typeof(int /* DictionaryItem */), EntityCopyMethod.ShallowCopy)]
[EntityDictionaryItemProperty("JogvKeletkezeseJogcimTipusId", "JogvKeletkezeseJogcimTipus", typeof(SDA.Kreta.Entities.JogvKeletkezeseJogcimTipus))]
public virtual int? /* DictionaryItem */ JogvKeletkezeseJogcimTipusId
{
get
{
return m_JogvKeletkezeseJogcimTipusId;
}
set
{
CheckModifyable();
if (m_JogvKeletkezeseJogcimTipusId == value) return;
m_JogvKeletkezeseJogcimTipusId = value;
FieldModified("JogvKeletkezeseJogcimTipusId", value);
}
}
#endregion
#region JogvMegszuneseJogcimTipusId
protected internal int? /* DictionaryItem */ m_JogvMegszuneseJogcimTipusId;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("JogvMegszuneseJogcimTipusId", EntityPropertyBaseType.ValueType, typeof(int /* DictionaryItem */), EntityCopyMethod.ShallowCopy)]
[EntityDictionaryItemProperty("JogvMegszuneseJogcimTipusId", "JogvMegszuneseJogcimTipus", typeof(SDA.Kreta.Entities.JogvMegszuneseJogcimTipus))]
public virtual int? /* DictionaryItem */ JogvMegszuneseJogcimTipusId
{
get
{
return m_JogvMegszuneseJogcimTipusId;
}
set
{
CheckModifyable();
if (m_JogvMegszuneseJogcimTipusId == value) return;
m_JogvMegszuneseJogcimTipusId = value;
FieldModified("JogvMegszuneseJogcimTipusId", value);
}
}
#endregion
#region Kezdete
protected internal DateTime? m_Kezdete;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("Kezdete", EntityPropertyBaseType.ValueType, typeof(DateTime), EntityCopyMethod.ShallowCopy)]
public virtual DateTime? Kezdete
{
get
{
return m_Kezdete;
}
set
{
CheckModifyable();
if (m_Kezdete == value) return;
m_Kezdete = value;
FieldModified("Kezdete", value);
}
}
#endregion
#region Megjegyzes
protected internal string m_Megjegyzes;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("Megjegyzes", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
public virtual string Megjegyzes
{
get
{
return m_Megjegyzes;
}
set
{
CheckModifyable();
if (m_Megjegyzes == value) return;
m_Megjegyzes = value;
FieldModified("Megjegyzes", value);
}
}
#endregion
#region TbJogviszonyTipusId
protected internal int? /* DictionaryItem */ m_TbJogviszonyTipusId;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("TbJogviszonyTipusId", EntityPropertyBaseType.ValueType, typeof(int /* DictionaryItem */), EntityCopyMethod.ShallowCopy)]
[EntityDictionaryItemProperty("TbJogviszonyTipusId", "TbJogviszonyTipus", typeof(SDA.Kreta.Entities.TbJogviszonyTipus))]
public virtual int? /* DictionaryItem */ TbJogviszonyTipusId
{
get
{
return m_TbJogviszonyTipusId;
}
set
{
CheckModifyable();
if (m_TbJogviszonyTipusId == value) return;
m_TbJogviszonyTipusId = value;
FieldModified("TbJogviszonyTipusId", value);
}
}
#endregion
#region Vege
protected internal DateTime? m_Vege;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("Vege", EntityPropertyBaseType.ValueType, typeof(DateTime), EntityCopyMethod.ShallowCopy)]
public virtual DateTime? Vege
{
get
{
return m_Vege;
}
set
{
CheckModifyable();
if (m_Vege == value) return;
m_Vege = value;
FieldModified("Vege", value);
}
}
#endregion
#endregion
#region Asszociációkkal kapcsolatos dolgok
#region TbJogviszony (*) -> Tanulo (1)
protected internal int m_TanuloId = -1;
/// <summary>
/// A(z) Tanulo 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 TanuloId
{
get
{
return InternalTanuloId;
}
set
{
InternalTanuloId = value;
}
}
/// <summary>
/// Ez egy külön bejárat a DA számára
/// <summary>
internal int InternalTanuloId
{
get
{
if (m_Tanulo != null)
{
return m_Tanulo.ID;
}
else
{
return m_TanuloId;// XXX az meg nem teljesen OK
}
}
set
{
CheckModifyable();
if (m_TanuloId != value)
{
m_TanuloId = value;
m_Tanulo = null;
FieldModified("TanuloId", value);
}
}
}
/// <summary>
/// Ez egy külön bejárat a DA számára
/// <summary>
internal void ModifyTanulo(Tanulo value)
{
m_TanuloId = value != null ? value.ID : -1;
m_Tanulo = value;
FieldModified("TanuloId", value != null ? (object)value.ID : DBNull.Value);
}
protected internal void SetTanulo(Tanulo value)
{
m_Tanulo = value;
if (value != null)
{
m_TanuloId = value.ID;
}
else
{
m_TanuloId = -1;
}
}
protected Tanulo m_Tanulo = null;
ITanulo ITbJogviszony.Tanulo
{
get { return Tanulo; }
set { Tanulo = value as Tanulo; }
}
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
/// <remarks>
/// Az UML modellben szereplő TbJogviszony és Tanulo entitások közötti asszociáció megvalósítása.
/// </remarks>
[EntityProperty("Tanulo", EntityPropertyBaseType.Entity, typeof(Tanulo), EntityCopyMethod.ShallowCopy)]
public virtual Tanulo Tanulo
{
get
{
if ((m_Tanulo == null) && (m_TanuloId != -1))
{
SDA.Kreta.Entities.Tanulo partner = SDA.Kreta.Entities.Tanulo.GiveAnInstance();
partner.LoadByID(m_TanuloId);
this.SetTanulo(partner);
}
// természetesen null-t adunk vissza, ha nem tudtunk felhozni semmit
return m_Tanulo;
}
set
{
CheckModifyable();
if (value != null)
{
if ((m_Tanulo == null) || (value.ID != m_Tanulo.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.Tanulo_TbJogviszony_DA da = new Tanulo_TbJogviszony_DA(value);
da.AddItem(this);
this.SetTanulo(value);
}
else
{
this.SetTanulo(value);
}
FieldModified("TanuloId", value.ID);
}
}
else
{
// ki kell törölni a kapcsolatot az adatbázisban
this.SetTanulo(null);
UpdateAssociations();
FieldModified("TanuloId", DBNull.Value);
}
}
}
#endregion
#region TbJogviszony (*) -> Intezmeny (1)
protected internal int m_IntezmenyId = -1;
/// <summary>
/// A(z) Intezmeny 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 IntezmenyId
{
get
{
return InternalIntezmenyId;
}
set
{
InternalIntezmenyId = value;
}
}
/// <summary>
/// Ez egy külön bejárat a DA számára
/// <summary>
internal int InternalIntezmenyId
{
get
{
if (m_Intezmeny != null)
{
return m_Intezmeny.ID;
}
else
{
return m_IntezmenyId;// XXX az meg nem teljesen OK
}
}
set
{
CheckModifyable();
if (m_IntezmenyId != value)
{
m_IntezmenyId = value;
m_Intezmeny = null;
FieldModified("IntezmenyId", value);
}
}
}
/// <summary>
/// Ez egy külön bejárat a DA számára
/// <summary>
internal void ModifyIntezmeny(Intezmeny value)
{
m_IntezmenyId = value != null ? value.ID : -1;
m_Intezmeny = value;
FieldModified("IntezmenyId", value != null ? (object)value.ID : DBNull.Value);
}
protected internal void SetIntezmeny(Intezmeny value)
{
m_Intezmeny = value;
if (value != null)
{
m_IntezmenyId = value.ID;
}
else
{
m_IntezmenyId = -1;
}
}
protected Intezmeny m_Intezmeny = null;
IIntezmeny ITbJogviszony.Intezmeny
{
get { return Intezmeny; }
set { Intezmeny = value as Intezmeny; }
}
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
/// <remarks>
/// Az UML modellben szereplő TbJogviszony és Intezmeny entitások közötti asszociáció megvalósítása.
/// </remarks>
[EntityProperty("Intezmeny", EntityPropertyBaseType.Entity, typeof(Intezmeny), EntityCopyMethod.ShallowCopy)]
public virtual Intezmeny Intezmeny
{
get
{
if ((m_Intezmeny == null) && (m_IntezmenyId != -1))
{
SDA.Kreta.Entities.Intezmeny partner = SDA.Kreta.Entities.Intezmeny.GiveAnInstance();
partner.LoadByID(m_IntezmenyId);
this.SetIntezmeny(partner);
}
// természetesen null-t adunk vissza, ha nem tudtunk felhozni semmit
return m_Intezmeny;
}
set
{
CheckModifyable();
if (value != null)
{
if ((m_Intezmeny == null) || (value.ID != m_Intezmeny.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_TbJogviszony_DA da = new Intezmeny_TbJogviszony_DA(value);
da.AddItem(this);
this.SetIntezmeny(value);
}
else
{
this.SetIntezmeny(value);
}
FieldModified("IntezmenyId", value.ID);
}
}
else
{
// ki kell törölni a kapcsolatot az adatbázisban
this.SetIntezmeny(null);
UpdateAssociations();
FieldModified("IntezmenyId", DBNull.Value);
}
}
}
#endregion
#region TbJogviszony (*) -> Tanev (1)
protected internal int m_TanevId = -1;
/// <summary>
/// A(z) Tanev 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 TanevId
{
get
{
return InternalTanevId;
}
set
{
InternalTanevId = value;
}
}
/// <summary>
/// Ez egy külön bejárat a DA számára
/// <summary>
internal int InternalTanevId
{
get
{
if (m_Tanev != null)
{
return m_Tanev.ID;
}
else
{
return m_TanevId;// XXX az meg nem teljesen OK
}
}
set
{
CheckModifyable();
if (m_TanevId != value)
{
m_TanevId = value;
m_Tanev = null;
FieldModified("TanevId", value);
}
}
}
/// <summary>
/// Ez egy külön bejárat a DA számára
/// <summary>
internal void ModifyTanev(Tanev value)
{
m_TanevId = value != null ? value.ID : -1;
m_Tanev = value;
FieldModified("TanevId", value != null ? (object)value.ID : DBNull.Value);
}
protected internal void SetTanev(Tanev value)
{
m_Tanev = value;
if (value != null)
{
m_TanevId = value.ID;
}
else
{
m_TanevId = -1;
}
}
protected Tanev m_Tanev = null;
ITanev ITbJogviszony.Tanev
{
get { return Tanev; }
set { Tanev = value as Tanev; }
}
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
/// <remarks>
/// Az UML modellben szereplő TbJogviszony és Tanev entitások közötti asszociáció megvalósítása.
/// </remarks>
[EntityProperty("Tanev", EntityPropertyBaseType.Entity, typeof(Tanev), EntityCopyMethod.ShallowCopy)]
public virtual Tanev Tanev
{
get
{
if ((m_Tanev == null) && (m_TanevId != -1))
{
SDA.Kreta.Entities.Tanev partner = SDA.Kreta.Entities.Tanev.GiveAnInstance();
partner.LoadByID(m_TanevId);
this.SetTanev(partner);
}
// természetesen null-t adunk vissza, ha nem tudtunk felhozni semmit
return m_Tanev;
}
set
{
CheckModifyable();
if (value != null)
{
if ((m_Tanev == null) || (value.ID != m_Tanev.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_TbJogviszony_DA da = new Tanev_TbJogviszony_DA(value);
da.AddItem(this);
this.SetTanev(value);
}
else
{
this.SetTanev(value);
}
FieldModified("TanevId", value.ID);
}
}
else
{
// ki kell törölni a kapcsolatot az adatbázisban
this.SetTanev(null);
UpdateAssociations();
FieldModified("TanevId", DBNull.Value);
}
}
}
#endregion
#endregion
#endregion
}
}