760 lines
31 KiB
C#
760 lines
31 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 eLearningDBHelper : EntityDBHelper<eLearning>
|
|
{
|
|
private Dictionary<string, string> dynamicColumns = new Dictionary<string, string>()
|
|
{
|
|
{ "Befejezett", "T_ELEARNING_OSSZES.C_BEFEJEZETT" },
|
|
{ "eLearningAzonosito", "T_ELEARNING_OSSZES.C_ELEARNINGAZONOSITO" },
|
|
{ "eLearningFelhasznaloNev", "T_ELEARNING_OSSZES.C_ELEARNINGFELHASZNALONEV" },
|
|
{ "Sikeres", "T_ELEARNING_OSSZES.C_SIKERES" },
|
|
{ "Szerzodeses", "T_ELEARNING_OSSZES.C_SZERZODESES" },
|
|
{ "TananyagKod", "T_ELEARNING_OSSZES.C_TANANYAGKOD" },
|
|
};
|
|
|
|
private const string dynamicQueryCommandText =
|
|
"select " +
|
|
"T_ELEARNING_OSSZES.ID, " +
|
|
"{COLUMNS}" +
|
|
// eLearning betöltése
|
|
// eLearning kapcsoló mezői
|
|
"T_ELEARNING_OSSZES.C_FELHASZNALOID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_ELEARNING_OSSZES.C_INTEZMENYID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_ELEARNING_OSSZES.C_TANEVID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_ELEARNING_OSSZES.TOROLT, " +
|
|
"T_ELEARNING_OSSZES.SERIAL, " +
|
|
"T_ELEARNING_OSSZES.CREATED, " +
|
|
"T_ELEARNING_OSSZES.CREATOR, " +
|
|
"T_ELEARNING_OSSZES.LASTCHANGED, " +
|
|
"T_ELEARNING_OSSZES.MODIFIER " +
|
|
"from " +
|
|
"T_ELEARNING_OSSZES " +
|
|
"where " +
|
|
"(1 = 1) ";
|
|
|
|
private const string emptyQueryCommandText =
|
|
"select " +
|
|
"T_ELEARNING_OSSZES.ID, " +
|
|
// eLearning betöltése
|
|
// eLearning mezői
|
|
"T_ELEARNING_OSSZES.C_BEFEJEZETT, " +
|
|
"T_ELEARNING_OSSZES.C_ELEARNINGAZONOSITO, " +
|
|
"T_ELEARNING_OSSZES.C_ELEARNINGFELHASZNALONEV, " +
|
|
"T_ELEARNING_OSSZES.C_SIKERES, " +
|
|
"T_ELEARNING_OSSZES.C_SZERZODESES, " +
|
|
"T_ELEARNING_OSSZES.C_TANANYAGKOD, " +
|
|
// eLearning kapcsoló mezői
|
|
"T_ELEARNING_OSSZES.C_FELHASZNALOID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_ELEARNING_OSSZES.C_INTEZMENYID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_ELEARNING_OSSZES.C_TANEVID, " + /* Kötelező asszociációs kapcsolómező */
|
|
"T_ELEARNING_OSSZES.TOROLT, " +
|
|
"T_ELEARNING_OSSZES.SERIAL, " +
|
|
"T_ELEARNING_OSSZES.CREATED, " +
|
|
"T_ELEARNING_OSSZES.CREATOR, " +
|
|
"T_ELEARNING_OSSZES.LASTCHANGED, " +
|
|
"T_ELEARNING_OSSZES.MODIFIER " +
|
|
"from " +
|
|
"T_ELEARNING_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 eLearning CreateEntityInstance()
|
|
{
|
|
return eLearning.GiveAnInstance();
|
|
}
|
|
|
|
#region Lekérdezés
|
|
|
|
public override void LoadEntityFields(eLearning entity, SDA.DataProvider.SDADataReader reader)
|
|
{
|
|
// eLearning betöltése
|
|
// eLearning mezői
|
|
|
|
entity.m_Befejezett = DAUtil.ReadBooleanAttribute(reader, 1, false);
|
|
|
|
|
|
entity.m_eLearningAzonosito = DAUtil.ReadStringAttribute(reader, 2, "");
|
|
|
|
|
|
entity.m_eLearningFelhasznaloNev = DAUtil.ReadStringAttribute(reader, 3, "");
|
|
|
|
|
|
entity.m_Sikeres = DAUtil.ReadBooleanAttribute(reader, 4, false);
|
|
|
|
|
|
entity.m_Szerzodeses = DAUtil.ReadBooleanAttribute(reader, 5, false);
|
|
|
|
|
|
entity.m_TananyagKod = DAUtil.ReadStringAttribute(reader, 6, "");
|
|
|
|
// eLearning kapcsoló mezői
|
|
DAUtil.ReadIDAttribute(reader, 7, ref entity.m_FelhasznaloId, 0);
|
|
DAUtil.ReadIDAttribute(reader, 8, ref entity.m_IntezmenyId, 0);
|
|
DAUtil.ReadIDAttribute(reader, 9, ref entity.m_TanevId, 0);
|
|
}
|
|
|
|
public override void LoadEntityFields(eLearning entity, SDA.DataProvider.SDADataReader reader, ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
|
|
{
|
|
int index = 1;
|
|
if (columns == null)
|
|
{
|
|
columns = new List<string>(index);
|
|
}
|
|
// eLearning betöltése
|
|
// eLearning mezői
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("Befejezett"))))
|
|
{
|
|
entity.m_Befejezett = DAUtil.ReadBooleanAttribute(reader, index++, false);
|
|
}
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("eLearningAzonosito"))))
|
|
{
|
|
entity.m_eLearningAzonosito = DAUtil.ReadStringAttribute(reader, index++, "");
|
|
}
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("eLearningFelhasznaloNev"))))
|
|
{
|
|
entity.m_eLearningFelhasznaloNev = DAUtil.ReadStringAttribute(reader, index++, "");
|
|
}
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("Sikeres"))))
|
|
{
|
|
entity.m_Sikeres = DAUtil.ReadBooleanAttribute(reader, index++, false);
|
|
}
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("Szerzodeses"))))
|
|
{
|
|
entity.m_Szerzodeses = DAUtil.ReadBooleanAttribute(reader, index++, false);
|
|
}
|
|
if (((columnFilterMode == ColumnFilterMode.DEFAULT_ALLOWED) ^ (columns.Contains("TananyagKod"))))
|
|
{
|
|
entity.m_TananyagKod = DAUtil.ReadStringAttribute(reader, index++, "");
|
|
}
|
|
// eLearning kapcsoló mezői
|
|
DAUtil.ReadIDAttribute(reader, index++, ref entity.m_FelhasznaloId, 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(eLearning entity, SDA.DataProvider.SDACommand command)
|
|
{
|
|
DAUtil.BindParameter(command, "pBEFEJEZETT", SDA.DataProvider.SDADBType.Boolean /* Boolean */, 1, entity.m_Befejezett, false);
|
|
|
|
DAUtil.BindParameter(command, "pELEARNINGAZONOSITO", SDA.DataProvider.SDADBType.String, 500, entity.m_eLearningAzonosito, false);
|
|
|
|
DAUtil.BindParameter(command, "pELEARNINGFELHASZNALONEV", SDA.DataProvider.SDADBType.String, 500, entity.m_eLearningFelhasznaloNev, false);
|
|
|
|
DAUtil.BindParameter(command, "pSIKERES", SDA.DataProvider.SDADBType.Boolean /* Boolean */, 1, entity.m_Sikeres, false);
|
|
|
|
DAUtil.BindParameter(command, "pSZERZODESES", SDA.DataProvider.SDADBType.Boolean /* Boolean */, 1, entity.m_Szerzodeses, false);
|
|
|
|
DAUtil.BindParameter(command, "pTANANYAGKOD", SDA.DataProvider.SDADBType.String, 500, entity.m_TananyagKod, false);
|
|
}
|
|
|
|
public override void DynamicBindAttributes(eLearning entity, SDA.DataProvider.SDACommand command)
|
|
{
|
|
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
|
if (entity.HasChanged("Befejezett"))
|
|
{
|
|
sb.Append("C_BEFEJEZETT = :pBEFEJEZETT,");
|
|
|
|
DAUtil.BindParameter(command, "pBEFEJEZETT", SDA.DataProvider.SDADBType.Boolean /* Boolean */, 1, entity.m_Befejezett, false);
|
|
|
|
}
|
|
if (entity.HasChanged("eLearningAzonosito"))
|
|
{
|
|
sb.Append("C_ELEARNINGAZONOSITO = :pELEARNINGAZONOSITO,");
|
|
|
|
DAUtil.BindParameter(command, "pELEARNINGAZONOSITO", SDA.DataProvider.SDADBType.String, 500, entity.m_eLearningAzonosito, false);
|
|
|
|
}
|
|
if (entity.HasChanged("eLearningFelhasznaloNev"))
|
|
{
|
|
sb.Append("C_ELEARNINGFELHASZNALONEV = :pELEARNINGFELHASZNALONEV,");
|
|
|
|
DAUtil.BindParameter(command, "pELEARNINGFELHASZNALONEV", SDA.DataProvider.SDADBType.String, 500, entity.m_eLearningFelhasznaloNev, false);
|
|
|
|
}
|
|
if (entity.HasChanged("Sikeres"))
|
|
{
|
|
sb.Append("C_SIKERES = :pSIKERES,");
|
|
|
|
DAUtil.BindParameter(command, "pSIKERES", SDA.DataProvider.SDADBType.Boolean /* Boolean */, 1, entity.m_Sikeres, false);
|
|
|
|
}
|
|
if (entity.HasChanged("Szerzodeses"))
|
|
{
|
|
sb.Append("C_SZERZODESES = :pSZERZODESES,");
|
|
|
|
DAUtil.BindParameter(command, "pSZERZODESES", SDA.DataProvider.SDADBType.Boolean /* Boolean */, 1, entity.m_Szerzodeses, false);
|
|
|
|
}
|
|
if (entity.HasChanged("TananyagKod"))
|
|
{
|
|
sb.Append("C_TANANYAGKOD = :pTANANYAGKOD,");
|
|
|
|
DAUtil.BindParameter(command, "pTANANYAGKOD", SDA.DataProvider.SDADBType.String, 500, entity.m_TananyagKod, false);
|
|
|
|
}
|
|
command.CommandText = command.CommandText.Replace("{COLUMNS}", sb.ToString());
|
|
}
|
|
|
|
public override void BindAssociations(eLearning entity, SDA.DataProvider.SDACommand command)
|
|
{
|
|
DAUtil.BindIdParameter(command, "pFELHASZNALOID", entity.InternalFelhasznaloId);
|
|
DAUtil.BindIdParameter(command, "pINTEZMENYID", entity.InternalIntezmenyId);
|
|
DAUtil.BindIdParameter(command, "pTANEVID", entity.InternalTanevId);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
internal class eLearningDA : EntityDataAccessor<eLearning>
|
|
{
|
|
private static eLearningDBHelper m_dbhelper = new eLearningDBHelper();
|
|
|
|
protected override IEntityDBHelper<eLearning> dbhelper
|
|
{
|
|
get { return m_dbhelper; }
|
|
}
|
|
|
|
#region Load
|
|
|
|
public override bool LoadEntity(eLearning entity, int entityId)
|
|
{
|
|
return LoadById(entity, entityId);
|
|
}
|
|
|
|
public override bool FilteredLoadEntity(eLearning entity, int entityId, ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
|
|
{
|
|
return LoadById(entity, entityId, columnFilterMode, columns);
|
|
}
|
|
|
|
public bool LoadById(eLearning entity, int entityId)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = dbhelper.CreateEmptyQueryCommand())
|
|
{
|
|
command.CommandText += " and (T_ELEARNING_OSSZES.ID = :pID) ";
|
|
command.Parameters.Add("pID", SDA.DataProvider.SDADBType.Int).Value = entityId;
|
|
return dbhelper.LoadSingleEntity(entity, command);
|
|
}
|
|
}
|
|
|
|
public bool LoadById(eLearning entity, int entityId, ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = dbhelper.CreateDynamicQueryCommand(columnFilterMode, columns))
|
|
{
|
|
command.CommandText += " and (T_ELEARNING_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<eLearning> 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<eLearning> 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_ELEARNING_OSSZES (
|
|
C_BEFEJEZETT,
|
|
C_ELEARNINGAZONOSITO,
|
|
C_ELEARNINGFELHASZNALONEV,
|
|
C_SIKERES,
|
|
C_SZERZODESES,
|
|
C_TANANYAGKOD,
|
|
C_FELHASZNALOID,
|
|
C_INTEZMENYID,
|
|
C_TANEVID,
|
|
TOROLT,
|
|
SERIAL,
|
|
CREATED,
|
|
CREATOR)
|
|
values (
|
|
:pBEFEJEZETT,
|
|
:pELEARNINGAZONOSITO,
|
|
:pELEARNINGFELHASZNALONEV,
|
|
:pSIKERES,
|
|
:pSZERZODESES,
|
|
:pTANANYAGKOD,
|
|
:pFELHASZNALOID,
|
|
:pINTEZMENYID,
|
|
:pTANEVID,
|
|
:pTOROLT,
|
|
:pSERIAL,
|
|
:pCREATED,
|
|
:pCREATOR);
|
|
|
|
SELECT SCOPE_IDENTITY() as ID;
|
|
|
|
";
|
|
|
|
public override void InsertEntity(eLearning 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_ELEARNING_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(eLearning 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_ELEARNING_OSSZES WHERE (ID = :pID) ";
|
|
private const string m_LogikaiDeleteCommandText = @"
|
|
UPDATE T_ELEARNING_OSSZES
|
|
SET TOROLT = 'T' ,
|
|
SERIAL = SERIAL + 1,
|
|
LASTCHANGED = :pLASTCHANGED,
|
|
MODIFIER = :pMODIFIER
|
|
WHERE (ID = :pID) ";
|
|
|
|
public override void DeleteEntity(eLearning 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("eLearning", entity.ID);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region UpdateAssociations
|
|
|
|
private const string m_UpdateAssociationCommandText = @"
|
|
update T_ELEARNING_OSSZES
|
|
set
|
|
C_FELHASZNALOID = :pFELHASZNALOID,
|
|
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(eLearning 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 -> eLearning (eLearning)'
|
|
/// asszociációjának teljes kezelését.
|
|
/// </summary>
|
|
internal class Felhasznalo_eLearning_DA : EntityCollectionDA<Felhasznalo, eLearning>
|
|
{
|
|
internal protected Felhasznalo_eLearning_DA(Felhasznalo owner)
|
|
: base(owner)
|
|
{
|
|
}
|
|
|
|
// Nincs kapcsolótábla
|
|
private const string m_Filter = @" and (T_ELEARNING_OSSZES.C_FELHASZNALOID = :pID) ";
|
|
|
|
public override void LoadCollection(IAssociatedEntityCollection<eLearning> collection)
|
|
{
|
|
new eLearningDBHelper().LoadByPartnerId(collection, m_Filter, Owner.ID);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateInserteLearningCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_ELEARNING_OSSZES set C_FELHASZNALOID = :pFELHASZNALOID where (ID = :pELEARNINGID)";
|
|
result.Parameters.Add("pFELHASZNALOID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pELEARNINGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoAdd(Felhasznalo owner, eLearning partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateInserteLearningCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pFELHASZNALOID"].Value = owner.ID;
|
|
command.Parameters["pELEARNINGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void AddItem(eLearning entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<eLearning, Felhasznalo>("eLearning_Felhasznalo");
|
|
assochandler.BeforeInsert(entity, this.Owner);
|
|
entity.ModifyFelhasznalo(this.Owner);
|
|
if (entity.State == EntityState.Modified)
|
|
{
|
|
entity.UpdateAssociations(true);
|
|
}
|
|
else
|
|
{
|
|
entity.Insert(true);
|
|
}
|
|
assochandler.AfterInsert(entity, this.Owner);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateDeleteeLearningCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_ELEARNING_OSSZES set C_FELHASZNALOID = null where (C_FELHASZNALOID = :pFELHASZNALOID and ID = :pELEARNINGID)";
|
|
result.Parameters.Add("pFELHASZNALOID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pELEARNINGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoRemove(Felhasznalo owner, eLearning partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateDeleteeLearningCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pFELHASZNALOID"].Value = owner.ID;
|
|
command.Parameters["pELEARNINGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void DeleteItem(eLearning entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<eLearning, Felhasznalo>("eLearning_Felhasznalo");
|
|
assochandler.BeforeDelete(entity, this.Owner);
|
|
entity.Delete(true);
|
|
assochandler.AfterDelete(entity, this.Owner);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Az osztály elvégzi az UML modell 'Intezmeny -> eLearning (eLearning)'
|
|
/// asszociációjának teljes kezelését.
|
|
/// </summary>
|
|
internal class Intezmeny_eLearning_DA : EntityCollectionDA<Intezmeny, eLearning>
|
|
{
|
|
internal protected Intezmeny_eLearning_DA(Intezmeny owner)
|
|
: base(owner)
|
|
{
|
|
}
|
|
|
|
// Nincs kapcsolótábla
|
|
private const string m_Filter = @" and (T_ELEARNING_OSSZES.C_INTEZMENYID = :pID) ";
|
|
|
|
public override void LoadCollection(IAssociatedEntityCollection<eLearning> collection)
|
|
{
|
|
new eLearningDBHelper().LoadByPartnerId(collection, m_Filter, Owner.ID);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateInserteLearningCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_ELEARNING_OSSZES set C_INTEZMENYID = :pINTEZMENYID where (ID = :pELEARNINGID)";
|
|
result.Parameters.Add("pINTEZMENYID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pELEARNINGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoAdd(Intezmeny owner, eLearning partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateInserteLearningCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pINTEZMENYID"].Value = owner.ID;
|
|
command.Parameters["pELEARNINGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void AddItem(eLearning entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<eLearning, Intezmeny>("eLearning_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 CreateDeleteeLearningCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_ELEARNING_OSSZES set C_INTEZMENYID = null where (C_INTEZMENYID = :pINTEZMENYID and ID = :pELEARNINGID)";
|
|
result.Parameters.Add("pINTEZMENYID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pELEARNINGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoRemove(Intezmeny owner, eLearning partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateDeleteeLearningCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pINTEZMENYID"].Value = owner.ID;
|
|
command.Parameters["pELEARNINGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void DeleteItem(eLearning entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<eLearning, Intezmeny>("eLearning_Intezmeny");
|
|
assochandler.BeforeDelete(entity, this.Owner);
|
|
entity.Delete(true);
|
|
assochandler.AfterDelete(entity, this.Owner);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Az osztály elvégzi az UML modell 'Tanev -> eLearning (eLearning)'
|
|
/// asszociációjának teljes kezelését.
|
|
/// </summary>
|
|
internal class Tanev_eLearning_DA : EntityCollectionDA<Tanev, eLearning>
|
|
{
|
|
internal protected Tanev_eLearning_DA(Tanev owner)
|
|
: base(owner)
|
|
{
|
|
}
|
|
|
|
// Nincs kapcsolótábla
|
|
private const string m_Filter = @" and (T_ELEARNING_OSSZES.C_TANEVID = :pID) ";
|
|
|
|
public override void LoadCollection(IAssociatedEntityCollection<eLearning> collection)
|
|
{
|
|
new eLearningDBHelper().LoadByPartnerId(collection, m_Filter, Owner.ID);
|
|
}
|
|
|
|
private static SDA.DataProvider.SDACommand CreateInserteLearningCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_ELEARNING_OSSZES set C_TANEVID = :pTANEVID where (ID = :pELEARNINGID)";
|
|
result.Parameters.Add("pTANEVID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pELEARNINGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoAdd(Tanev owner, eLearning partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateInserteLearningCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pTANEVID"].Value = owner.ID;
|
|
command.Parameters["pELEARNINGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void AddItem(eLearning entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<eLearning, Tanev>("eLearning_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 CreateDeleteeLearningCommand()
|
|
{
|
|
SDA.DataProvider.SDACommand result = new SDA.DataProvider.SDACommand();
|
|
// nincs kapcsolótábla...
|
|
result.CommandText = @"update T_ELEARNING_OSSZES set C_TANEVID = null where (C_TANEVID = :pTANEVID and ID = :pELEARNINGID)";
|
|
result.Parameters.Add("pTANEVID", SDA.DataProvider.SDADBType.Int);
|
|
result.Parameters.Add("pELEARNINGID", SDA.DataProvider.SDADBType.Int);
|
|
return result;
|
|
}
|
|
|
|
private void DoRemove(Tanev owner, eLearning partner)
|
|
{
|
|
using (SDA.DataProvider.SDACommand command = CreateDeleteeLearningCommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.Parameters["pTANEVID"].Value = owner.ID;
|
|
command.Parameters["pELEARNINGID"].Value = partner.ID;
|
|
command.ExecuteNonQuery();
|
|
}
|
|
}
|
|
|
|
public override void DeleteItem(eLearning entity)
|
|
{
|
|
var assochandler = AssociationHandlerManager.Create<eLearning, Tanev>("eLearning_Tanev");
|
|
assochandler.BeforeDelete(entity, this.Owner);
|
|
entity.Delete(true);
|
|
assochandler.AfterDelete(entity, this.Owner);
|
|
}
|
|
}
|
|
|
|
}
|
|
|