840 lines
33 KiB
C#
840 lines
33 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 LogDBHelper : EntityDBHelper<Log>
|
|
{
|
|
private Dictionary<string, string> dynamicColumns = new Dictionary<string, string>()
|
|
{
|
|
{ "Details", "T_LOG_OSSZES.C_DETAILS" },
|
|
{ "Server", "T_LOG_OSSZES.C_SERVER" },
|
|
{ "SessionId", "T_LOG_OSSZES.C_SESSIONID" },
|
|
{ "TimeStamp", "T_LOG_OSSZES.C_TIMESTAMP" },
|
|
{ "GeneratedId", "T_LOG_OSSZES.C_GENERATEDID" },
|
|
{ "HTTPRequest", "T_LOG_OSSZES.C_HTTPREQUEST" },
|
|
};
|
|
|
|
private const string dynamicQueryCommandText =
|
|
"select " +
|
|
"T_LOG_OSSZES.ID, " +
|
|
"{COLUMNS}" +
|
|
// Log betöltése
|
|
// Log kapcsoló mezői
|
|
"T_LOG_OSSZES.C_LEVELID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_LOG_OSSZES.C_EVENTTYPEID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_LOG_OSSZES.C_INTEZMENYID, " + /* Opcionális asszociációs kapcsolómező */
|
|
"T_LOG_OSSZES.C_TANEVID, " + /* Opcionális asszociációs kapcsolómező */
|
|
"T_LOG_OSSZES.TOROLT, " +
|
|
"T_LOG_OSSZES.SERIAL, " +
|
|
"T_LOG_OSSZES.CREATED, " +
|
|
"T_LOG_OSSZES.CREATOR, " +
|
|
"T_LOG_OSSZES.LASTCHANGED, " +
|
|
"T_LOG_OSSZES.MODIFIER " +
|
|
"from " +
|
|
"T_LOG_OSSZES " +
|
|
"where " +
|
|
"(1 = 1) ";
|
|
|
|
private const string emptyQueryCommandText =
|
|
"select " +
|
|
"T_LOG_OSSZES.ID, " +
|
|
// Log betöltése
|
|
// Log mezői
|
|
"T_LOG_OSSZES.C_DETAILS, " +
|
|
"T_LOG_OSSZES.C_SERVER, " +
|
|
"T_LOG_OSSZES.C_SESSIONID, " +
|
|
"T_LOG_OSSZES.C_TIMESTAMP, " +
|
|
"T_LOG_OSSZES.C_GENERATEDID, " +
|
|
"T_LOG_OSSZES.C_HTTPREQUEST, " +
|
|
// Log kapcsoló mezői
|
|
"T_LOG_OSSZES.C_LEVELID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_LOG_OSSZES.C_EVENTTYPEID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_LOG_OSSZES.C_INTEZMENYID, " + /* Opcionális asszociációs kapcsolómező */
|
|
"T_LOG_OSSZES.C_TANEVID, " + /* Opcionális asszociációs kapcsolómező */
|
|
"T_LOG_OSSZES.TOROLT, " +
|
|
"T_LOG_OSSZES.SERIAL, " +
|
|
"T_LOG_OSSZES.CREATED, " +
|
|
"T_LOG_OSSZES.CREATOR, " +
|
|
"T_LOG_OSSZES.LASTCHANGED, " +
|
|
"T_LOG_OSSZES.MODIFIER " +
|
|
"from " +
|
|
"T_LOG_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 Log CreateEntityInstance()
|
|
{
|
|
return Log.GiveAnInstance();
|
|
}
|
|
|
|
#region Lekérdezés
|
|
|
|
public override void LoadEntityFields(Log entity, SDA.DataProvider.SDADataReader reader)
|
|
{
|
|
// Log betöltése
|
|
// Log mezői
|
|
|
|
entity.m_Details = DAUtil.ReadStringAttribute(reader, 1);
|
|
|
|
|
|
entity.m_Server = DAUtil.ReadStringAttribute(reader, 2);
|
|
|
|
|
|
entity.m_SessionId = DAUtil.ReadStringAttribute(reader, 3);
|
|
|
|
|
|
entity.m_TimeStamp = DAUtil.ReadDateTimeAttribute(reader, 4);
|
|
|
|
|
|
entity.m_GeneratedId = DAUtil.ReadGuidAttribute(reader, 5);
|
|
|
|
|
|
entity.m_HTTPRequest = DAUtil.ReadStringAttribute(reader, 6);
|
|
|
|
// Log kapcsoló mezői
|
|
DAUtil.ReadIDAttribute(reader, 7, ref entity.m_LevelId, 0);
|
|
DAUtil.ReadIDAttribute(reader, 8, ref entity.m_EventTypeId, 0);
|
|
DAUtil.ReadIDAttribute(reader, 9, ref entity.m_IntezmenyId, -1);
|
|
DAUtil.ReadIDAttribute(reader, 10, ref entity.m_TanevId, -1);
|
|
}
|
|
|
|
public override void LoadEntityFields(Log entity, SDA.DataProvider.SDADataReader reader, ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
|
|
{
|
|
int index = 1;
|
|
if (columns == null)
|
|
{
|
|
columns = new List<string>(index);
|
|
}
|
|
// Log betöltése
|
|
// Log mezői
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("Details"))))
|
|
{
|
|
entity.m_Details = DAUtil.ReadStringAttribute(reader, index++);
|
|
}
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("Server"))))
|
|
{
|
|
entity.m_Server = DAUtil.ReadStringAttribute(reader, index++);
|
|
}
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("SessionId"))))
|
|
{
|
|
entity.m_SessionId = DAUtil.ReadStringAttribute(reader, index++);
|
|
}
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("TimeStamp"))))
|
|
{
|
|
entity.m_TimeStamp = DAUtil.ReadDateTimeAttribute(reader, index++);
|
|
}
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("GeneratedId"))))
|
|
{
|
|
entity.m_GeneratedId = DAUtil.ReadGuidAttribute(reader, index++);
|
|
}
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("HTTPRequest"))))
|
|
{
|
|
entity.m_HTTPRequest = DAUtil.ReadStringAttribute(reader, index++);
|
|
}
|
|
// Log kapcsoló mezői
|
|
DAUtil.ReadIDAttribute(reader, index++, ref entity.m_LevelId, 0);
|
|
DAUtil.ReadIDAttribute(reader, index++, ref entity.m_EventTypeId, 0);
|
|
DAUtil.ReadIDAttribute(reader, index++, ref entity.m_IntezmenyId, -1);
|
|
DAUtil.ReadIDAttribute(reader, index++, ref entity.m_TanevId, -1);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Paraméter kötés
|
|
|
|
public override void BindAttributes(Log entity, SDA.DataProvider.SDACommand command)
|
|
{
|
|
DAUtil.BindParameter(command, "pDETAILS", SDA.DataProvider.SDADBType.LongString, 2147483647, entity.m_Details, entity.m_Details == null);
|
|
|
|
DAUtil.BindParameter(command, "pSERVER", SDA.DataProvider.SDADBType.String, 36, entity.m_Server, entity.m_Server == null);
|
|
|
|
DAUtil.BindParameter(command, "pSESSIONID", SDA.DataProvider.SDADBType.String, 36, entity.m_SessionId, entity.m_SessionId == null);
|
|
|
|
DAUtil.BindParameter(command, "pTIMESTAMP", SDA.DataProvider.SDADBType.DateTime, entity.m_TimeStamp, entity.m_TimeStamp == null);
|
|
|
|
DAUtil.BindParameter(command, "pGENERATEDID", SDA.DataProvider.SDADBType.Guid, 36, entity.m_GeneratedId, entity.m_GeneratedId == null);
|
|
|
|
DAUtil.BindParameter(command, "pHTTPREQUEST", SDA.DataProvider.SDADBType.LongString, 2147483647, entity.m_HTTPRequest, entity.m_HTTPRequest == null);
|
|
}
|
|
|
|
public override void DynamicBindAttributes(Log entity, SDA.DataProvider.SDACommand command)
|
|
{
|
|
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
|
if (entity.HasChanged("Details"))
|
|
{
|
|
sb.Append("C_DETAILS = :pDETAILS,");
|
|
|
|
DAUtil.BindParameter(command, "pDETAILS", SDA.DataProvider.SDADBType.LongString, 2147483647, entity.m_Details, entity.m_Details == null);
|
|
|
|
}
|
|
if (entity.HasChanged("Server"))
|
|
{
|
|
sb.Append("C_SERVER = :pSERVER,");
|
|
|
|
DAUtil.BindParameter(command, "pSERVER", SDA.DataProvider.SDADBType.String, 36, entity.m_Server, entity.m_Server == null);
|
|
|
|
}
|
|
if (entity.HasChanged("SessionId"))
|
|
{
|
|
sb.Append("C_SESSIONID = :pSESSIONID,");
|
|
|
|
DAUtil.BindParameter(command, "pSESSIONID", SDA.DataProvider.SDADBType.String, 36, entity.m_SessionId, entity.m_SessionId == null);
|
|
|
|
}
|
|
if (entity.HasChanged("TimeStamp"))
|
|
{
|
|
sb.Append("C_TIMESTAMP = :pTIMESTAMP,");
|
|
|
|
DAUtil.BindParameter(command, "pTIMESTAMP", SDA.DataProvider.SDADBType.DateTime, entity.m_TimeStamp, entity.m_TimeStamp == null);
|
|
|
|
}
|
|
if (entity.HasChanged("GeneratedId"))
|
|
{
|
|
sb.Append("C_GENERATEDID = :pGENERATEDID,");
|
|
|
|
DAUtil.BindParameter(command, "pGENERATEDID", SDA.DataProvider.SDADBType.Guid, 36, entity.m_GeneratedId, entity.m_GeneratedId == null);
|
|
|
|
}
|
|
if (entity.HasChanged("HTTPRequest"))
|
|
{
|
|
sb.Append("C_HTTPREQUEST = :pHTTPREQUEST,");
|
|
|
|
DAUtil.BindParameter(command, "pHTTPREQUEST", SDA.DataProvider.SDADBType.LongString, 2147483647, entity.m_HTTPRequest, entity.m_HTTPRequest == null);
|
|
|
|
}
|
|
command.CommandText = command.CommandText.Replace("{COLUMNS}", sb.ToString());
|
|
}
|
|
|
|
public override void BindAssociations(Log entity, SDA.DataProvider.SDACommand command)
|
|
{
|
|
DAUtil.BindIdParameter(command, "pLEVELID", entity.InternalLevelId);
|
|
DAUtil.BindIdParameter(command, "pEVENTTYPEID", entity.InternalEventTypeId);
|
|
DAUtil.BindIdParameter(command, "pINTEZMENYID", entity.InternalIntezmenyId);
|
|
DAUtil.BindIdParameter(command, "pTANEVID", entity.InternalTanevId);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
internal class LogDA : EntityDataAccessor<Log>
|
|
{
|
|
private static LogDBHelper m_dbhelper = new LogDBHelper();
|
|
|
|
protected override IEntityDBHelper<Log> dbhelper
|
|
{
|
|
get { return m_dbhelper; }
|
|
}
|
|
|
|
#region Load
|
|
|
|
public override bool LoadEntity(Log entity, int entityId)
|
|
{
|
|
return LoadById(entity, entityId);
|
|
}
|
|
|
|
public override bool FilteredLoadEntity(Log entity, int entityId, ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
|
|
{
|
|
return LoadById(entity, entityId, columnFilterMode, columns);
|
|
}
|
|
|
|
public bool LoadById(Log entity, int entityId)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = dbhelper.CreateEmptyQueryCommand())
|
|
{
|
|
command.CommandText += " and (T_LOG_OSSZES.ID = :pID) ";
|
|
command.Parameters.Add("pID", SDA.DataProvider.SDADBType.Int).Value = entityId;
|
|
return dbhelper.LoadSingleEntity(entity, command);
|
|
}
|
|
}
|
|
|
|
public bool LoadById(Log entity, int entityId, ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = dbhelper.CreateDynamicQueryCommand(columnFilterMode, columns))
|
|
{
|
|
command.CommandText += " and (T_LOG_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<Log> 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<Log> 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_LOG_OSSZES (
|
|
C_DETAILS,
|
|
C_SERVER,
|
|
C_SESSIONID,
|
|
C_TIMESTAMP,
|
|
C_GENERATEDID,
|
|
C_HTTPREQUEST,
|
|
C_LEVELID,
|
|
C_EVENTTYPEID,
|
|
C_INTEZMENYID,
|
|
C_TANEVID,
|
|
TOROLT,
|
|
SERIAL,
|
|
CREATED,
|
|
CREATOR)
|
|
values (
|
|
:pDETAILS,
|
|
:pSERVER,
|
|
:pSESSIONID,
|
|
:pTIMESTAMP,
|
|
:pGENERATEDID,
|
|
:pHTTPREQUEST,
|
|
:pLEVELID,
|
|
:pEVENTTYPEID,
|
|
:pINTEZMENYID,
|
|
:pTANEVID,
|
|
:pTOROLT,
|
|
:pSERIAL,
|
|
:pCREATED,
|
|
:pCREATOR);
|
|
|
|
SELECT SCOPE_IDENTITY() as ID;
|
|
|
|
";
|
|
|
|
public override void InsertEntity(Log 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_LOG_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(Log 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_LOG_OSSZES WHERE (ID = :pID) ";
|
|
private const string m_LogikaiDeleteCommandText = @"
|
|
UPDATE T_LOG_OSSZES
|
|
SET TOROLT = 'T' ,
|
|
SERIAL = SERIAL + 1,
|
|
LASTCHANGED = :pLASTCHANGED,
|
|
MODIFIER = :pMODIFIER
|
|
WHERE (ID = :pID) ";
|
|
|
|
public override void DeleteEntity(Log 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("Log", entity.ID);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region UpdateAssociations
|
|
|
|
private const string m_UpdateAssociationCommandText = @"
|
|
update T_LOG_OSSZES
|
|
set
|
|
C_LEVELID = :pLEVELID,
|
|
C_EVENTTYPEID = :pEVENTTYPEID,
|
|
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(Log 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 'LogLevelType -> Log (Log)'
|
|
/// asszociációjának teljes kezelését.
|
|
/// </summary>
|
|
internal class LogLevelType_Log_DA : EntityCollectionDA<LogLevelType, Log>
|
|
{
|
|
internal protected LogLevelType_Log_DA(LogLevelType owner)
|
|
: base(owner)
|
|
{
|
|
}
|
|
|
|
// Nincs kapcsolótábla
|
|
private const string m_Filter = @" and (T_LOG_OSSZES.C_LEVELID = :pID) ";
|
|
|
|
public override void LoadCollection(IAssociatedEntityCollection<Log> collection)
|
|
{
|
|
new LogDBHelper().LoadByPartnerId(collection, m_Filter, Owner.ID);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateInsertLogCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_LOG_OSSZES set C_LEVELID = :pLEVELID where (ID = :pLOGID)";
|
|
result.Parameters.Add("pLEVELID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pLOGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoAdd(LogLevelType owner, Log partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateInsertLogCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pLEVELID"].Value = owner.ID;
|
|
command.Parameters["pLOGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void AddItem(Log entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<Log, LogLevelType>("Log_Level");
|
|
assochandler.BeforeInsert(entity, this.Owner);
|
|
entity.ModifyLevel(this.Owner);
|
|
if (entity.State == EntityState.Modified)
|
|
{
|
|
entity.UpdateAssociations(true);
|
|
}
|
|
else
|
|
{
|
|
entity.Insert(true);
|
|
}
|
|
assochandler.AfterInsert(entity, this.Owner);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateDeleteLogCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_LOG_OSSZES set C_LEVELID = null where (C_LEVELID = :pLEVELID and ID = :pLOGID)";
|
|
result.Parameters.Add("pLEVELID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pLOGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoRemove(LogLevelType owner, Log partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateDeleteLogCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pLEVELID"].Value = owner.ID;
|
|
command.Parameters["pLOGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void DeleteItem(Log entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<Log, LogLevelType>("Log_Level");
|
|
assochandler.BeforeDelete(entity, this.Owner);
|
|
entity.Delete(true);
|
|
assochandler.AfterDelete(entity, this.Owner);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Az osztály elvégzi az UML modell 'LogEventType -> Log (Log)'
|
|
/// asszociációjának teljes kezelését.
|
|
/// </summary>
|
|
internal class LogEventType_Log_DA : EntityCollectionDA<LogEventType, Log>
|
|
{
|
|
internal protected LogEventType_Log_DA(LogEventType owner)
|
|
: base(owner)
|
|
{
|
|
}
|
|
|
|
// Nincs kapcsolótábla
|
|
private const string m_Filter = @" and (T_LOG_OSSZES.C_EVENTTYPEID = :pID) ";
|
|
|
|
public override void LoadCollection(IAssociatedEntityCollection<Log> collection)
|
|
{
|
|
new LogDBHelper().LoadByPartnerId(collection, m_Filter, Owner.ID);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateInsertLogCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_LOG_OSSZES set C_EVENTTYPEID = :pEVENTTYPEID where (ID = :pLOGID)";
|
|
result.Parameters.Add("pEVENTTYPEID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pLOGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoAdd(LogEventType owner, Log partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateInsertLogCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pEVENTTYPEID"].Value = owner.ID;
|
|
command.Parameters["pLOGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void AddItem(Log entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<Log, LogEventType>("Log_EventType");
|
|
assochandler.BeforeInsert(entity, this.Owner);
|
|
entity.ModifyEventType(this.Owner);
|
|
if (entity.State == EntityState.Modified)
|
|
{
|
|
entity.UpdateAssociations(true);
|
|
}
|
|
else
|
|
{
|
|
entity.Insert(true);
|
|
}
|
|
assochandler.AfterInsert(entity, this.Owner);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateDeleteLogCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_LOG_OSSZES set C_EVENTTYPEID = null where (C_EVENTTYPEID = :pEVENTTYPEID and ID = :pLOGID)";
|
|
result.Parameters.Add("pEVENTTYPEID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pLOGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoRemove(LogEventType owner, Log partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateDeleteLogCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pEVENTTYPEID"].Value = owner.ID;
|
|
command.Parameters["pLOGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void DeleteItem(Log entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<Log, LogEventType>("Log_EventType");
|
|
assochandler.BeforeDelete(entity, this.Owner);
|
|
entity.Delete(true);
|
|
assochandler.AfterDelete(entity, this.Owner);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Az osztály elvégzi az UML modell 'Intezmeny -> Log (Log)'
|
|
/// asszociációjának teljes kezelését.
|
|
/// </summary>
|
|
internal class Intezmeny_Log_DA : EntityCollectionDA<Intezmeny, Log>
|
|
{
|
|
internal protected Intezmeny_Log_DA(Intezmeny owner)
|
|
: base(owner)
|
|
{
|
|
}
|
|
|
|
// Nincs kapcsolótábla
|
|
private const string m_Filter = @" and (T_LOG_OSSZES.C_INTEZMENYID = :pID) ";
|
|
|
|
public override void LoadCollection(IAssociatedEntityCollection<Log> collection)
|
|
{
|
|
new LogDBHelper().LoadByPartnerId(collection, m_Filter, Owner.ID);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateInsertLogCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_LOG_OSSZES set C_INTEZMENYID = :pINTEZMENYID where (ID = :pLOGID)";
|
|
result.Parameters.Add("pINTEZMENYID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pLOGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoAdd(Intezmeny owner, Log partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateInsertLogCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pINTEZMENYID"].Value = owner.ID;
|
|
command.Parameters["pLOGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void AddItem(Log entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<Log, Intezmeny>("Log_Intezmeny");
|
|
assochandler.BeforeInsert(entity, this.Owner);
|
|
this.DoAdd(this.Owner, entity);
|
|
assochandler.AfterInsert(entity, this.Owner);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateDeleteLogCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_LOG_OSSZES set C_INTEZMENYID = null where (C_INTEZMENYID = :pINTEZMENYID and ID = :pLOGID)";
|
|
result.Parameters.Add("pINTEZMENYID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pLOGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoRemove(Intezmeny owner, Log partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateDeleteLogCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pINTEZMENYID"].Value = owner.ID;
|
|
command.Parameters["pLOGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void DeleteItem(Log entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<Log, Intezmeny>("Log_Intezmeny");
|
|
assochandler.BeforeDelete(entity, this.Owner);
|
|
this.DoRemove(this.Owner, entity);
|
|
assochandler.AfterDelete(entity, this.Owner);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Az osztály elvégzi az UML modell 'Tanev -> Log (Log)'
|
|
/// asszociációjának teljes kezelését.
|
|
/// </summary>
|
|
internal class Tanev_Log_DA : EntityCollectionDA<Tanev, Log>
|
|
{
|
|
internal protected Tanev_Log_DA(Tanev owner)
|
|
: base(owner)
|
|
{
|
|
}
|
|
|
|
// Nincs kapcsolótábla
|
|
private const string m_Filter = @" and (T_LOG_OSSZES.C_TANEVID = :pID) ";
|
|
|
|
public override void LoadCollection(IAssociatedEntityCollection<Log> collection)
|
|
{
|
|
new LogDBHelper().LoadByPartnerId(collection, m_Filter, Owner.ID);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateInsertLogCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_LOG_OSSZES set C_TANEVID = :pTANEVID where (ID = :pLOGID)";
|
|
result.Parameters.Add("pTANEVID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pLOGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoAdd(Tanev owner, Log partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateInsertLogCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pTANEVID"].Value = owner.ID;
|
|
command.Parameters["pLOGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void AddItem(Log entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<Log, Tanev>("Log_Tanev");
|
|
assochandler.BeforeInsert(entity, this.Owner);
|
|
this.DoAdd(this.Owner, entity);
|
|
assochandler.AfterInsert(entity, this.Owner);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateDeleteLogCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_LOG_OSSZES set C_TANEVID = null where (C_TANEVID = :pTANEVID and ID = :pLOGID)";
|
|
result.Parameters.Add("pTANEVID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pLOGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoRemove(Tanev owner, Log partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateDeleteLogCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pTANEVID"].Value = owner.ID;
|
|
command.Parameters["pLOGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void DeleteItem(Log entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<Log, Tanev>("Log_Tanev");
|
|
assochandler.BeforeDelete(entity, this.Owner);
|
|
this.DoRemove(this.Owner, entity);
|
|
assochandler.AfterDelete(entity, this.Owner);
|
|
}
|
|
}
|
|
|
|
}
|
|
|