564 lines
23 KiB
C#
564 lines
23 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 IntezmenyConfigDBHelper : EntityDBHelper<IntezmenyConfig>
|
|
{
|
|
private Dictionary<string, string> dynamicColumns = new Dictionary<string, string>()
|
|
{
|
|
{ "Ertek", "T_INTEZMENYCONFIG_OSSZES.C_ERTEK" },
|
|
};
|
|
|
|
private const string dynamicQueryCommandText =
|
|
"select " +
|
|
"T_INTEZMENYCONFIG_OSSZES.ID, " +
|
|
"{COLUMNS}" +
|
|
// IntezmenyConfig betöltése
|
|
// IntezmenyConfig kapcsoló mezői
|
|
"T_INTEZMENYCONFIG_OSSZES.C_CONFIGTIPUSID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_INTEZMENYCONFIG_OSSZES.C_INTEZMENYID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_INTEZMENYCONFIG_OSSZES.TOROLT, " +
|
|
"T_INTEZMENYCONFIG_OSSZES.SERIAL, " +
|
|
"T_INTEZMENYCONFIG_OSSZES.CREATED, " +
|
|
"T_INTEZMENYCONFIG_OSSZES.CREATOR, " +
|
|
"T_INTEZMENYCONFIG_OSSZES.LASTCHANGED, " +
|
|
"T_INTEZMENYCONFIG_OSSZES.MODIFIER " +
|
|
"from " +
|
|
"T_INTEZMENYCONFIG_OSSZES " +
|
|
"where " +
|
|
"(1 = 1) ";
|
|
|
|
private const string emptyQueryCommandText =
|
|
"select " +
|
|
"T_INTEZMENYCONFIG_OSSZES.ID, " +
|
|
// IntezmenyConfig betöltése
|
|
// IntezmenyConfig mezői
|
|
"T_INTEZMENYCONFIG_OSSZES.C_ERTEK, " +
|
|
// IntezmenyConfig kapcsoló mezői
|
|
"T_INTEZMENYCONFIG_OSSZES.C_CONFIGTIPUSID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_INTEZMENYCONFIG_OSSZES.C_INTEZMENYID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_INTEZMENYCONFIG_OSSZES.TOROLT, " +
|
|
"T_INTEZMENYCONFIG_OSSZES.SERIAL, " +
|
|
"T_INTEZMENYCONFIG_OSSZES.CREATED, " +
|
|
"T_INTEZMENYCONFIG_OSSZES.CREATOR, " +
|
|
"T_INTEZMENYCONFIG_OSSZES.LASTCHANGED, " +
|
|
"T_INTEZMENYCONFIG_OSSZES.MODIFIER " +
|
|
"from " +
|
|
"T_INTEZMENYCONFIG_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 IntezmenyConfig CreateEntityInstance()
|
|
{
|
|
return IntezmenyConfig.GiveAnInstance();
|
|
}
|
|
|
|
#region Lekérdezés
|
|
|
|
public override void LoadEntityFields(IntezmenyConfig entity, SDA.DataProvider.SDADataReader reader)
|
|
{
|
|
// IntezmenyConfig betöltése
|
|
// IntezmenyConfig mezői
|
|
|
|
entity.m_Ertek = DAUtil.ReadStringAttribute(reader, 1);
|
|
|
|
// IntezmenyConfig kapcsoló mezői
|
|
DAUtil.ReadIDAttribute(reader, 2, ref entity.m_ConfigTipusId, 0);
|
|
DAUtil.ReadIDAttribute(reader, 3, ref entity.m_IntezmenyId, 0);
|
|
}
|
|
|
|
public override void LoadEntityFields(IntezmenyConfig entity, SDA.DataProvider.SDADataReader reader, ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
|
|
{
|
|
int index = 1;
|
|
if (columns == null)
|
|
{
|
|
columns = new List<string>(index);
|
|
}
|
|
// IntezmenyConfig betöltése
|
|
// IntezmenyConfig mezői
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("Ertek"))))
|
|
{
|
|
entity.m_Ertek = DAUtil.ReadStringAttribute(reader, index++);
|
|
}
|
|
// IntezmenyConfig kapcsoló mezői
|
|
DAUtil.ReadIDAttribute(reader, index++, ref entity.m_ConfigTipusId, 0);
|
|
DAUtil.ReadIDAttribute(reader, index++, ref entity.m_IntezmenyId, 0);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Paraméter kötés
|
|
|
|
public override void BindAttributes(IntezmenyConfig entity, SDA.DataProvider.SDACommand command)
|
|
{
|
|
DAUtil.BindParameter(command, "pERTEK", SDA.DataProvider.SDADBType.String, 255, entity.m_Ertek, entity.m_Ertek == null);
|
|
}
|
|
|
|
public override void DynamicBindAttributes(IntezmenyConfig entity, SDA.DataProvider.SDACommand command)
|
|
{
|
|
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
|
if (entity.HasChanged("Ertek"))
|
|
{
|
|
sb.Append("C_ERTEK = :pERTEK,");
|
|
|
|
DAUtil.BindParameter(command, "pERTEK", SDA.DataProvider.SDADBType.String, 255, entity.m_Ertek, entity.m_Ertek == null);
|
|
|
|
}
|
|
command.CommandText = command.CommandText.Replace("{COLUMNS}", sb.ToString());
|
|
}
|
|
|
|
public override void BindAssociations(IntezmenyConfig entity, SDA.DataProvider.SDACommand command)
|
|
{
|
|
DAUtil.BindIdParameter(command, "pCONFIGTIPUSID", entity.InternalConfigTipusId);
|
|
DAUtil.BindIdParameter(command, "pINTEZMENYID", entity.InternalIntezmenyId);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
internal class IntezmenyConfigDA : EntityDataAccessor<IntezmenyConfig>
|
|
{
|
|
private static IntezmenyConfigDBHelper m_dbhelper = new IntezmenyConfigDBHelper();
|
|
|
|
protected override IEntityDBHelper<IntezmenyConfig> dbhelper
|
|
{
|
|
get { return m_dbhelper; }
|
|
}
|
|
|
|
#region Load
|
|
|
|
public override bool LoadEntity(IntezmenyConfig entity, int entityId)
|
|
{
|
|
return LoadById(entity, entityId);
|
|
}
|
|
|
|
public override bool FilteredLoadEntity(IntezmenyConfig entity, int entityId, ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
|
|
{
|
|
return LoadById(entity, entityId, columnFilterMode, columns);
|
|
}
|
|
|
|
public bool LoadById(IntezmenyConfig entity, int entityId)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = dbhelper.CreateEmptyQueryCommand())
|
|
{
|
|
command.CommandText += " and (T_INTEZMENYCONFIG_OSSZES.ID = :pID) ";
|
|
command.Parameters.Add("pID", SDA.DataProvider.SDADBType.Int).Value = entityId;
|
|
return dbhelper.LoadSingleEntity(entity, command);
|
|
}
|
|
}
|
|
|
|
public bool LoadById(IntezmenyConfig entity, int entityId, ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = dbhelper.CreateDynamicQueryCommand(columnFilterMode, columns))
|
|
{
|
|
command.CommandText += " and (T_INTEZMENYCONFIG_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<IntezmenyConfig> 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<IntezmenyConfig> 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_INTEZMENYCONFIG_OSSZES (
|
|
C_ERTEK,
|
|
C_CONFIGTIPUSID,
|
|
C_INTEZMENYID,
|
|
TOROLT,
|
|
SERIAL,
|
|
CREATED,
|
|
CREATOR)
|
|
values (
|
|
:pERTEK,
|
|
:pCONFIGTIPUSID,
|
|
:pINTEZMENYID,
|
|
:pTOROLT,
|
|
:pSERIAL,
|
|
:pCREATED,
|
|
:pCREATOR);
|
|
|
|
SELECT SCOPE_IDENTITY() as ID;
|
|
|
|
";
|
|
|
|
public override void InsertEntity(IntezmenyConfig 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_INTEZMENYCONFIG_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(IntezmenyConfig 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_INTEZMENYCONFIG_OSSZES WHERE (ID = :pID) ";
|
|
private const string m_LogikaiDeleteCommandText = @"
|
|
UPDATE T_INTEZMENYCONFIG_OSSZES
|
|
SET TOROLT = 'T' ,
|
|
SERIAL = SERIAL + 1,
|
|
LASTCHANGED = :pLASTCHANGED,
|
|
MODIFIER = :pMODIFIER
|
|
WHERE (ID = :pID) ";
|
|
|
|
public override void DeleteEntity(IntezmenyConfig 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("IntezmenyConfig", entity.ID);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region UpdateAssociations
|
|
|
|
private const string m_UpdateAssociationCommandText = @"
|
|
update T_INTEZMENYCONFIG_OSSZES
|
|
set
|
|
C_CONFIGTIPUSID = :pCONFIGTIPUSID,
|
|
C_INTEZMENYID = :pINTEZMENYID,
|
|
SERIAL = ISNULL(SERIAL,0) + 1,
|
|
LASTCHANGED = :pLASTCHANGED,
|
|
MODIFIER = :pMODIFIER
|
|
where
|
|
(ID = :pID) and (ISNULL(SERIAL,0) = :pSERIAL)
|
|
";
|
|
|
|
public override bool UpdateAssociations(IntezmenyConfig 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 'ConfigTipus -> IntezmenyConfig (IntezmenyConfig)'
|
|
/// asszociációjának teljes kezelését.
|
|
/// </summary>
|
|
internal class ConfigTipus_IntezmenyConfig_DA : EntityCollectionDA<ConfigTipus, IntezmenyConfig>
|
|
{
|
|
internal protected ConfigTipus_IntezmenyConfig_DA(ConfigTipus owner)
|
|
: base(owner)
|
|
{
|
|
}
|
|
|
|
// Nincs kapcsolótábla
|
|
private const string m_Filter = @" and (T_INTEZMENYCONFIG_OSSZES.C_CONFIGTIPUSID = :pID) ";
|
|
|
|
public override void LoadCollection(IAssociatedEntityCollection<IntezmenyConfig> collection)
|
|
{
|
|
new IntezmenyConfigDBHelper().LoadByPartnerId(collection, m_Filter, Owner.ID);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateInsertIntezmenyConfigCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_INTEZMENYCONFIG_OSSZES set C_CONFIGTIPUSID = :pCONFIGTIPUSID where (ID = :pINTEZMENYCONFIGID)";
|
|
result.Parameters.Add("pCONFIGTIPUSID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pINTEZMENYCONFIGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoAdd(ConfigTipus owner, IntezmenyConfig partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateInsertIntezmenyConfigCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pCONFIGTIPUSID"].Value = owner.ID;
|
|
command.Parameters["pINTEZMENYCONFIGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void AddItem(IntezmenyConfig entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<ConfigTipus, IntezmenyConfig>("ConfigTipus_IntezmenyConfig");
|
|
assochandler.BeforeInsert(this.Owner, entity);
|
|
entity.ModifyConfigTipus(this.Owner);
|
|
if (entity.State == EntityState.Modified)
|
|
{
|
|
entity.UpdateAssociations(true);
|
|
}
|
|
else
|
|
{
|
|
entity.Insert(true);
|
|
}
|
|
assochandler.AfterInsert(this.Owner, entity);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateDeleteIntezmenyConfigCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_INTEZMENYCONFIG_OSSZES set C_CONFIGTIPUSID = null where (C_CONFIGTIPUSID = :pCONFIGTIPUSID and ID = :pINTEZMENYCONFIGID)";
|
|
result.Parameters.Add("pCONFIGTIPUSID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pINTEZMENYCONFIGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoRemove(ConfigTipus owner, IntezmenyConfig partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateDeleteIntezmenyConfigCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pCONFIGTIPUSID"].Value = owner.ID;
|
|
command.Parameters["pINTEZMENYCONFIGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void DeleteItem(IntezmenyConfig entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<ConfigTipus, IntezmenyConfig>("ConfigTipus_IntezmenyConfig");
|
|
assochandler.BeforeDelete(this.Owner, entity);
|
|
entity.Delete(true);
|
|
assochandler.AfterDelete(this.Owner, entity);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Az osztály elvégzi az UML modell 'Intezmeny -> IntezmenyConfig (IntezmenyConfig)'
|
|
/// asszociációjának teljes kezelését.
|
|
/// </summary>
|
|
internal class Intezmeny_IntezmenyConfig_DA : EntityCollectionDA<Intezmeny, IntezmenyConfig>
|
|
{
|
|
internal protected Intezmeny_IntezmenyConfig_DA(Intezmeny owner)
|
|
: base(owner)
|
|
{
|
|
}
|
|
|
|
// Nincs kapcsolótábla
|
|
private const string m_Filter = @" and (T_INTEZMENYCONFIG_OSSZES.C_INTEZMENYID = :pID) ";
|
|
|
|
public override void LoadCollection(IAssociatedEntityCollection<IntezmenyConfig> collection)
|
|
{
|
|
new IntezmenyConfigDBHelper().LoadByPartnerId(collection, m_Filter, Owner.ID);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateInsertIntezmenyConfigCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_INTEZMENYCONFIG_OSSZES set C_INTEZMENYID = :pINTEZMENYID where (ID = :pINTEZMENYCONFIGID)";
|
|
result.Parameters.Add("pINTEZMENYID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pINTEZMENYCONFIGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoAdd(Intezmeny owner, IntezmenyConfig partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateInsertIntezmenyConfigCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pINTEZMENYID"].Value = owner.ID;
|
|
command.Parameters["pINTEZMENYCONFIGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void AddItem(IntezmenyConfig entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<Intezmeny, IntezmenyConfig>("Intezmeny_IntezmenyConfig");
|
|
assochandler.BeforeInsert(this.Owner, entity);
|
|
entity.ModifyIntezmeny(this.Owner);
|
|
if (entity.State == EntityState.Modified)
|
|
{
|
|
entity.UpdateAssociations(true);
|
|
}
|
|
else
|
|
{
|
|
entity.Insert(true);
|
|
}
|
|
assochandler.AfterInsert(this.Owner, entity);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateDeleteIntezmenyConfigCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_INTEZMENYCONFIG_OSSZES set C_INTEZMENYID = null where (C_INTEZMENYID = :pINTEZMENYID and ID = :pINTEZMENYCONFIGID)";
|
|
result.Parameters.Add("pINTEZMENYID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pINTEZMENYCONFIGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoRemove(Intezmeny owner, IntezmenyConfig partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateDeleteIntezmenyConfigCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pINTEZMENYID"].Value = owner.ID;
|
|
command.Parameters["pINTEZMENYCONFIGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void DeleteItem(IntezmenyConfig entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<Intezmeny, IntezmenyConfig>("Intezmeny_IntezmenyConfig");
|
|
assochandler.BeforeDelete(this.Owner, entity);
|
|
entity.Delete(true);
|
|
assochandler.AfterDelete(this.Owner, entity);
|
|
}
|
|
}
|
|
|
|
}
|
|
|