kreta/Kreta.DataAccessGenerated/DataAccessors/BeszerzesiSzallitotorzsDA.cs
2024-03-13 00:33:46 +01:00

824 lines
35 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 BeszerzesiSzallitotorzsDBHelper : EntityDBHelper<BeszerzesiSzallitotorzs>
{
private Dictionary<string, string> dynamicColumns = new Dictionary<string, string>()
{
{ "Adoszam", "T_BESZERZESISZALLITOTORZS_OSSZES.C_ADOSZAM" },
{ "Ajto", "T_BESZERZESISZALLITOTORZS_OSSZES.C_AJTO" },
{ "EmailCim", "T_BESZERZESISZALLITOTORZS_OSSZES.C_EMAILCIM" },
{ "Emelet", "T_BESZERZESISZALLITOTORZS_OSSZES.C_EMELET" },
{ "Hazszam", "T_BESZERZESISZALLITOTORZS_OSSZES.C_HAZSZAM" },
{ "HelysegNev", "T_BESZERZESISZALLITOTORZS_OSSZES.C_HELYSEGNEV" },
{ "IrSzam", "T_BESZERZESISZALLITOTORZS_OSSZES.C_IRSZAM" },
{ "KepviseloNev", "T_BESZERZESISZALLITOTORZS_OSSZES.C_KEPVISELONEV" },
{ "KozteruletJellegId", "T_BESZERZESISZALLITOTORZS_OSSZES.C_KOZTERULETJELLEGID" },
{ "KozteruletNev", "T_BESZERZESISZALLITOTORZS_OSSZES.C_KOZTERULETNEV" },
{ "Nev", "T_BESZERZESISZALLITOTORZS_OSSZES.C_NEV" },
{ "SAPKod", "T_BESZERZESISZALLITOTORZS_OSSZES.C_SAPKOD" },
{ "Telefonszam", "T_BESZERZESISZALLITOTORZS_OSSZES.C_TELEFONSZAM" },
{ "FizetesiMod", "T_BESZERZESISZALLITOTORZS_OSSZES.C_FIZETESIMOD" },
};
private const string dynamicQueryCommandText =
"select " +
"T_BESZERZESISZALLITOTORZS_OSSZES.ID, " +
"{COLUMNS}" +
// BeszerzesiSzallitotorzs betöltése
// BeszerzesiSzallitotorzs kapcsoló mezői
"T_BESZERZESISZALLITOTORZS_OSSZES.C_INTEZMENYID, " + /* Kötelező asszociációs kapcsolómező */
"T_BESZERZESISZALLITOTORZS_OSSZES.C_TANEVID, " + /* Kötelező asszociációs kapcsolómező */
"T_BESZERZESISZALLITOTORZS_OSSZES.TOROLT, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.SERIAL, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.CREATED, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.CREATOR, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.LASTCHANGED, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.MODIFIER " +
"from " +
"T_BESZERZESISZALLITOTORZS_OSSZES " +
"where " +
"(1 = 1) ";
private const string emptyQueryCommandText =
"select " +
"T_BESZERZESISZALLITOTORZS_OSSZES.ID, " +
// BeszerzesiSzallitotorzs betöltése
// BeszerzesiSzallitotorzs mezői
"T_BESZERZESISZALLITOTORZS_OSSZES.C_ADOSZAM, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.C_AJTO, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.C_EMAILCIM, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.C_EMELET, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.C_HAZSZAM, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.C_HELYSEGNEV, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.C_IRSZAM, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.C_KEPVISELONEV, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.C_KOZTERULETJELLEGID, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.C_KOZTERULETNEV, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.C_NEV, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.C_SAPKOD, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.C_TELEFONSZAM, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.C_FIZETESIMOD, " +
// BeszerzesiSzallitotorzs kapcsoló mezői
"T_BESZERZESISZALLITOTORZS_OSSZES.C_INTEZMENYID, " + /* Kötelező asszociációs kapcsolómező */
"T_BESZERZESISZALLITOTORZS_OSSZES.C_TANEVID, " + /* Kötelező asszociációs kapcsolómező */
"T_BESZERZESISZALLITOTORZS_OSSZES.TOROLT, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.SERIAL, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.CREATED, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.CREATOR, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.LASTCHANGED, " +
"T_BESZERZESISZALLITOTORZS_OSSZES.MODIFIER " +
"from " +
"T_BESZERZESISZALLITOTORZS_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 BeszerzesiSzallitotorzs CreateEntityInstance()
{
return BeszerzesiSzallitotorzs.GiveAnInstance();
}
#region Lekérdezés
public override void LoadEntityFields(BeszerzesiSzallitotorzs entity, SDA.DataProvider.SDADataReader reader)
{
// BeszerzesiSzallitotorzs betöltése
// BeszerzesiSzallitotorzs mezői
entity.m_Adoszam = DAUtil.ReadStringAttribute(reader, 1);
entity.m_Ajto = DAUtil.ReadStringAttribute(reader, 2);
entity.m_EmailCim = DAUtil.ReadStringAttribute(reader, 3);
entity.m_Emelet = DAUtil.ReadStringAttribute(reader, 4);
entity.m_Hazszam = DAUtil.ReadStringAttribute(reader, 5);
entity.m_HelysegNev = DAUtil.ReadStringAttribute(reader, 6);
entity.m_IrSzam = DAUtil.ReadStringAttribute(reader, 7);
entity.m_KepviseloNev = DAUtil.ReadStringAttribute(reader, 8);
entity.m_KozteruletJellegId = DAUtil.ReadIntegerAttribute(reader, 9);
entity.m_KozteruletNev = DAUtil.ReadStringAttribute(reader, 10);
entity.m_Nev = DAUtil.ReadStringAttribute(reader, 11);
entity.m_SAPKod = DAUtil.ReadStringAttribute(reader, 12);
entity.m_Telefonszam = DAUtil.ReadStringAttribute(reader, 13);
entity.m_FizetesiMod = DAUtil.ReadStringAttribute(reader, 14);
// BeszerzesiSzallitotorzs kapcsoló mezői
DAUtil.ReadIDAttribute(reader, 15, ref entity.m_IntezmenyId, 0);
DAUtil.ReadIDAttribute(reader, 16, ref entity.m_TanevId, 0);
}
public override void LoadEntityFields(BeszerzesiSzallitotorzs entity, SDA.DataProvider.SDADataReader reader, ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
{
int index = 1;
if (columns == null)
{
columns = new List<string>(index);
}
// BeszerzesiSzallitotorzs betöltése
// BeszerzesiSzallitotorzs mezői
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("Adoszam"))))
{
entity.m_Adoszam = DAUtil.ReadStringAttribute(reader, index++);
}
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("Ajto"))))
{
entity.m_Ajto = DAUtil.ReadStringAttribute(reader, index++);
}
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("EmailCim"))))
{
entity.m_EmailCim = DAUtil.ReadStringAttribute(reader, index++);
}
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("Emelet"))))
{
entity.m_Emelet = DAUtil.ReadStringAttribute(reader, index++);
}
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("Hazszam"))))
{
entity.m_Hazszam = DAUtil.ReadStringAttribute(reader, index++);
}
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("HelysegNev"))))
{
entity.m_HelysegNev = DAUtil.ReadStringAttribute(reader, index++);
}
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("IrSzam"))))
{
entity.m_IrSzam = DAUtil.ReadStringAttribute(reader, index++);
}
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("KepviseloNev"))))
{
entity.m_KepviseloNev = DAUtil.ReadStringAttribute(reader, index++);
}
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("KozteruletJellegId"))))
{
entity.m_KozteruletJellegId = DAUtil.ReadIntegerAttribute(reader, index++);
}
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("KozteruletNev"))))
{
entity.m_KozteruletNev = DAUtil.ReadStringAttribute(reader, index++);
}
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("Nev"))))
{
entity.m_Nev = DAUtil.ReadStringAttribute(reader, index++);
}
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("SAPKod"))))
{
entity.m_SAPKod = DAUtil.ReadStringAttribute(reader, index++);
}
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("Telefonszam"))))
{
entity.m_Telefonszam = DAUtil.ReadStringAttribute(reader, index++);
}
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("FizetesiMod"))))
{
entity.m_FizetesiMod = DAUtil.ReadStringAttribute(reader, index++);
}
// BeszerzesiSzallitotorzs kapcsoló mezői
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(BeszerzesiSzallitotorzs entity, SDA.DataProvider.SDACommand command)
{
DAUtil.BindParameter(command, "pADOSZAM", SDA.DataProvider.SDADBType.String, 50, entity.m_Adoszam, entity.m_Adoszam == null);
DAUtil.BindParameter(command, "pAJTO", SDA.DataProvider.SDADBType.String, 50, entity.m_Ajto, entity.m_Ajto == null);
DAUtil.BindParameter(command, "pEMAILCIM", SDA.DataProvider.SDADBType.String, 255, entity.m_EmailCim, entity.m_EmailCim == null);
DAUtil.BindParameter(command, "pEMELET", SDA.DataProvider.SDADBType.String, 50, entity.m_Emelet, entity.m_Emelet == null);
DAUtil.BindParameter(command, "pHAZSZAM", SDA.DataProvider.SDADBType.String, 50, entity.m_Hazszam, entity.m_Hazszam == null);
DAUtil.BindParameter(command, "pHELYSEGNEV", SDA.DataProvider.SDADBType.String, 255, entity.m_HelysegNev, entity.m_HelysegNev == null);
DAUtil.BindParameter(command, "pIRSZAM", SDA.DataProvider.SDADBType.String, 50, entity.m_IrSzam, entity.m_IrSzam == null);
DAUtil.BindParameter(command, "pKEPVISELONEV", SDA.DataProvider.SDADBType.String, 255, entity.m_KepviseloNev, entity.m_KepviseloNev == null);
DAUtil.BindParameter(command, "pKOZTERULETJELLEGID", SDA.DataProvider.SDADBType.Int /* DictionaryItem */, 15, entity.m_KozteruletJellegId, entity.m_KozteruletJellegId == null);
DAUtil.BindParameter(command, "pKOZTERULETNEV", SDA.DataProvider.SDADBType.String, 255, entity.m_KozteruletNev, entity.m_KozteruletNev == null);
DAUtil.BindParameter(command, "pNEV", SDA.DataProvider.SDADBType.String, 500, entity.m_Nev, entity.m_Nev == null);
DAUtil.BindParameter(command, "pSAPKOD", SDA.DataProvider.SDADBType.String, 50, entity.m_SAPKod, entity.m_SAPKod == null);
DAUtil.BindParameter(command, "pTELEFONSZAM", SDA.DataProvider.SDADBType.String, 255, entity.m_Telefonszam, entity.m_Telefonszam == null);
DAUtil.BindParameter(command, "pFIZETESIMOD", SDA.DataProvider.SDADBType.String, 50, entity.m_FizetesiMod, entity.m_FizetesiMod == null);
}
public override void DynamicBindAttributes(BeszerzesiSzallitotorzs entity, SDA.DataProvider.SDACommand command)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
if (entity.HasChanged("Adoszam"))
{
sb.Append("C_ADOSZAM = :pADOSZAM,");
DAUtil.BindParameter(command, "pADOSZAM", SDA.DataProvider.SDADBType.String, 50, entity.m_Adoszam, entity.m_Adoszam == null);
}
if (entity.HasChanged("Ajto"))
{
sb.Append("C_AJTO = :pAJTO,");
DAUtil.BindParameter(command, "pAJTO", SDA.DataProvider.SDADBType.String, 50, entity.m_Ajto, entity.m_Ajto == null);
}
if (entity.HasChanged("EmailCim"))
{
sb.Append("C_EMAILCIM = :pEMAILCIM,");
DAUtil.BindParameter(command, "pEMAILCIM", SDA.DataProvider.SDADBType.String, 255, entity.m_EmailCim, entity.m_EmailCim == null);
}
if (entity.HasChanged("Emelet"))
{
sb.Append("C_EMELET = :pEMELET,");
DAUtil.BindParameter(command, "pEMELET", SDA.DataProvider.SDADBType.String, 50, entity.m_Emelet, entity.m_Emelet == null);
}
if (entity.HasChanged("Hazszam"))
{
sb.Append("C_HAZSZAM = :pHAZSZAM,");
DAUtil.BindParameter(command, "pHAZSZAM", SDA.DataProvider.SDADBType.String, 50, entity.m_Hazszam, entity.m_Hazszam == null);
}
if (entity.HasChanged("HelysegNev"))
{
sb.Append("C_HELYSEGNEV = :pHELYSEGNEV,");
DAUtil.BindParameter(command, "pHELYSEGNEV", SDA.DataProvider.SDADBType.String, 255, entity.m_HelysegNev, entity.m_HelysegNev == null);
}
if (entity.HasChanged("IrSzam"))
{
sb.Append("C_IRSZAM = :pIRSZAM,");
DAUtil.BindParameter(command, "pIRSZAM", SDA.DataProvider.SDADBType.String, 50, entity.m_IrSzam, entity.m_IrSzam == null);
}
if (entity.HasChanged("KepviseloNev"))
{
sb.Append("C_KEPVISELONEV = :pKEPVISELONEV,");
DAUtil.BindParameter(command, "pKEPVISELONEV", SDA.DataProvider.SDADBType.String, 255, entity.m_KepviseloNev, entity.m_KepviseloNev == null);
}
if (entity.HasChanged("KozteruletJellegId"))
{
sb.Append("C_KOZTERULETJELLEGID = :pKOZTERULETJELLEGID,");
DAUtil.BindParameter(command, "pKOZTERULETJELLEGID", SDA.DataProvider.SDADBType.Int /* DictionaryItem */, 15, entity.m_KozteruletJellegId, entity.m_KozteruletJellegId == null);
}
if (entity.HasChanged("KozteruletNev"))
{
sb.Append("C_KOZTERULETNEV = :pKOZTERULETNEV,");
DAUtil.BindParameter(command, "pKOZTERULETNEV", SDA.DataProvider.SDADBType.String, 255, entity.m_KozteruletNev, entity.m_KozteruletNev == null);
}
if (entity.HasChanged("Nev"))
{
sb.Append("C_NEV = :pNEV,");
DAUtil.BindParameter(command, "pNEV", SDA.DataProvider.SDADBType.String, 500, entity.m_Nev, entity.m_Nev == null);
}
if (entity.HasChanged("SAPKod"))
{
sb.Append("C_SAPKOD = :pSAPKOD,");
DAUtil.BindParameter(command, "pSAPKOD", SDA.DataProvider.SDADBType.String, 50, entity.m_SAPKod, entity.m_SAPKod == null);
}
if (entity.HasChanged("Telefonszam"))
{
sb.Append("C_TELEFONSZAM = :pTELEFONSZAM,");
DAUtil.BindParameter(command, "pTELEFONSZAM", SDA.DataProvider.SDADBType.String, 255, entity.m_Telefonszam, entity.m_Telefonszam == null);
}
if (entity.HasChanged("FizetesiMod"))
{
sb.Append("C_FIZETESIMOD = :pFIZETESIMOD,");
DAUtil.BindParameter(command, "pFIZETESIMOD", SDA.DataProvider.SDADBType.String, 50, entity.m_FizetesiMod, entity.m_FizetesiMod == null);
}
command.CommandText = command.CommandText.Replace("{COLUMNS}", sb.ToString());
}
public override void BindAssociations(BeszerzesiSzallitotorzs entity, SDA.DataProvider.SDACommand command)
{
DAUtil.BindIdParameter(command, "pINTEZMENYID", entity.InternalIntezmenyId);
DAUtil.BindIdParameter(command, "pTANEVID", entity.InternalTanevId);
}
#endregion
}
internal class BeszerzesiSzallitotorzsDA : EntityDataAccessor<BeszerzesiSzallitotorzs>
{
private static BeszerzesiSzallitotorzsDBHelper m_dbhelper = new BeszerzesiSzallitotorzsDBHelper();
protected override IEntityDBHelper<BeszerzesiSzallitotorzs> dbhelper
{
get { return m_dbhelper; }
}
#region Load
public override bool LoadEntity(BeszerzesiSzallitotorzs entity, int entityId)
{
return LoadById(entity, entityId);
}
public override bool FilteredLoadEntity(BeszerzesiSzallitotorzs entity, int entityId, ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
{
return LoadById(entity, entityId, columnFilterMode, columns);
}
public bool LoadById(BeszerzesiSzallitotorzs entity, int entityId)
{
using (SDA.DataProvider.SDACommand command = dbhelper.CreateEmptyQueryCommand())
{
command.CommandText += " and (T_BESZERZESISZALLITOTORZS_OSSZES.ID = :pID) ";
command.Parameters.Add("pID", SDA.DataProvider.SDADBType.Int).Value = entityId;
return dbhelper.LoadSingleEntity(entity, command);
}
}
public bool LoadById(BeszerzesiSzallitotorzs entity, int entityId, ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
{
using (SDA.DataProvider.SDACommand command = dbhelper.CreateDynamicQueryCommand(columnFilterMode, columns))
{
command.CommandText += " and (T_BESZERZESISZALLITOTORZS_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<BeszerzesiSzallitotorzs> 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<BeszerzesiSzallitotorzs> 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_BESZERZESISZALLITOTORZS_OSSZES (
C_ADOSZAM,
C_AJTO,
C_EMAILCIM,
C_EMELET,
C_HAZSZAM,
C_HELYSEGNEV,
C_IRSZAM,
C_KEPVISELONEV,
C_KOZTERULETJELLEGID,
C_KOZTERULETNEV,
C_NEV,
C_SAPKOD,
C_TELEFONSZAM,
C_FIZETESIMOD,
C_INTEZMENYID,
C_TANEVID,
TOROLT,
SERIAL,
CREATED,
CREATOR)
values (
:pADOSZAM,
:pAJTO,
:pEMAILCIM,
:pEMELET,
:pHAZSZAM,
:pHELYSEGNEV,
:pIRSZAM,
:pKEPVISELONEV,
:pKOZTERULETJELLEGID,
:pKOZTERULETNEV,
:pNEV,
:pSAPKOD,
:pTELEFONSZAM,
:pFIZETESIMOD,
:pINTEZMENYID,
:pTANEVID,
:pTOROLT,
:pSERIAL,
:pCREATED,
:pCREATOR);
SELECT SCOPE_IDENTITY() as ID;
";
public override void InsertEntity(BeszerzesiSzallitotorzs 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_BESZERZESISZALLITOTORZS_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(BeszerzesiSzallitotorzs 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_BESZERZESISZALLITOTORZS_OSSZES WHERE (ID = :pID) ";
private const string m_LogikaiDeleteCommandText = @"
UPDATE T_BESZERZESISZALLITOTORZS_OSSZES
SET TOROLT = 'T' ,
SERIAL = SERIAL + 1,
LASTCHANGED = :pLASTCHANGED,
MODIFIER = :pMODIFIER
WHERE (ID = :pID) ";
public override void DeleteEntity(BeszerzesiSzallitotorzs 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("BeszerzesiSzallitotorzs", entity.ID);
}
}
}
#endregion
#region UpdateAssociations
private const string m_UpdateAssociationCommandText = @"
update T_BESZERZESISZALLITOTORZS_OSSZES
set
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(BeszerzesiSzallitotorzs 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 'Intezmeny -> BeszerzesiSzallitotorzs (BeszerzesiSzallitotorzs)'
/// asszociációjának teljes kezelését.
/// </summary>
internal class Intezmeny_BeszerzesiSzallitotorzs_DA : EntityCollectionDA<Intezmeny, BeszerzesiSzallitotorzs>
{
internal protected Intezmeny_BeszerzesiSzallitotorzs_DA(Intezmeny owner)
: base(owner)
{
}
// Nincs kapcsolótábla
private const string m_Filter = @" and (T_BESZERZESISZALLITOTORZS_OSSZES.C_INTEZMENYID = :pID) ";
public override void LoadCollection(IAssociatedEntityCollection<BeszerzesiSzallitotorzs> collection)
{
new BeszerzesiSzallitotorzsDBHelper().LoadByPartnerId(collection, m_Filter, Owner.ID);
}
private static SDA.DataProvider.SDACommand CreateInsertBeszerzesiSzallitotorzsCommand()
{
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
// nincs kapcsolótábla...
result.CommandText = @"update T_BESZERZESISZALLITOTORZS_OSSZES set C_INTEZMENYID = :pINTEZMENYID where (ID = :pBESZERZESISZALLITOTORZSID)";
result.Parameters.Add("pINTEZMENYID", SDA.DataProvider.SDADBType.Int);
result.Parameters.Add("pBESZERZESISZALLITOTORZSID", SDA.DataProvider.SDADBType.Int);
return result;
}
private void DoAdd(Intezmeny owner, BeszerzesiSzallitotorzs partner)
{
using (SDA.DataProvider.SDACommand command = CreateInsertBeszerzesiSzallitotorzsCommand())
{
command.Connection = UserContext.Instance.SDAConnection;
command.Transaction = UserContext.Instance.SDATransaction;
command.Parameters["pINTEZMENYID"].Value = owner.ID;
command.Parameters["pBESZERZESISZALLITOTORZSID"].Value = partner.ID;
command.ExecuteNonQuery();
}
}
public override void AddItem(BeszerzesiSzallitotorzs entity)
{
var assochandler = AssociationHandlerManager.Create<BeszerzesiSzallitotorzs, Intezmeny>("BeszerzesiSzallitotorzs_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 CreateDeleteBeszerzesiSzallitotorzsCommand()
{
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
// nincs kapcsolótábla...
result.CommandText = @"update T_BESZERZESISZALLITOTORZS_OSSZES set C_INTEZMENYID = null where (C_INTEZMENYID = :pINTEZMENYID and ID = :pBESZERZESISZALLITOTORZSID)";
result.Parameters.Add("pINTEZMENYID", SDA.DataProvider.SDADBType.Int);
result.Parameters.Add("pBESZERZESISZALLITOTORZSID", SDA.DataProvider.SDADBType.Int);
return result;
}
private void DoRemove(Intezmeny owner, BeszerzesiSzallitotorzs partner)
{
using (SDA.DataProvider.SDACommand command = CreateDeleteBeszerzesiSzallitotorzsCommand())
{
command.Connection = UserContext.Instance.SDAConnection;
command.Transaction = UserContext.Instance.SDATransaction;
command.Parameters["pINTEZMENYID"].Value = owner.ID;
command.Parameters["pBESZERZESISZALLITOTORZSID"].Value = partner.ID;
command.ExecuteNonQuery();
}
}
public override void DeleteItem(BeszerzesiSzallitotorzs entity)
{
var assochandler = AssociationHandlerManager.Create<BeszerzesiSzallitotorzs, Intezmeny>("BeszerzesiSzallitotorzs_Intezmeny");
assochandler.BeforeDelete(entity, this.Owner);
entity.Delete(true);
assochandler.AfterDelete(entity, this.Owner);
}
}
/// <summary>
/// Az osztály elvégzi az UML modell 'Tanev -> BeszerzesiSzallitotorzs (BeszerzesiSzallitotorzs)'
/// asszociációjának teljes kezelését.
/// </summary>
internal class Tanev_BeszerzesiSzallitotorzs_DA : EntityCollectionDA<Tanev, BeszerzesiSzallitotorzs>
{
internal protected Tanev_BeszerzesiSzallitotorzs_DA(Tanev owner)
: base(owner)
{
}
// Nincs kapcsolótábla
private const string m_Filter = @" and (T_BESZERZESISZALLITOTORZS_OSSZES.C_TANEVID = :pID) ";
public override void LoadCollection(IAssociatedEntityCollection<BeszerzesiSzallitotorzs> collection)
{
new BeszerzesiSzallitotorzsDBHelper().LoadByPartnerId(collection, m_Filter, Owner.ID);
}
private static SDA.DataProvider.SDACommand CreateInsertBeszerzesiSzallitotorzsCommand()
{
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
// nincs kapcsolótábla...
result.CommandText = @"update T_BESZERZESISZALLITOTORZS_OSSZES set C_TANEVID = :pTANEVID where (ID = :pBESZERZESISZALLITOTORZSID)";
result.Parameters.Add("pTANEVID", SDA.DataProvider.SDADBType.Int);
result.Parameters.Add("pBESZERZESISZALLITOTORZSID", SDA.DataProvider.SDADBType.Int);
return result;
}
private void DoAdd(Tanev owner, BeszerzesiSzallitotorzs partner)
{
using (SDA.DataProvider.SDACommand command = CreateInsertBeszerzesiSzallitotorzsCommand())
{
command.Connection = UserContext.Instance.SDAConnection;
command.Transaction = UserContext.Instance.SDATransaction;
command.Parameters["pTANEVID"].Value = owner.ID;
command.Parameters["pBESZERZESISZALLITOTORZSID"].Value = partner.ID;
command.ExecuteNonQuery();
}
}
public override void AddItem(BeszerzesiSzallitotorzs entity)
{
var assochandler = AssociationHandlerManager.Create<BeszerzesiSzallitotorzs, Tanev>("BeszerzesiSzallitotorzs_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 CreateDeleteBeszerzesiSzallitotorzsCommand()
{
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
// nincs kapcsolótábla...
result.CommandText = @"update T_BESZERZESISZALLITOTORZS_OSSZES set C_TANEVID = null where (C_TANEVID = :pTANEVID and ID = :pBESZERZESISZALLITOTORZSID)";
result.Parameters.Add("pTANEVID", SDA.DataProvider.SDADBType.Int);
result.Parameters.Add("pBESZERZESISZALLITOTORZSID", SDA.DataProvider.SDADBType.Int);
return result;
}
private void DoRemove(Tanev owner, BeszerzesiSzallitotorzs partner)
{
using (SDA.DataProvider.SDACommand command = CreateDeleteBeszerzesiSzallitotorzsCommand())
{
command.Connection = UserContext.Instance.SDAConnection;
command.Transaction = UserContext.Instance.SDATransaction;
command.Parameters["pTANEVID"].Value = owner.ID;
command.Parameters["pBESZERZESISZALLITOTORZSID"].Value = partner.ID;
command.ExecuteNonQuery();
}
}
public override void DeleteItem(BeszerzesiSzallitotorzs entity)
{
var assochandler = AssociationHandlerManager.Create<BeszerzesiSzallitotorzs, Tanev>("BeszerzesiSzallitotorzs_Tanev");
assochandler.BeforeDelete(entity, this.Owner);
entity.Delete(true);
assochandler.AfterDelete(entity, this.Owner);
}
}
}