795 lines
25 KiB
C#
795 lines
25 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 eLearning 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("eLearning")]
|
|
// alapértelmezett EntityHistoryMode
|
|
public class eLearning : Entity, IeLearning
|
|
{
|
|
internal protected eLearning()
|
|
: base()
|
|
{
|
|
}
|
|
|
|
public class AttributeInfo
|
|
{
|
|
public const string Befejezett = "Befejezett";
|
|
public const string eLearningAzonosito = "eLearningAzonosito";
|
|
public const string eLearningFelhasznaloNev = "eLearningFelhasznaloNev";
|
|
public const string Sikeres = "Sikeres";
|
|
public const string Szerzodeses = "Szerzodeses";
|
|
public const string TananyagKod = "TananyagKod";
|
|
}
|
|
|
|
public class AttributeLengthInfo
|
|
{
|
|
public const int eLearningAzonositoLength = 500;
|
|
public const int eLearningFelhasznaloNevLength = 500;
|
|
public const int TananyagKodLength = 500;
|
|
}
|
|
|
|
#region General
|
|
private eLearningDA m_DA = new eLearningDA();
|
|
|
|
protected static eLearning FakeeLearning { get; set; }
|
|
|
|
public static eLearning GiveAnInstance()
|
|
{
|
|
eLearning result = FakeeLearning == null
|
|
? new eLearning()
|
|
: (eLearning)FakeeLearning.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<eLearning> 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<eLearning> 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<eLearning> LoadWithFilter(string filter, Dictionary<string, object> commandParameters = null)
|
|
{
|
|
var result = new EntityCollection<eLearning>();
|
|
new eLearningDA().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<eLearning> LoadWithFilter(string filter, ColumnFilterMode columnFilterMode, IEnumerable<string> columns, Dictionary<string, object> commandParameters = null)
|
|
{
|
|
var result = new EntityCollection<eLearning>();
|
|
new eLearningDA().LoadWithFilter(result, filter, columnFilterMode, columns, commandParameters);
|
|
return result;
|
|
}
|
|
|
|
protected override void StoreOriginalValues()
|
|
{
|
|
base.StoreOriginalValues();
|
|
OriginalValues.Add("Befejezett", (object)m_Befejezett);
|
|
OriginalValues.Add("eLearningAzonosito", (object)m_eLearningAzonosito);
|
|
OriginalValues.Add("eLearningFelhasznaloNev", (object)m_eLearningFelhasznaloNev);
|
|
OriginalValues.Add("Sikeres", (object)m_Sikeres);
|
|
OriginalValues.Add("Szerzodeses", (object)m_Szerzodeses);
|
|
OriginalValues.Add("TananyagKod", (object)m_TananyagKod);
|
|
OriginalValues.Add("FelhasznaloId", (m_FelhasznaloId < 0 ? (object)DBNull.Value : (object)m_FelhasznaloId));
|
|
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_eLearningAzonosito != null && m_eLearningAzonosito.Length > 500)
|
|
{
|
|
throw new InvalidEntityAttributeException("eLearning", "eLearningAzonosito", EntityAttributeError.TooLong);
|
|
}
|
|
if (m_eLearningFelhasznaloNev != null && m_eLearningFelhasznaloNev.Length > 500)
|
|
{
|
|
throw new InvalidEntityAttributeException("eLearning", "eLearningFelhasznaloNev", EntityAttributeError.TooLong);
|
|
}
|
|
if (m_TananyagKod != null && m_TananyagKod.Length > 500)
|
|
{
|
|
throw new InvalidEntityAttributeException("eLearning", "TananyagKod", EntityAttributeError.TooLong);
|
|
}
|
|
|
|
}
|
|
|
|
// kötelező asszociációk ellenőrzése...
|
|
if (m_FelhasznaloId == -1) { throw new InvalidEntityAttributeException("eLearning", "FelhasznaloId", EntityAttributeError.Empty); }
|
|
if (m_IntezmenyId == -1) { throw new InvalidEntityAttributeException("eLearning", "IntezmenyId", EntityAttributeError.Empty); }
|
|
if (m_TanevId == -1) { throw new InvalidEntityAttributeException("eLearning", "TanevId", EntityAttributeError.Empty); }
|
|
|
|
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Alaphelyzetbe állítás
|
|
protected override void Reset()
|
|
{
|
|
base.Reset();
|
|
|
|
// alaphelyzetbe állítjuk az egyszerű mezőket
|
|
this.m_Befejezett = false;
|
|
this.m_eLearningAzonosito = "";
|
|
this.m_eLearningFelhasznaloNev = "";
|
|
this.m_Sikeres = false;
|
|
this.m_Szerzodeses = false;
|
|
this.m_TananyagKod = "";
|
|
|
|
// alaphelyzetbe állítjuk az asszociációkból származó mezőket
|
|
this.m_FelhasznaloId = -1;
|
|
this.m_Felhasznalo = 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...
|
|
|
|
// Felhasznalo 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 Befejezett
|
|
|
|
protected internal bool m_Befejezett;
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
[EntityProperty("Befejezett", EntityPropertyBaseType.ValueType, typeof(bool), EntityCopyMethod.ShallowCopy)]
|
|
public virtual bool Befejezett
|
|
{
|
|
get
|
|
{
|
|
return m_Befejezett;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_Befejezett == value) return;
|
|
m_Befejezett = value;
|
|
FieldModified("Befejezett", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region eLearningAzonosito
|
|
|
|
protected internal string m_eLearningAzonosito;
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
[EntityProperty("eLearningAzonosito", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
|
|
public virtual string eLearningAzonosito
|
|
{
|
|
get
|
|
{
|
|
return m_eLearningAzonosito;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_eLearningAzonosito == value) return;
|
|
m_eLearningAzonosito = value;
|
|
FieldModified("eLearningAzonosito", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region eLearningFelhasznaloNev
|
|
|
|
protected internal string m_eLearningFelhasznaloNev;
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
[EntityProperty("eLearningFelhasznaloNev", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
|
|
public virtual string eLearningFelhasznaloNev
|
|
{
|
|
get
|
|
{
|
|
return m_eLearningFelhasznaloNev;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_eLearningFelhasznaloNev == value) return;
|
|
m_eLearningFelhasznaloNev = value;
|
|
FieldModified("eLearningFelhasznaloNev", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Sikeres
|
|
|
|
protected internal bool m_Sikeres;
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
[EntityProperty("Sikeres", EntityPropertyBaseType.ValueType, typeof(bool), EntityCopyMethod.ShallowCopy)]
|
|
public virtual bool Sikeres
|
|
{
|
|
get
|
|
{
|
|
return m_Sikeres;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_Sikeres == value) return;
|
|
m_Sikeres = value;
|
|
FieldModified("Sikeres", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Szerzodeses
|
|
|
|
protected internal bool m_Szerzodeses;
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
[EntityProperty("Szerzodeses", EntityPropertyBaseType.ValueType, typeof(bool), EntityCopyMethod.ShallowCopy)]
|
|
public virtual bool Szerzodeses
|
|
{
|
|
get
|
|
{
|
|
return m_Szerzodeses;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_Szerzodeses == value) return;
|
|
m_Szerzodeses = value;
|
|
FieldModified("Szerzodeses", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region TananyagKod
|
|
|
|
protected internal string m_TananyagKod;
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
[EntityProperty("TananyagKod", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
|
|
public virtual string TananyagKod
|
|
{
|
|
get
|
|
{
|
|
return m_TananyagKod;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_TananyagKod == value) return;
|
|
m_TananyagKod = value;
|
|
FieldModified("TananyagKod", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Asszociációkkal kapcsolatos dolgok
|
|
|
|
#region eLearning (*) -> Felhasznalo (1)
|
|
|
|
protected internal int m_FelhasznaloId = -1;
|
|
|
|
/// <summary>
|
|
/// A(z) Felhasznalo 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 FelhasznaloId
|
|
{
|
|
get
|
|
{
|
|
return InternalFelhasznaloId;
|
|
}
|
|
set
|
|
{
|
|
InternalFelhasznaloId = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ez egy külön bejárat a DA számára
|
|
/// <summary>
|
|
internal int InternalFelhasznaloId
|
|
{
|
|
get
|
|
{
|
|
if (m_Felhasznalo != null)
|
|
{
|
|
return m_Felhasznalo.ID;
|
|
}
|
|
else
|
|
{
|
|
return m_FelhasznaloId;// XXX az meg nem teljesen OK
|
|
}
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
if (m_FelhasznaloId != value)
|
|
{
|
|
m_FelhasznaloId = value;
|
|
m_Felhasznalo = null;
|
|
FieldModified("FelhasznaloId", value);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ez egy külön bejárat a DA számára
|
|
/// <summary>
|
|
internal void ModifyFelhasznalo(Felhasznalo value)
|
|
{
|
|
m_FelhasznaloId = value != null ? value.ID : -1;
|
|
m_Felhasznalo = value;
|
|
FieldModified("FelhasznaloId", value != null ? (object)value.ID : DBNull.Value);
|
|
}
|
|
|
|
protected internal void SetFelhasznalo(Felhasznalo value)
|
|
{
|
|
m_Felhasznalo = value;
|
|
if (value != null)
|
|
{
|
|
m_FelhasznaloId = value.ID;
|
|
}
|
|
else
|
|
{
|
|
m_FelhasznaloId = -1;
|
|
}
|
|
}
|
|
|
|
protected Felhasznalo m_Felhasznalo = null;
|
|
|
|
IFelhasznalo IeLearning.Felhasznalo
|
|
{
|
|
get { return Felhasznalo; }
|
|
set { Felhasznalo = value as Felhasznalo; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Az UML modellben szereplő eLearning és Felhasznalo entitások közötti asszociáció megvalósítása.
|
|
/// </remarks>
|
|
[EntityProperty("Felhasznalo", EntityPropertyBaseType.Entity, typeof(Felhasznalo), EntityCopyMethod.ShallowCopy)]
|
|
public virtual Felhasznalo Felhasznalo
|
|
{
|
|
get
|
|
{
|
|
if ((m_Felhasznalo == null) && (m_FelhasznaloId != -1))
|
|
{
|
|
SDA.Kreta.Entities.Felhasznalo partner = SDA.Kreta.Entities.Felhasznalo.GiveAnInstance();
|
|
partner.LoadByID(m_FelhasznaloId);
|
|
|
|
this.SetFelhasznalo(partner);
|
|
}
|
|
// természetesen null-t adunk vissza, ha nem tudtunk felhozni semmit
|
|
return m_Felhasznalo;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
if (value != null)
|
|
{
|
|
if ((m_Felhasznalo == null) || (value.ID != m_Felhasznalo.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.Felhasznalo_eLearning_DA da = new Felhasznalo_eLearning_DA(value);
|
|
da.AddItem(this);
|
|
this.SetFelhasznalo(value);
|
|
}
|
|
else
|
|
{
|
|
this.SetFelhasznalo(value);
|
|
}
|
|
FieldModified("FelhasznaloId", value.ID);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// ki kell törölni a kapcsolatot az adatbázisban
|
|
this.SetFelhasznalo(null);
|
|
UpdateAssociations();
|
|
FieldModified("FelhasznaloId", DBNull.Value);
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region eLearning (*) -> 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 IeLearning.Intezmeny
|
|
{
|
|
get { return Intezmeny; }
|
|
set { Intezmeny = value as Intezmeny; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Az UML modellben szereplő eLearning é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_eLearning_DA da = new Intezmeny_eLearning_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 eLearning (*) -> 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 IeLearning.Tanev
|
|
{
|
|
get { return Tanev; }
|
|
set { Tanev = value as Tanev; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Az UML modellben szereplő eLearning é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_eLearning_DA da = new Tanev_eLearning_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
|
|
}
|
|
}
|
|
|