786 lines
26 KiB
C#
786 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 SzamonkeresElorejelzes 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("SzamonkeresElorejelzes")]
|
|
// alapértelmezett EntityHistoryMode
|
|
public class SzamonkeresElorejelzes : Entity, ISzamonkeresElorejelzes
|
|
{
|
|
internal protected SzamonkeresElorejelzes()
|
|
: base()
|
|
{
|
|
}
|
|
|
|
public class AttributeInfo
|
|
{
|
|
public const string OrarendiOraGroupId = "OrarendiOraGroupId";
|
|
public const string RogzitesDatuma = "RogzitesDatuma";
|
|
public const string SzamonkeresDatuma = "SzamonkeresDatuma";
|
|
public const string SzamonkeresModId = "SzamonkeresModId";
|
|
public const string SzamonkeresMegnevezes = "SzamonkeresMegnevezes";
|
|
public const string IsErtesitesElkuldve = "IsErtesitesElkuldve";
|
|
}
|
|
|
|
public class AttributeLengthInfo
|
|
{
|
|
public const int SzamonkeresMegnevezesLength = 300;
|
|
}
|
|
|
|
#region General
|
|
private SzamonkeresElorejelzesDA m_DA = new SzamonkeresElorejelzesDA();
|
|
|
|
protected static SzamonkeresElorejelzes FakeSzamonkeresElorejelzes { get; set; }
|
|
|
|
public static SzamonkeresElorejelzes GiveAnInstance()
|
|
{
|
|
SzamonkeresElorejelzes result = FakeSzamonkeresElorejelzes == null
|
|
? new SzamonkeresElorejelzes()
|
|
: (SzamonkeresElorejelzes)FakeSzamonkeresElorejelzes.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<SzamonkeresElorejelzes> 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<SzamonkeresElorejelzes> 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<SzamonkeresElorejelzes> LoadWithFilter(string filter, Dictionary<string, object> commandParameters = null)
|
|
{
|
|
var result = new EntityCollection<SzamonkeresElorejelzes>();
|
|
new SzamonkeresElorejelzesDA().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<SzamonkeresElorejelzes> LoadWithFilter(string filter, ColumnFilterMode columnFilterMode, IEnumerable<string> columns, Dictionary<string, object> commandParameters = null)
|
|
{
|
|
var result = new EntityCollection<SzamonkeresElorejelzes>();
|
|
new SzamonkeresElorejelzesDA().LoadWithFilter(result, filter, columnFilterMode, columns, commandParameters);
|
|
return result;
|
|
}
|
|
|
|
protected override void StoreOriginalValues()
|
|
{
|
|
base.StoreOriginalValues();
|
|
OriginalValues.Add("OrarendiOraGroupId", (object)m_OrarendiOraGroupId);
|
|
OriginalValues.Add("RogzitesDatuma", (object)m_RogzitesDatuma);
|
|
OriginalValues.Add("SzamonkeresDatuma", (object)m_SzamonkeresDatuma);
|
|
OriginalValues.Add("SzamonkeresModId", (object)m_SzamonkeresModId);
|
|
OriginalValues.Add("SzamonkeresMegnevezes", (SzamonkeresMegnevezes == null ? (object)DBNull.Value : (object)m_SzamonkeresMegnevezes));
|
|
OriginalValues.Add("IsErtesitesElkuldve", (object)m_IsErtesitesElkuldve);
|
|
OriginalValues.Add("RogzitoId", (m_RogzitoId < 0 ? (object)DBNull.Value : (object)m_RogzitoId));
|
|
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_SzamonkeresMegnevezes != null && m_SzamonkeresMegnevezes.Length > 300)
|
|
{
|
|
throw new InvalidEntityAttributeException("SzamonkeresElorejelzes", "SzamonkeresMegnevezes", EntityAttributeError.TooLong);
|
|
}
|
|
}
|
|
|
|
// kötelező asszociációk ellenőrzése...
|
|
if (m_RogzitoId == -1) { throw new InvalidEntityAttributeException("SzamonkeresElorejelzes", "RogzitoId", EntityAttributeError.Empty); }
|
|
if (m_IntezmenyId == -1) { throw new InvalidEntityAttributeException("SzamonkeresElorejelzes", "IntezmenyId", EntityAttributeError.Empty); }
|
|
if (m_TanevId == -1) { throw new InvalidEntityAttributeException("SzamonkeresElorejelzes", "TanevId", EntityAttributeError.Empty); }
|
|
|
|
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Alaphelyzetbe állítás
|
|
protected override void Reset()
|
|
{
|
|
base.Reset();
|
|
|
|
// alaphelyzetbe állítjuk az egyszerű mezőket
|
|
this.m_OrarendiOraGroupId = -1;
|
|
this.m_RogzitesDatuma = DateTime.Now /* XXX DateTime */;
|
|
this.m_SzamonkeresDatuma = DateTime.Now /* XXX DateTime */;
|
|
this.m_SzamonkeresModId = -1;
|
|
this.m_SzamonkeresMegnevezes = null;
|
|
this.m_IsErtesitesElkuldve = false;
|
|
|
|
// alaphelyzetbe állítjuk az asszociációkból származó mezőket
|
|
this.m_RogzitoId = -1;
|
|
this.m_Rogzito = 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...
|
|
|
|
// Rogzito 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 OrarendiOraGroupId
|
|
|
|
protected internal int m_OrarendiOraGroupId;
|
|
|
|
/// <summary>
|
|
/// A számonkérés és órarendi óra összekötése
|
|
/// </summary>
|
|
[EntityProperty("OrarendiOraGroupId", EntityPropertyBaseType.ValueType, typeof(int), EntityCopyMethod.ShallowCopy)]
|
|
public virtual int OrarendiOraGroupId
|
|
{
|
|
get
|
|
{
|
|
return m_OrarendiOraGroupId;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_OrarendiOraGroupId == value) return;
|
|
m_OrarendiOraGroupId = value;
|
|
FieldModified("OrarendiOraGroupId", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region RogzitesDatuma
|
|
|
|
protected internal DateTime m_RogzitesDatuma;
|
|
|
|
/// <summary>
|
|
/// A számonkérés rögzítésének dátuma
|
|
/// </summary>
|
|
[EntityProperty("RogzitesDatuma", EntityPropertyBaseType.ValueType, typeof(DateTime), EntityCopyMethod.ShallowCopy)]
|
|
public virtual DateTime RogzitesDatuma
|
|
{
|
|
get
|
|
{
|
|
return m_RogzitesDatuma;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_RogzitesDatuma == value) return;
|
|
m_RogzitesDatuma = value;
|
|
FieldModified("RogzitesDatuma", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region SzamonkeresDatuma
|
|
|
|
protected internal DateTime m_SzamonkeresDatuma;
|
|
|
|
/// <summary>
|
|
/// A számonkérés érvényességi dátuma
|
|
/// </summary>
|
|
[EntityProperty("SzamonkeresDatuma", EntityPropertyBaseType.ValueType, typeof(DateTime), EntityCopyMethod.ShallowCopy)]
|
|
public virtual DateTime SzamonkeresDatuma
|
|
{
|
|
get
|
|
{
|
|
return m_SzamonkeresDatuma;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_SzamonkeresDatuma == value) return;
|
|
m_SzamonkeresDatuma = value;
|
|
FieldModified("SzamonkeresDatuma", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region SzamonkeresModId
|
|
|
|
protected internal int /* DictionaryItem */ m_SzamonkeresModId;
|
|
|
|
/// <summary>
|
|
/// A számonkérés összekötése az értékelés módokkal
|
|
/// </summary>
|
|
[EntityProperty("SzamonkeresModId", EntityPropertyBaseType.ValueType, typeof(int /* DictionaryItem */), EntityCopyMethod.ShallowCopy)]
|
|
[EntityDictionaryItemProperty("SzamonkeresModId", "ErtekelesMod", typeof(SDA.Kreta.Entities.ErtekelesMod))]
|
|
|
|
public virtual int /* DictionaryItem */ SzamonkeresModId
|
|
{
|
|
get
|
|
{
|
|
return m_SzamonkeresModId;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_SzamonkeresModId == value) return;
|
|
m_SzamonkeresModId = value;
|
|
FieldModified("SzamonkeresModId", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region SzamonkeresMegnevezes
|
|
|
|
protected internal string m_SzamonkeresMegnevezes;
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
[EntityProperty("SzamonkeresMegnevezes", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
|
|
public virtual string SzamonkeresMegnevezes
|
|
{
|
|
get
|
|
{
|
|
return m_SzamonkeresMegnevezes;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_SzamonkeresMegnevezes == value) return;
|
|
m_SzamonkeresMegnevezes = value;
|
|
FieldModified("SzamonkeresMegnevezes", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region IsErtesitesElkuldve
|
|
|
|
protected internal bool m_IsErtesitesElkuldve;
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
[EntityProperty("IsErtesitesElkuldve", EntityPropertyBaseType.ValueType, typeof(bool), EntityCopyMethod.ShallowCopy)]
|
|
public virtual bool IsErtesitesElkuldve
|
|
{
|
|
get
|
|
{
|
|
return m_IsErtesitesElkuldve;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
|
|
if (m_IsErtesitesElkuldve == value) return;
|
|
m_IsErtesitesElkuldve = value;
|
|
FieldModified("IsErtesitesElkuldve", value);
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Asszociációkkal kapcsolatos dolgok
|
|
|
|
#region SzamonkeresElorejelzes (*) -> Alkalmazott (1)
|
|
|
|
protected internal int m_RogzitoId = -1;
|
|
|
|
/// <summary>
|
|
/// A(z) Rogzito 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 RogzitoId
|
|
{
|
|
get
|
|
{
|
|
return InternalRogzitoId;
|
|
}
|
|
set
|
|
{
|
|
InternalRogzitoId = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ez egy külön bejárat a DA számára
|
|
/// <summary>
|
|
internal int InternalRogzitoId
|
|
{
|
|
get
|
|
{
|
|
if (m_Rogzito != null)
|
|
{
|
|
return m_Rogzito.ID;
|
|
}
|
|
else
|
|
{
|
|
return m_RogzitoId;// XXX az meg nem teljesen OK
|
|
}
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
if (m_RogzitoId != value)
|
|
{
|
|
m_RogzitoId = value;
|
|
m_Rogzito = null;
|
|
FieldModified("RogzitoId", value);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ez egy külön bejárat a DA számára
|
|
/// <summary>
|
|
internal void ModifyRogzito(Alkalmazott value)
|
|
{
|
|
m_RogzitoId = value != null ? value.ID : -1;
|
|
m_Rogzito = value;
|
|
FieldModified("RogzitoId", value != null ? (object)value.ID : DBNull.Value);
|
|
}
|
|
|
|
protected internal void SetRogzito(Alkalmazott value)
|
|
{
|
|
m_Rogzito = value;
|
|
if (value != null)
|
|
{
|
|
m_RogzitoId = value.ID;
|
|
}
|
|
else
|
|
{
|
|
m_RogzitoId = -1;
|
|
}
|
|
}
|
|
|
|
protected Alkalmazott m_Rogzito = null;
|
|
|
|
IAlkalmazott ISzamonkeresElorejelzes.Rogzito
|
|
{
|
|
get { return Rogzito; }
|
|
set { Rogzito = value as Alkalmazott; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// A számonkérést rögzíto tanárt azonosító IDja
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Az UML modellben szereplő SzamonkeresElorejelzes és Alkalmazott entitások közötti asszociáció megvalósítása.
|
|
/// </remarks>
|
|
[EntityProperty("Rogzito", EntityPropertyBaseType.Entity, typeof(Alkalmazott), EntityCopyMethod.ShallowCopy)]
|
|
public virtual Alkalmazott Rogzito
|
|
{
|
|
get
|
|
{
|
|
if ((m_Rogzito == null) && (m_RogzitoId != -1))
|
|
{
|
|
SDA.Kreta.Entities.Alkalmazott partner = SDA.Kreta.Entities.Alkalmazott.GiveAnInstance();
|
|
partner.LoadByID(m_RogzitoId);
|
|
|
|
this.SetRogzito(partner);
|
|
}
|
|
// természetesen null-t adunk vissza, ha nem tudtunk felhozni semmit
|
|
return m_Rogzito;
|
|
}
|
|
set
|
|
{
|
|
CheckModifyable();
|
|
if (value != null)
|
|
{
|
|
if ((m_Rogzito == null) || (value.ID != m_Rogzito.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.Alkalmazott_SzamonkeresElorejelzes_DA da = new Alkalmazott_SzamonkeresElorejelzes_DA(value);
|
|
da.AddItem(this);
|
|
this.SetRogzito(value);
|
|
}
|
|
else
|
|
{
|
|
this.SetRogzito(value);
|
|
}
|
|
FieldModified("RogzitoId", value.ID);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// ki kell törölni a kapcsolatot az adatbázisban
|
|
this.SetRogzito(null);
|
|
UpdateAssociations();
|
|
FieldModified("RogzitoId", DBNull.Value);
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region SzamonkeresElorejelzes (*) -> 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 ISzamonkeresElorejelzes.Intezmeny
|
|
{
|
|
get { return Intezmeny; }
|
|
set { Intezmeny = value as Intezmeny; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Az UML modellben szereplő SzamonkeresElorejelzes é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_SzamonkeresElorejelzes_DA da = new Intezmeny_SzamonkeresElorejelzes_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 SzamonkeresElorejelzes (*) -> 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 ISzamonkeresElorejelzes.Tanev
|
|
{
|
|
get { return Tanev; }
|
|
set { Tanev = value as Tanev; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Nincs definiálva megjegyzés.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Az UML modellben szereplő SzamonkeresElorejelzes é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_SzamonkeresElorejelzes_DA da = new Tanev_SzamonkeresElorejelzes_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
|
|
}
|
|
}
|
|
|