700 lines
30 KiB
C#
700 lines
30 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using Kreta.Framework;
|
|
using Kreta.Framework.Collections;
|
|
using Kreta.Framework.Collections.Generic;
|
|
using Kreta.Framework.Entities;
|
|
using Kreta.Framework.Entities.Associations;
|
|
using Kreta.Framework.Entities.Generic;
|
|
|
|
namespace SDA.Kreta.Entities
|
|
{
|
|
internal sealed class PedagogusEletpalyamodellDBHelper : EntityDBHelper<PedagogusEletpalyamodell>
|
|
{
|
|
private Dictionary<string, string> dynamicColumns = new Dictionary<string, string>()
|
|
{
|
|
{ "Fokozat", "T_PEDAGOGUSELETPALYAMODELL_OSSZES.C_FOKOZAT" },
|
|
{ "MinositesDatum", "T_PEDAGOGUSELETPALYAMODELL_OSSZES.C_MINOSITESDATUM" },
|
|
{ "PortfolioStatusz", "T_PEDAGOGUSELETPALYAMODELL_OSSZES.C_PORTFOLIOSTATUSZ" },
|
|
};
|
|
|
|
private const string dynamicQueryCommandText =
|
|
"select " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.ID, " +
|
|
"{COLUMNS}" +
|
|
// PedagogusEletpalyamodell betöltése
|
|
// PedagogusEletpalyamodell kapcsoló mezői
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.C_TANARID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.C_INTEZMENYID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.C_TANEVID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.TOROLT, " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.SERIAL, " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.CREATED, " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.CREATOR, " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.LASTCHANGED, " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.MODIFIER " +
|
|
"from " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES " +
|
|
"where " +
|
|
"(1 = 1) ";
|
|
|
|
private const string emptyQueryCommandText =
|
|
"select " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.ID, " +
|
|
// PedagogusEletpalyamodell betöltése
|
|
// PedagogusEletpalyamodell mezői
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.C_FOKOZAT, " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.C_MINOSITESDATUM, " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.C_PORTFOLIOSTATUSZ, " +
|
|
// PedagogusEletpalyamodell kapcsoló mezői
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.C_TANARID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.C_INTEZMENYID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.C_TANEVID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.TOROLT, " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.SERIAL, " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.CREATED, " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.CREATOR, " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.LASTCHANGED, " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES.MODIFIER " +
|
|
"from " +
|
|
"T_PEDAGOGUSELETPALYAMODELL_OSSZES " +
|
|
"where " +
|
|
"(1 = 1) ";
|
|
|
|
public override string EmptyQueryCommandText
|
|
{
|
|
get
|
|
{
|
|
return emptyQueryCommandText;
|
|
}
|
|
}
|
|
|
|
public override string DynamicQueryCommandText
|
|
{
|
|
get
|
|
{
|
|
return dynamicQueryCommandText;
|
|
}
|
|
}
|
|
|
|
public override IDictionary<string, string> DynamicColumns
|
|
{
|
|
get
|
|
{
|
|
return dynamicColumns;
|
|
}
|
|
}
|
|
|
|
protected override PedagogusEletpalyamodell CreateEntityInstance()
|
|
{
|
|
return PedagogusEletpalyamodell.GiveAnInstance();
|
|
}
|
|
|
|
#region Lekérdezés
|
|
|
|
public override void LoadEntityFields(PedagogusEletpalyamodell entity, SDA.DataProvider.SDADataReader reader)
|
|
{
|
|
// PedagogusEletpalyamodell betöltése
|
|
// PedagogusEletpalyamodell mezői
|
|
|
|
entity.m_Fokozat = DAUtil.ReadIntegerAttribute(reader, 1, -1);
|
|
|
|
|
|
entity.m_MinositesDatum = DAUtil.ReadDateTimeAttribute(reader, 2, DateTime.Now /* XXX DateTime */);
|
|
|
|
|
|
entity.m_PortfolioStatusz = DAUtil.ReadIntegerAttribute(reader, 3);
|
|
|
|
// PedagogusEletpalyamodell kapcsoló mezői
|
|
DAUtil.ReadIDAttribute(reader, 4, ref entity.m_TanarId, 0);
|
|
DAUtil.ReadIDAttribute(reader, 5, ref entity.m_IntezmenyId, 0);
|
|
DAUtil.ReadIDAttribute(reader, 6, ref entity.m_TanevId, 0);
|
|
}
|
|
|
|
public override void LoadEntityFields(PedagogusEletpalyamodell entity, SDA.DataProvider.SDADataReader reader, ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
|
|
{
|
|
int index = 1;
|
|
if (columns == null)
|
|
{
|
|
columns = new List<string>(index);
|
|
}
|
|
// PedagogusEletpalyamodell betöltése
|
|
// PedagogusEletpalyamodell mezői
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("Fokozat"))))
|
|
{
|
|
entity.m_Fokozat = DAUtil.ReadIntegerAttribute(reader, index++, -1);
|
|
}
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("MinositesDatum"))))
|
|
{
|
|
entity.m_MinositesDatum = DAUtil.ReadDateTimeAttribute(reader, index++, DateTime.Now /* XXX DateTime */);
|
|
}
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("PortfolioStatusz"))))
|
|
{
|
|
entity.m_PortfolioStatusz = DAUtil.ReadIntegerAttribute(reader, index++);
|
|
}
|
|
// PedagogusEletpalyamodell kapcsoló mezői
|
|
DAUtil.ReadIDAttribute(reader, index++, ref entity.m_TanarId, 0);
|
|
DAUtil.ReadIDAttribute(reader, index++, ref entity.m_IntezmenyId, 0);
|
|
DAUtil.ReadIDAttribute(reader, index++, ref entity.m_TanevId, 0);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Paraméter kötés
|
|
|
|
public override void BindAttributes(PedagogusEletpalyamodell entity, SDA.DataProvider.SDACommand command)
|
|
{
|
|
DAUtil.BindParameter(command, "pFOKOZAT", SDA.DataProvider.SDADBType.Int /* DictionaryItem */, 15, entity.m_Fokozat, false);
|
|
|
|
DAUtil.BindParameter(command, "pMINOSITESDATUM", SDA.DataProvider.SDADBType.DateTime, entity.m_MinositesDatum, false);
|
|
|
|
DAUtil.BindParameter(command, "pPORTFOLIOSTATUSZ", SDA.DataProvider.SDADBType.Int /* DictionaryItem */, 15, entity.m_PortfolioStatusz, entity.m_PortfolioStatusz == null);
|
|
}
|
|
|
|
public override void DynamicBindAttributes(PedagogusEletpalyamodell entity, SDA.DataProvider.SDACommand command)
|
|
{
|
|
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
|
if (entity.HasChanged("Fokozat"))
|
|
{
|
|
sb.Append("C_FOKOZAT = :pFOKOZAT,");
|
|
|
|
DAUtil.BindParameter(command, "pFOKOZAT", SDA.DataProvider.SDADBType.Int /* DictionaryItem */, 15, entity.m_Fokozat, false);
|
|
|
|
}
|
|
if (entity.HasChanged("MinositesDatum"))
|
|
{
|
|
sb.Append("C_MINOSITESDATUM = :pMINOSITESDATUM,");
|
|
|
|
DAUtil.BindParameter(command, "pMINOSITESDATUM", SDA.DataProvider.SDADBType.DateTime, entity.m_MinositesDatum, false);
|
|
|
|
}
|
|
if (entity.HasChanged("PortfolioStatusz"))
|
|
{
|
|
sb.Append("C_PORTFOLIOSTATUSZ = :pPORTFOLIOSTATUSZ,");
|
|
|
|
DAUtil.BindParameter(command, "pPORTFOLIOSTATUSZ", SDA.DataProvider.SDADBType.Int /* DictionaryItem */, 15, entity.m_PortfolioStatusz, entity.m_PortfolioStatusz == null);
|
|
|
|
}
|
|
command.CommandText = command.CommandText.Replace("{COLUMNS}", sb.ToString());
|
|
}
|
|
|
|
public override void BindAssociations(PedagogusEletpalyamodell entity, SDA.DataProvider.SDACommand command)
|
|
{
|
|
DAUtil.BindIdParameter(command, "pTANARID", entity.InternalTanarId);
|
|
DAUtil.BindIdParameter(command, "pINTEZMENYID", entity.InternalIntezmenyId);
|
|
DAUtil.BindIdParameter(command, "pTANEVID", entity.InternalTanevId);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
internal class PedagogusEletpalyamodellDA : EntityDataAccessor<PedagogusEletpalyamodell>
|
|
{
|
|
private static PedagogusEletpalyamodellDBHelper m_dbhelper = new PedagogusEletpalyamodellDBHelper();
|
|
|
|
protected override IEntityDBHelper<PedagogusEletpalyamodell> dbhelper
|
|
{
|
|
get { return m_dbhelper; }
|
|
}
|
|
|
|
#region Load
|
|
|
|
public override bool LoadEntity(PedagogusEletpalyamodell entity, int entityId)
|
|
{
|
|
return LoadById(entity, entityId);
|
|
}
|
|
|
|
public override bool FilteredLoadEntity(PedagogusEletpalyamodell entity, int entityId, ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
|
|
{
|
|
return LoadById(entity, entityId, columnFilterMode, columns);
|
|
}
|
|
|
|
public bool LoadById(PedagogusEletpalyamodell entity, int entityId)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = dbhelper.CreateEmptyQueryCommand())
|
|
{
|
|
command.CommandText += " and (T_PEDAGOGUSELETPALYAMODELL_OSSZES.ID = :pID) ";
|
|
command.Parameters.Add("pID", SDA.DataProvider.SDADBType.Int).Value = entityId;
|
|
return dbhelper.LoadSingleEntity(entity, command);
|
|
}
|
|
}
|
|
|
|
public bool LoadById(PedagogusEletpalyamodell entity, int entityId, ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = dbhelper.CreateDynamicQueryCommand(columnFilterMode, columns))
|
|
{
|
|
command.CommandText += " and (T_PEDAGOGUSELETPALYAMODELL_OSSZES.ID = :pID) ";
|
|
command.Parameters.Add("pID", SDA.DataProvider.SDADBType.Int).Value = entityId;
|
|
return dbhelper.LoadSingleEntity(entity, command, 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 override void LoadWithFilter(IEntityCollection<PedagogusEletpalyamodell> collection, string filter, Dictionary<string, object> commandParameters = null)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = dbhelper.CreateEmptyQueryCommand())
|
|
{
|
|
command.CommandText += filter;
|
|
dbhelper.CreateParameterBinding(command, commandParameters);
|
|
dbhelper.LoadEntityCollection(collection, command);
|
|
}
|
|
}
|
|
|
|
[Obsolete("Ezt ne használjátok, mert mindenhova bele kellene fogalmazni a tanév szűrést is! Meg fog majd szűnni!")]
|
|
public override void LoadWithFilter(IEntityCollection<PedagogusEletpalyamodell> collection, string filter, ColumnFilterMode columnFilterMode, IEnumerable<string> columns, Dictionary<string, object> commandParameters = null)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = dbhelper.CreateDynamicQueryCommand(columnFilterMode, columns))
|
|
{
|
|
command.CommandText += filter;
|
|
dbhelper.CreateParameterBinding(command, commandParameters);
|
|
dbhelper.LoadEntityCollection(collection, command, columnFilterMode, columns);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region InsertEntity
|
|
|
|
private const string m_InsertCommandText = @"
|
|
insert into T_PEDAGOGUSELETPALYAMODELL_OSSZES (
|
|
C_FOKOZAT,
|
|
C_MINOSITESDATUM,
|
|
C_PORTFOLIOSTATUSZ,
|
|
C_TANARID,
|
|
C_INTEZMENYID,
|
|
C_TANEVID,
|
|
TOROLT,
|
|
SERIAL,
|
|
CREATED,
|
|
CREATOR)
|
|
values (
|
|
:pFOKOZAT,
|
|
:pMINOSITESDATUM,
|
|
:pPORTFOLIOSTATUSZ,
|
|
:pTANARID,
|
|
:pINTEZMENYID,
|
|
:pTANEVID,
|
|
:pTOROLT,
|
|
:pSERIAL,
|
|
:pCREATED,
|
|
:pCREATOR);
|
|
|
|
SELECT SCOPE_IDENTITY() as ID;
|
|
|
|
";
|
|
|
|
public override void InsertEntity(PedagogusEletpalyamodell entity)
|
|
{
|
|
entity.Serial = 0;
|
|
SetEntityCreator(entity, DateTime.Now, UserContext.Instance.UniqueIdentifier);
|
|
|
|
using (SDA.DataProvider.SDACommand command = DAUtil.CreateCommand(m_InsertCommandText))
|
|
{
|
|
dbhelper.BindAttributes(entity, command);
|
|
dbhelper.BindAssociations(entity, command);
|
|
command.Parameters.Add("pTOROLT", SDA.DataProvider.SDADBType.Boolean /* Boolean */).Value = false;
|
|
command.Parameters.Add("pSERIAL", SDA.DataProvider.SDADBType.Int).Value = 0;
|
|
command.Parameters.Add("pCREATED", SDA.DataProvider.SDADBType.DateTime).Value = entity.EntityCreated;
|
|
command.Parameters.Add("pCREATOR", SDA.DataProvider.SDADBType.Int).Value = entity.EntityCreator;
|
|
entity.ID = Convert.ToInt32(command.ExecuteScalar());
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region UpdateEntity
|
|
|
|
private const string m_UpdateAttributesCommandText = @"
|
|
update T_PEDAGOGUSELETPALYAMODELL_OSSZES
|
|
set
|
|
{COLUMNS}
|
|
SERIAL = ISNULL(SERIAL,0) + 1,
|
|
LASTCHANGED = :pLASTCHANGED,
|
|
MODIFIER = :pMODIFIER,
|
|
TOROLT = :pTOROLT
|
|
where
|
|
(ID = :pID) and (ISNULL(SERIAL,0) = :pSERIAL)
|
|
";
|
|
|
|
public override bool UpdateEntity(PedagogusEletpalyamodell entity)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = DAUtil.CreateCommand(m_UpdateAttributesCommandText))
|
|
{
|
|
bool result = true;
|
|
dbhelper.DynamicBindAttributes(entity, command);
|
|
|
|
SetEntityModifier(entity, DateTime.Now, UserContext.Instance.UniqueIdentifier);
|
|
|
|
command.Parameters.Add("pID", SDA.DataProvider.SDADBType.Int).Value = entity.ID;
|
|
command.Parameters.Add("pSERIAL", SDA.DataProvider.SDADBType.Int).Value = entity.Serial;
|
|
command.Parameters.Add("pLASTCHANGED", SDA.DataProvider.SDADBType.DateTime).Value = entity.EntityLastChanged;
|
|
command.Parameters.Add("pMODIFIER", SDA.DataProvider.SDADBType.Int).Value = entity.EntityModifier;
|
|
command.Parameters.Add("pTOROLT", SDA.DataProvider.SDADBType.Boolean /* Boolean */).Value = entity.Torolt;
|
|
|
|
result = (command.ExecuteNonQuery() == 1);
|
|
if (result == true)
|
|
entity.Serial++;
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region DeleteEntity
|
|
|
|
private const string m_FizikaiDeleteCommandText = @"DELETE FROM T_PEDAGOGUSELETPALYAMODELL_OSSZES WHERE (ID = :pID) ";
|
|
private const string m_LogikaiDeleteCommandText = @"
|
|
UPDATE T_PEDAGOGUSELETPALYAMODELL_OSSZES
|
|
SET TOROLT = 'T' ,
|
|
SERIAL = SERIAL + 1,
|
|
LASTCHANGED = :pLASTCHANGED,
|
|
MODIFIER = :pMODIFIER
|
|
WHERE (ID = :pID) ";
|
|
|
|
public override void DeleteEntity(PedagogusEletpalyamodell entity, bool logikai = true)
|
|
{
|
|
var _deleteCommandText = logikai ? m_LogikaiDeleteCommandText : m_FizikaiDeleteCommandText;
|
|
using (SDA.DataProvider.SDACommand command = DAUtil.CreateCommand(_deleteCommandText))
|
|
{
|
|
command.Parameters.Add("pID", SDA.DataProvider.SDADBType.Int).Value = entity.ID;
|
|
|
|
if (logikai)
|
|
{
|
|
DateTime lastchanged = DateTime.Now;
|
|
var modifier = UserContext.Instance.UniqueIdentifier;
|
|
|
|
command.Parameters.Add("pLASTCHANGED", SDA.DataProvider.SDADBType.DateTime).Value = lastchanged;
|
|
command.Parameters.Add("pMODIFIER", SDA.DataProvider.SDADBType.Int).Value = modifier;
|
|
}
|
|
|
|
if (command.ExecuteNonQuery() != 1)
|
|
{
|
|
throw new EntityNotFoundException("PedagogusEletpalyamodell", entity.ID);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region UpdateAssociations
|
|
|
|
private const string m_UpdateAssociationCommandText = @"
|
|
update T_PEDAGOGUSELETPALYAMODELL_OSSZES
|
|
set
|
|
C_TANARID = :pTANARID,
|
|
C_INTEZMENYID = :pINTEZMENYID,
|
|
C_TANEVID = :pTANEVID,
|
|
SERIAL = ISNULL(SERIAL,0) + 1,
|
|
LASTCHANGED = :pLASTCHANGED,
|
|
MODIFIER = :pMODIFIER
|
|
where
|
|
(ID = :pID) and (ISNULL(SERIAL,0) = :pSERIAL)
|
|
";
|
|
|
|
public override bool UpdateAssociations(PedagogusEletpalyamodell entity)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = DAUtil.CreateCommand(m_UpdateAssociationCommandText))
|
|
{
|
|
dbhelper.BindAssociations(entity, command);
|
|
|
|
DateTime lastchanged = DateTime.Now;
|
|
var modifier = UserContext.Instance.UniqueIdentifier;
|
|
|
|
command.Parameters.Add("pID", SDA.DataProvider.SDADBType.Int).Value = entity.ID;
|
|
command.Parameters.Add("pSERIAL", SDA.DataProvider.SDADBType.Int).Value = entity.Serial;
|
|
command.Parameters.Add("pLASTCHANGED", SDA.DataProvider.SDADBType.DateTime).Value = lastchanged;
|
|
command.Parameters.Add("pMODIFIER", SDA.DataProvider.SDADBType.Int).Value = modifier;
|
|
|
|
bool result = (command.ExecuteNonQuery() == 1);
|
|
if (result == true)
|
|
{
|
|
entity.Serial++;
|
|
SetEntityModifier(entity, lastchanged, modifier);
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Asszociációkkal kapcsolatos adatbázisműveletek (entitásspecifikus)
|
|
|
|
#region Mint asszociációs osztály
|
|
#endregion
|
|
|
|
|
|
#endregion
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Az osztály elvégzi az UML modell 'Felhasznalo -> PedagogusEletpalyamodell (TanarEletpalyamodellje)'
|
|
/// asszociációjának teljes kezelését.
|
|
/// </summary>
|
|
internal class Felhasznalo_TanarEletpalyamodellje_DA : EntityCollectionDA<Felhasznalo, PedagogusEletpalyamodell>
|
|
{
|
|
internal protected Felhasznalo_TanarEletpalyamodellje_DA(Felhasznalo owner)
|
|
: base(owner)
|
|
{
|
|
}
|
|
|
|
// Nincs kapcsolótábla
|
|
private const string m_Filter = @" and (T_PEDAGOGUSELETPALYAMODELL_OSSZES.C_TANARID = :pID) ";
|
|
|
|
public override void LoadCollection(IAssociatedEntityCollection<PedagogusEletpalyamodell> collection)
|
|
{
|
|
new PedagogusEletpalyamodellDBHelper().LoadByPartnerId(collection, m_Filter, Owner.ID);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateInsertTanarEletpalyamodelljeCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_PEDAGOGUSELETPALYAMODELL_OSSZES set C_TANARID = :pTANARID where (ID = :pTANARELETPALYAMODELLJEID)";
|
|
result.Parameters.Add("pTANARID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pTANARELETPALYAMODELLJEID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoAdd(Felhasznalo owner, PedagogusEletpalyamodell partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateInsertTanarEletpalyamodelljeCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pTANARID"].Value = owner.ID;
|
|
command.Parameters["pTANARELETPALYAMODELLJEID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void AddItem(PedagogusEletpalyamodell entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<PedagogusEletpalyamodell, Felhasznalo>("TanarEletpalyamodellje_Tanar");
|
|
assochandler.BeforeInsert(entity, this.Owner);
|
|
entity.ModifyTanar(this.Owner);
|
|
if (entity.State == EntityState.Modified)
|
|
{
|
|
entity.UpdateAssociations(true);
|
|
}
|
|
else
|
|
{
|
|
entity.Insert(true);
|
|
}
|
|
assochandler.AfterInsert(entity, this.Owner);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateDeleteTanarEletpalyamodelljeCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_PEDAGOGUSELETPALYAMODELL_OSSZES set C_TANARID = null where (C_TANARID = :pTANARID and ID = :pTANARELETPALYAMODELLJEID)";
|
|
result.Parameters.Add("pTANARID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pTANARELETPALYAMODELLJEID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoRemove(Felhasznalo owner, PedagogusEletpalyamodell partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateDeleteTanarEletpalyamodelljeCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pTANARID"].Value = owner.ID;
|
|
command.Parameters["pTANARELETPALYAMODELLJEID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void DeleteItem(PedagogusEletpalyamodell entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<PedagogusEletpalyamodell, Felhasznalo>("TanarEletpalyamodellje_Tanar");
|
|
assochandler.BeforeDelete(entity, this.Owner);
|
|
entity.Delete(true);
|
|
assochandler.AfterDelete(entity, this.Owner);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Az osztály elvégzi az UML modell 'Intezmeny -> PedagogusEletpalyamodell (PedagogusEletpalyamodell)'
|
|
/// asszociációjának teljes kezelését.
|
|
/// </summary>
|
|
internal class Intezmeny_PedagogusEletpalyamodell_DA : EntityCollectionDA<Intezmeny, PedagogusEletpalyamodell>
|
|
{
|
|
internal protected Intezmeny_PedagogusEletpalyamodell_DA(Intezmeny owner)
|
|
: base(owner)
|
|
{
|
|
}
|
|
|
|
// Nincs kapcsolótábla
|
|
private const string m_Filter = @" and (T_PEDAGOGUSELETPALYAMODELL_OSSZES.C_INTEZMENYID = :pID) ";
|
|
|
|
public override void LoadCollection(IAssociatedEntityCollection<PedagogusEletpalyamodell> collection)
|
|
{
|
|
new PedagogusEletpalyamodellDBHelper().LoadByPartnerId(collection, m_Filter, Owner.ID);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateInsertPedagogusEletpalyamodellCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_PEDAGOGUSELETPALYAMODELL_OSSZES set C_INTEZMENYID = :pINTEZMENYID where (ID = :pPEDAGOGUSELETPALYAMODELLID)";
|
|
result.Parameters.Add("pINTEZMENYID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pPEDAGOGUSELETPALYAMODELLID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoAdd(Intezmeny owner, PedagogusEletpalyamodell partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateInsertPedagogusEletpalyamodellCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pINTEZMENYID"].Value = owner.ID;
|
|
command.Parameters["pPEDAGOGUSELETPALYAMODELLID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void AddItem(PedagogusEletpalyamodell entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<PedagogusEletpalyamodell, Intezmeny>("PedagogusEletpalyamodell_Intezmeny");
|
|
assochandler.BeforeInsert(entity, this.Owner);
|
|
entity.ModifyIntezmeny(this.Owner);
|
|
if (entity.State == EntityState.Modified)
|
|
{
|
|
entity.UpdateAssociations(true);
|
|
}
|
|
else
|
|
{
|
|
entity.Insert(true);
|
|
}
|
|
assochandler.AfterInsert(entity, this.Owner);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateDeletePedagogusEletpalyamodellCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_PEDAGOGUSELETPALYAMODELL_OSSZES set C_INTEZMENYID = null where (C_INTEZMENYID = :pINTEZMENYID and ID = :pPEDAGOGUSELETPALYAMODELLID)";
|
|
result.Parameters.Add("pINTEZMENYID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pPEDAGOGUSELETPALYAMODELLID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoRemove(Intezmeny owner, PedagogusEletpalyamodell partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateDeletePedagogusEletpalyamodellCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pINTEZMENYID"].Value = owner.ID;
|
|
command.Parameters["pPEDAGOGUSELETPALYAMODELLID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void DeleteItem(PedagogusEletpalyamodell entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<PedagogusEletpalyamodell, Intezmeny>("PedagogusEletpalyamodell_Intezmeny");
|
|
assochandler.BeforeDelete(entity, this.Owner);
|
|
entity.Delete(true);
|
|
assochandler.AfterDelete(entity, this.Owner);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Az osztály elvégzi az UML modell 'Tanev -> PedagogusEletpalyamodell (PedagogusEletpalyamodell)'
|
|
/// asszociációjának teljes kezelését.
|
|
/// </summary>
|
|
internal class Tanev_PedagogusEletpalyamodell_DA : EntityCollectionDA<Tanev, PedagogusEletpalyamodell>
|
|
{
|
|
internal protected Tanev_PedagogusEletpalyamodell_DA(Tanev owner)
|
|
: base(owner)
|
|
{
|
|
}
|
|
|
|
// Nincs kapcsolótábla
|
|
private const string m_Filter = @" and (T_PEDAGOGUSELETPALYAMODELL_OSSZES.C_TANEVID = :pID) ";
|
|
|
|
public override void LoadCollection(IAssociatedEntityCollection<PedagogusEletpalyamodell> collection)
|
|
{
|
|
new PedagogusEletpalyamodellDBHelper().LoadByPartnerId(collection, m_Filter, Owner.ID);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateInsertPedagogusEletpalyamodellCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_PEDAGOGUSELETPALYAMODELL_OSSZES set C_TANEVID = :pTANEVID where (ID = :pPEDAGOGUSELETPALYAMODELLID)";
|
|
result.Parameters.Add("pTANEVID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pPEDAGOGUSELETPALYAMODELLID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoAdd(Tanev owner, PedagogusEletpalyamodell partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateInsertPedagogusEletpalyamodellCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pTANEVID"].Value = owner.ID;
|
|
command.Parameters["pPEDAGOGUSELETPALYAMODELLID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void AddItem(PedagogusEletpalyamodell entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<PedagogusEletpalyamodell, Tanev>("PedagogusEletpalyamodell_Tanev");
|
|
assochandler.BeforeInsert(entity, this.Owner);
|
|
entity.ModifyTanev(this.Owner);
|
|
if (entity.State == EntityState.Modified)
|
|
{
|
|
entity.UpdateAssociations(true);
|
|
}
|
|
else
|
|
{
|
|
entity.Insert(true);
|
|
}
|
|
assochandler.AfterInsert(entity, this.Owner);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateDeletePedagogusEletpalyamodellCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_PEDAGOGUSELETPALYAMODELL_OSSZES set C_TANEVID = null where (C_TANEVID = :pTANEVID and ID = :pPEDAGOGUSELETPALYAMODELLID)";
|
|
result.Parameters.Add("pTANEVID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pPEDAGOGUSELETPALYAMODELLID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoRemove(Tanev owner, PedagogusEletpalyamodell partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateDeletePedagogusEletpalyamodellCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pTANEVID"].Value = owner.ID;
|
|
command.Parameters["pPEDAGOGUSELETPALYAMODELLID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void DeleteItem(PedagogusEletpalyamodell entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<PedagogusEletpalyamodell, Tanev>("PedagogusEletpalyamodell_Tanev");
|
|
assochandler.BeforeDelete(entity, this.Owner);
|
|
entity.Delete(true);
|
|
assochandler.AfterDelete(entity, this.Owner);
|
|
}
|
|
}
|
|
|
|
}
|
|
|