866 lines
28 KiB
C#
866 lines
28 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 Tanterv 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("Tanterv")]
|
|
// alapértelmezett EntityHistoryMode
|
|
public class Tanterv : Entity, ITanterv
|
|
{
|
|
internal protected Tanterv()
|
|
: base()
|
|
{
|
|
}
|
|
|
|
public class AttributeInfo
|
|
{
|
|
public const string CsoportTipusa = "CsoportTipusa";
|
|
public const string Evfolyamig = "Evfolyamig";
|
|
public const string Evfolyamtol = "Evfolyamtol";
|
|
public const string KerettantervreEpulo = "KerettantervreEpulo";
|
|
public const string Megjegyzes = "Megjegyzes";
|
|
public const string Nev = "Nev";
|
|
public const string Vedett = "Vedett";
|
|
public const string IsKerettanterv = "IsKerettanterv";
|
|
}
|
|
|
|
public class AttributeLengthInfo
|
|
{
|
|
public const int MegjegyzesLength = 255;
|
|
public const int NevLength = 255;
|
|
}
|
|
|
|
#region General
|
|
private TantervDA m_DA = new TantervDA();
|
|
|
|
protected static Tanterv FakeTanterv { get; set; }
|
|
|
|
public static Tanterv GiveAnInstance()
|
|
{
|
|
Tanterv result = FakeTanterv == null
|
|
? new Tanterv()
|
|
: (Tanterv)FakeTanterv.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<Tanterv> 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<Tanterv> 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<Tanterv> LoadWithFilter(string filter, Dictionary<string, object> commandParameters = null)
|
|
{
|
|
var result = new EntityCollection<Tanterv>();
|
|
new TantervDA().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<Tanterv> LoadWithFilter(string filter, ColumnFilterMode columnFilterMode, IEnumerable<string> columns, Dictionary<string, object> commandParameters = null)
|
|
{
|
|
var result = new EntityCollection<Tanterv>();
|
|
new TantervDA().LoadWithFilter(result, filter, columnFilterMode, columns, commandParameters);
|
|
return result;
|
|
}
|
|
|
|
protected override void StoreOriginalValues()
|
|
{
|
|
base.StoreOriginalValues();
|
|
OriginalValues.Add("CsoportTipusa", (object)m_CsoportTipusa);
|
|
OriginalValues.Add("Evfolyamig", (object)m_Evfolyamig);
|
|
OriginalValues.Add("Evfolyamtol", (object)m_Evfolyamtol);
|
|
OriginalValues.Add("KerettantervreEpulo", (KerettantervreEpulo == null ? (object)DBNull.Value : (object)m_KerettantervreEpulo));
|
|
OriginalValues.Add("Megjegyzes", (Megjegyzes == null ? (object)DBNull.Value : (object)m_Megjegyzes));
|
|
OriginalValues.Add("Nev", (object)m_Nev);
|
|
OriginalValues.Add("Vedett", (object)m_Vedett);
|
|
OriginalValues.Add("IsKerettanterv", (object)m_IsKerettanterv);
|
|
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 > 255)
|
|
{
|
|
throw new InvalidEntityAttributeException("Tanterv", "Megjegyzes", EntityAttributeError.TooLong);
|
|
}
|
|
if (m_Nev != null && m_Nev.Length > 255)
|
|
{
|
|
throw new InvalidEntityAttributeException("Tanterv", "Nev", EntityAttributeError.TooLong);
|
|
}
|
|
}
|
|
|
|
// kötelező asszociációk ellenőrzése...
|
|
if (m_IntezmenyId == -1) { throw new InvalidEntityAttributeException("Tanterv", "IntezmenyId", EntityAttributeError.Empty); }
|
|
if (m_TanevId == -1) { throw new InvalidEntityAttributeException("Tanterv", "TanevId", EntityAttributeError.Empty); }
|
|
|
|
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Alaphelyzetbe állítás
|
|
protected override void Reset()
|
|
{
|
|
base.Reset();
|
|
|
|
// alaphelyzetbe állítjuk az egyszerű mezőket
|
|
this.m_CsoportTipusa = -1;
|
|
this.m_Evfolyamig = -1;
|
|
this.m_Evfolyamtol = -1;
|
|
this.m_KerettantervreEpulo = null;
|
|
this.m_Megjegyzes = null;
|
|
this.m_Nev = "";
|
|
this.m_Vedett = false;
|
|
this.m_IsKerettanterv = false;
|
|
|
|
// alaphelyzetbe állítjuk az asszociációkból származó mezőket
|
|
this.m_Tanulo = null; // EntityCollection
|
|
this.m_Osztaly = null; // EntityCollection
|
|
this.m_OraTerv = null; // EntityCollection
|
|
this.m_TanuloTanugyiAdatok = null; // EntityCollection
|
|
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...
|
|
|
|
if (this.Tanulo.Count > 0)
|
|
{
|
|
throw new EntityDeleteFailedException("Tanterv", "Tanulo", EntityUtil.GetAssociationDescription("T_TANULO_OSSZES", "C_TANTERVID")); // nincs kapcsolotabla
|
|
}
|
|
if (this.Osztaly.Count > 0)
|
|
{
|
|
throw new EntityDeleteFailedException("Tanterv", "Osztaly", EntityUtil.GetAssociationDescription("T_OSZTALY_OSSZES", "C_TANTERVID")); // nincs kapcsolotabla
|
|
}
|
|
if (this.OraTerv.Count > 0)
|
|
{
|
|
throw new EntityDeleteFailedException("Tanterv", "OraTerv", EntityUtil.GetAssociationDescription("T_ORATERV_OSSZES", "C_TANTERVID")); // nincs kapcsolotabla
|
|
}
|
|
if (this.TanuloTanugyiAdatok.Count > 0)
|
|
{
|
|
throw new EntityDeleteFailedException("Tanterv", "TanuloTanugyiAdatok", EntityUtil.GetAssociationDescription("T_TANULOTANUGYIADATOK_OSSZES", "C_TANTERVID")); // nincs kapcsolotabla
|
|
}
|
|
// 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 CsoportTipusa
|
|
|
|
protected internal int /* DictionaryItem */ m_CsoportTipusa;
|
|
|
|
/// <summary>
|
|
/// csoport típusa
|
|
/// </summary>
|
|
[EntityProperty("CsoportTipusa", EntityPropertyBaseType.ValueType, typeof(int /* DictionaryItem */), EntityCopyMethod.ShallowCopy)]
|
|
[EntityDictionaryItemProperty("CsoportTipusa", "CsoportTipus", typeof(SDA.Kreta.Entities.CsoportTipus))]
|
|
|
|
public virtual int /* DictionaryItem */ CsoportTipusa
|
|
{
|
|
get
|
|
{
|
|
return m_CsoportTipusa;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_CsoportTipusa == value) return;
|
|
m_CsoportTipusa = value;
|
|
FieldModified("CsoportTipusa", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Evfolyamig
|
|
|
|
protected internal int /* DictionaryItem */ m_Evfolyamig;
|
|
|
|
/// <summary>
|
|
/// évfolyamig
|
|
/// </summary>
|
|
[EntityProperty("Evfolyamig", EntityPropertyBaseType.ValueType, typeof(int /* DictionaryItem */), EntityCopyMethod.ShallowCopy)]
|
|
[EntityDictionaryItemProperty("Evfolyamig", "EvfolyamTipus", typeof(SDA.Kreta.Entities.EvfolyamTipus))]
|
|
|
|
public virtual int /* DictionaryItem */ Evfolyamig
|
|
{
|
|
get
|
|
{
|
|
return m_Evfolyamig;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_Evfolyamig == value) return;
|
|
m_Evfolyamig = value;
|
|
FieldModified("Evfolyamig", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Evfolyamtol
|
|
|
|
protected internal int /* DictionaryItem */ m_Evfolyamtol;
|
|
|
|
/// <summary>
|
|
/// évfolyamtól
|
|
/// </summary>
|
|
[EntityProperty("Evfolyamtol", EntityPropertyBaseType.ValueType, typeof(int /* DictionaryItem */), EntityCopyMethod.ShallowCopy)]
|
|
[EntityDictionaryItemProperty("Evfolyamtol", "EvfolyamTipus", typeof(SDA.Kreta.Entities.EvfolyamTipus))]
|
|
|
|
public virtual int /* DictionaryItem */ Evfolyamtol
|
|
{
|
|
get
|
|
{
|
|
return m_Evfolyamtol;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_Evfolyamtol == value) return;
|
|
m_Evfolyamtol = value;
|
|
FieldModified("Evfolyamtol", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region KerettantervreEpulo
|
|
|
|
protected internal bool? m_KerettantervreEpulo;
|
|
|
|
/// <summary>
|
|
/// kerettantervre épülo
|
|
/// </summary>
|
|
[EntityProperty("KerettantervreEpulo", EntityPropertyBaseType.ValueType, typeof(bool), EntityCopyMethod.ShallowCopy)]
|
|
public virtual bool? KerettantervreEpulo
|
|
{
|
|
get
|
|
{
|
|
return m_KerettantervreEpulo;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_KerettantervreEpulo == value) return;
|
|
m_KerettantervreEpulo = value;
|
|
FieldModified("KerettantervreEpulo", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Megjegyzes
|
|
|
|
protected internal string m_Megjegyzes;
|
|
|
|
/// <summary>
|
|
/// 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 Nev
|
|
|
|
protected internal string m_Nev;
|
|
|
|
/// <summary>
|
|
/// tanterv neve
|
|
/// </summary>
|
|
[EntityProperty("Nev", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
|
|
public virtual string Nev
|
|
{
|
|
get
|
|
{
|
|
return m_Nev;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_Nev == value) return;
|
|
m_Nev = value;
|
|
FieldModified("Nev", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Vedett
|
|
|
|
protected internal bool m_Vedett;
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
[EntityProperty("Vedett", EntityPropertyBaseType.ValueType, typeof(bool), EntityCopyMethod.ShallowCopy)]
|
|
public virtual bool Vedett
|
|
{
|
|
get
|
|
{
|
|
return m_Vedett;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_Vedett == value) return;
|
|
m_Vedett = value;
|
|
FieldModified("Vedett", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region IsKerettanterv
|
|
|
|
protected internal bool m_IsKerettanterv;
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
[EntityProperty("IsKerettanterv", EntityPropertyBaseType.ValueType, typeof(bool), EntityCopyMethod.ShallowCopy)]
|
|
public virtual bool IsKerettanterv
|
|
{
|
|
get
|
|
{
|
|
return m_IsKerettanterv;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_IsKerettanterv == value) return;
|
|
m_IsKerettanterv = value;
|
|
FieldModified("IsKerettanterv", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Asszociációkkal kapcsolatos dolgok
|
|
|
|
protected internal virtual bool LoadByTanuloId(int id)
|
|
{
|
|
return m_DA.LoadByTanuloId(id, this);
|
|
}
|
|
|
|
protected internal virtual bool LoadByOsztalyId(int id)
|
|
{
|
|
return m_DA.LoadByOsztalyId(id, this);
|
|
}
|
|
|
|
protected internal virtual bool LoadByOraTervId(int id)
|
|
{
|
|
return m_DA.LoadByOraTervId(id, this);
|
|
}
|
|
|
|
protected internal virtual bool LoadByTanuloTanugyiAdatokId(int id)
|
|
{
|
|
return m_DA.LoadByTanuloTanugyiAdatokId(id, this);
|
|
}
|
|
|
|
#region Tanterv (*) -> 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 ITanterv.Intezmeny
|
|
{
|
|
get { return Intezmeny; }
|
|
set { Intezmeny = value as Intezmeny; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Az UML modellben szereplő Tanterv é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_Tanterv_DA da = new Intezmeny_Tanterv_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 Tanterv (*) -> 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 ITanterv.Tanev
|
|
{
|
|
get { return Tanev; }
|
|
set { Tanev = value as Tanev; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Az UML modellben szereplő Tanterv é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_Tanterv_DA da = new Tanev_Tanterv_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
|
|
|
|
|
|
#region Tanterv (0..1) -> Tanulo (*)
|
|
protected IAssociatedEntityCollection<Tanulo> m_Tanulo = null;
|
|
|
|
IReadOnlyList<ITanulo> ITanterv.Tanulo => Tanulo.Cast<ITanulo>().ToList();
|
|
|
|
/// <summary>
|
|
/// A tanuló tantervének ID-ja
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Az UML modellben szereplő Tanterv és Tanulo entitások közötti asszociáció megvalósítása.
|
|
/// </remarks>
|
|
[EntityProperty("Tanulo", EntityPropertyBaseType.EntityCollection, typeof(IAssociatedEntityCollection<Tanulo>), EntityCopyMethod.DeepCopy, "TantervId")]
|
|
public virtual IAssociatedEntityCollection<Tanulo> Tanulo
|
|
{
|
|
get
|
|
{
|
|
if (m_Tanulo == null)
|
|
{
|
|
m_Tanulo = new AssociatedEntityCollection<Tanterv, Tanulo>(
|
|
new Tanterv_Tanulo_DA(this)
|
|
);
|
|
m_Tanulo.Load();
|
|
}
|
|
return m_Tanulo;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Tanterv (0..1) -> Osztaly (*)
|
|
protected IAssociatedEntityCollection<Osztaly> m_Osztaly = null;
|
|
|
|
IReadOnlyList<IOsztaly> ITanterv.Osztaly => Osztaly.Cast<IOsztaly>().ToList();
|
|
|
|
/// <summary>
|
|
/// Tanterv ID-ja
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Az UML modellben szereplő Tanterv és Osztaly entitások közötti asszociáció megvalósítása.
|
|
/// </remarks>
|
|
[EntityProperty("Osztaly", EntityPropertyBaseType.EntityCollection, typeof(IAssociatedEntityCollection<Osztaly>), EntityCopyMethod.DeepCopy, "TantervId")]
|
|
public virtual IAssociatedEntityCollection<Osztaly> Osztaly
|
|
{
|
|
get
|
|
{
|
|
if (m_Osztaly == null)
|
|
{
|
|
m_Osztaly = new AssociatedEntityCollection<Tanterv, Osztaly>(
|
|
new Tanterv_Osztaly_DA(this)
|
|
);
|
|
m_Osztaly.Load();
|
|
}
|
|
return m_Osztaly;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Tanterv (1) -> OraTerv (*)
|
|
protected IAssociatedEntityCollection<OraTerv> m_OraTerv = null;
|
|
|
|
IReadOnlyList<IOraTerv> ITanterv.OraTerv => OraTerv.Cast<IOraTerv>().ToList();
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Az UML modellben szereplő Tanterv és OraTerv entitások közötti asszociáció megvalósítása.
|
|
/// </remarks>
|
|
[EntityProperty("OraTerv", EntityPropertyBaseType.EntityCollection, typeof(IAssociatedEntityCollection<OraTerv>), EntityCopyMethod.DeepCopy, "TantervId")]
|
|
public virtual IAssociatedEntityCollection<OraTerv> OraTerv
|
|
{
|
|
get
|
|
{
|
|
if (m_OraTerv == null)
|
|
{
|
|
m_OraTerv = new AssociatedEntityCollection<Tanterv, OraTerv>(
|
|
new Tanterv_OraTerv_DA(this)
|
|
);
|
|
m_OraTerv.Load();
|
|
}
|
|
return m_OraTerv;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Tanterv (1) -> TanuloTanugyiAdatok (*)
|
|
protected IAssociatedEntityCollection<TanuloTanugyiAdatok> m_TanuloTanugyiAdatok = null;
|
|
|
|
IReadOnlyList<ITanuloTanugyiAdatok> ITanterv.TanuloTanugyiAdatok => TanuloTanugyiAdatok.Cast<ITanuloTanugyiAdatok>().ToList();
|
|
|
|
/// <summary>
|
|
/// A tanuló tantervének ID-ja
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Az UML modellben szereplő Tanterv és TanuloTanugyiAdatok entitások közötti asszociáció megvalósítása.
|
|
/// </remarks>
|
|
[EntityProperty("TanuloTanugyiAdatok", EntityPropertyBaseType.EntityCollection, typeof(IAssociatedEntityCollection<TanuloTanugyiAdatok>), EntityCopyMethod.DeepCopy, "TantervId")]
|
|
public virtual IAssociatedEntityCollection<TanuloTanugyiAdatok> TanuloTanugyiAdatok
|
|
{
|
|
get
|
|
{
|
|
if (m_TanuloTanugyiAdatok == null)
|
|
{
|
|
m_TanuloTanugyiAdatok = new AssociatedEntityCollection<Tanterv, TanuloTanugyiAdatok>(
|
|
new Tanterv_TanuloTanugyiAdatok_DA(this)
|
|
);
|
|
m_TanuloTanugyiAdatok.Load();
|
|
}
|
|
return m_TanuloTanugyiAdatok;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|