1255 lines
59 KiB
C#
1255 lines
59 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Kreta.Framework.Caching.DictionaryItemTables;
|
|
using SDA.DataProvider;
|
|
|
|
namespace Kreta.Framework.Caching
|
|
{
|
|
/// <summary>
|
|
/// Kódtétel gyorsítótár
|
|
/// </summary>
|
|
public class DictionaryTableCache : GenericCache<List<DictionaryItem>>
|
|
{
|
|
/// <summary>
|
|
/// Ez azoknak a DictionaryItemBase altábláknak a Dictionary-je, amelyeknek vannak külön egyedi mezői.
|
|
/// A Key a GeneratedAdatszotarTipusEnum-nak az int értéke, a Value pedig a hozzá tartozó adatbetöltő függvény.
|
|
/// </summary>
|
|
|
|
private static readonly IDictionary<int, Action<int, string, List<DictionaryItem>>> DictionaryItemExtendedPropertiesLoadFunctions = new Dictionary<int, Action<int, string, List<DictionaryItem>>>
|
|
{
|
|
// TODO: Megoldani, hogy ne beégetve legyenek a számok! https://jira.ekreta.hu/browse/KRETA2-12366
|
|
{ 009 /* (int)GeneratedAdatszotarTipusEnum.Allampolgarsag */, LoadAllampolgarsagDictionaryItems },
|
|
{ 012 /* (int)GeneratedAdatszotarTipusEnum.MunkakorTipus */, LoadMunkakorTipusDictionaryItems },
|
|
{ 015 /* (int)GeneratedAdatszotarTipusEnum.OrszagTipus */, LoadOrszagTipusDictionaryItems },
|
|
{ 022 /* (int)GeneratedAdatszotarTipusEnum.CsoportTipus */, LoadCsoportTipusDictionaryItems },
|
|
{ 035 /* (int)GeneratedAdatszotarTipusEnum.OktatasiNevelesiFeladat */, LoadOktatasiNevelesiFeladatDictionaryItems },
|
|
{ 037 /* (int)GeneratedAdatszotarTipusEnum.EvfolyamTipus */, LoadEvfolyamTipusDictionaryItems },
|
|
{ 039 /* (int)GeneratedAdatszotarTipusEnum.NapTipus */, LoadNapTipusDictionaryItems },
|
|
{ 041 /* (int)GeneratedAdatszotarTipusEnum.SorolasOkaTipus */, LoadSorolasOkaTipusDictionaryItems },
|
|
{ 045 /* (int)GeneratedAdatszotarTipusEnum.ErtekelesMod */, LoadErtekelesModDictionaryItems },
|
|
{ 046 /* (int)GeneratedAdatszotarTipusEnum.ErtekelesTipus */, LoadErtekelesTipusDictionaryItems },
|
|
{ 048 /* (int)GeneratedAdatszotarTipusEnum.EsemenyTipus */, LoadEsemenyTipusDictionaryItems },
|
|
{ 092 /* (int)GeneratedAdatszotarTipusEnum.SzakkepesitesTipus */, LoadSzakkepesitesTipusDictionaryItems },
|
|
{ 102 /* (int)GeneratedAdatszotarTipusEnum.OraTulajdonsagTipus */, LoadOraTulajdonsagTipusDictionaryItems },
|
|
{ 130 /* (int)GeneratedAdatszotarTipusEnum.DokumentumKulcsszoTipus */, LoadDokumentumKulcsszoTipusDictionaryItems },
|
|
{ 132 /* (int)GeneratedAdatszotarTipusEnum.OktNevelesiKategoria */, LoadOktNevelesiKategoriaDictionaryItems },
|
|
{ 134 /* (int)GeneratedAdatszotarTipusEnum.TavolletTipus */, LoadTavolletTipusDictionaryItems },
|
|
{ 149 /* (int)GeneratedAdatszotarTipusEnum.AgazatUjSzktTipus */, LoadAgazatUjSzktTipusDictionaryItems },
|
|
{ 150 /* (int)GeneratedAdatszotarTipusEnum.SzakmaTipus */, LoadSzakmaTipusDictionaryItems },
|
|
{ 176 /* (int)GeneratedAdatszotarTipusEnum.AgazatReszSzakmaTipus */, LoadAgazatReszSzakmaTipusDictionaryItems }
|
|
};
|
|
|
|
/// <summary>
|
|
/// Az osztály alapértelmezett konstruktora
|
|
/// </summary>
|
|
public DictionaryTableCache(CacheManager cacheManager) : base(cacheManager, nameof(DictionaryTableCache)) { }
|
|
|
|
/// <summary>
|
|
/// Típus alapján visszaadja a kódtétel értékeit
|
|
/// </summary>
|
|
/// <param name="tanevId">A kódtétel adatbázisbeli tanév azonosítója</param>
|
|
/// <param name="typeId">A kódtétel adatbázisbeli típusa</param>
|
|
/// <param name="visibleOnly">Csak a látható kódtételeket adja vissza?</param>
|
|
/// <param name="intezmenyAzonosito">A kódtétel adatbázisbeli intézmény szöveges azonosítója</param>
|
|
public List<DictionaryItem> GetByType(int tanevId, int typeId, bool visibleOnly = false, string intezmenyAzonosito = null)
|
|
{
|
|
intezmenyAzonosito = intezmenyAzonosito ?? GetIntezmenyAzonosito();
|
|
if (intezmenyAzonosito == null)
|
|
{
|
|
throw new NullReferenceException("Az intézmény azonosító nem található.");
|
|
}
|
|
|
|
var key = GetTypeCacheKey(tanevId, typeId, intezmenyAzonosito);
|
|
var dictionaryItems = GetOrAdd(key, k => Load(tanevId, intezmenyAzonosito, null, typeId));
|
|
var result = visibleOnly ? dictionaryItems.Where(d => d.IsVisible).ToList() : dictionaryItems;
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Visszaadja a megadott azonosítójú kódtételt.
|
|
/// </summary>
|
|
/// <param name="tanevId">A kódtétel adatbázisbeli tanév azonosítója</param>
|
|
/// <param name="itemId">A kódtétel adatbázisbeli azonosítója</param>
|
|
/// <param name="intezmenyAzonosito">A kódtétel adatbázisbeli intézmény szöveges azonosítója</param>
|
|
public DictionaryItem GetById(int tanevId, int itemId, string intezmenyAzonosito = null)
|
|
{
|
|
intezmenyAzonosito = intezmenyAzonosito ?? GetIntezmenyAzonosito();
|
|
if (intezmenyAzonosito == null)
|
|
{
|
|
throw new NullReferenceException("Az intézmény azonosító nem található.");
|
|
}
|
|
|
|
var key = GetItemCacheKey(tanevId, itemId, intezmenyAzonosito);
|
|
var dictionaryItems = GetOrAdd(key, k => Load(tanevId, intezmenyAzonosito, itemId));
|
|
var result = dictionaryItems.FirstOrDefault();
|
|
if (result == null)
|
|
{
|
|
throw new NullReferenceException("Ilyen elem nem található.");
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Visszaadja a megadott azonosítójú kódtétel nevét.
|
|
/// </summary>
|
|
/// <param name="tanevId">A kódtétel adatbázisbeli tanév azonosítója</param>
|
|
/// <param name="itemId">A kódtétel adatbázisbeli azonosítója</param>
|
|
/// <param name="intezmenyAzonosito">A kódtétel adatbázisbeli intézmény szöveges azonosítója</param>
|
|
public string GetItemName(int tanevId, int itemId, string intezmenyAzonosito = null)
|
|
{
|
|
return GetById(tanevId, itemId, intezmenyAzonosito).Name;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Törlés a gyorsítótárból
|
|
/// </summary>
|
|
/// <param name="tanevId">A kódtétel adatbázisbeli tanév azonosítója</param>
|
|
/// <param name="typeId">A kódtétel adatbázisbeli típusa</param>
|
|
/// <param name="itemId">A kódtétel adatbázisbeli azonosítója</param>
|
|
/// <param name="intezmenyAzonosito">A kódtétel adatbázisbeli intézmény szöveges azonosítója</param>
|
|
public void RemoveKey(int tanevId, int typeId, int? itemId = null, string intezmenyAzonosito = null)
|
|
{
|
|
var key = GetTypeCacheKey(tanevId, typeId, intezmenyAzonosito ?? GetIntezmenyAzonosito());
|
|
Remove(key);
|
|
|
|
if (itemId.HasValue)
|
|
{
|
|
key = GetItemCacheKey(tanevId, itemId.Value, intezmenyAzonosito ?? GetIntezmenyAzonosito());
|
|
Remove(key);
|
|
}
|
|
}
|
|
|
|
#region Private Methods
|
|
|
|
/// <summary>
|
|
/// Visszadja a kódtétel típus gyorsítótár kulcsát
|
|
/// </summary>
|
|
/// <param name="tanevId">A kódtétel adatbázisbeli tanév azonosítója</param>
|
|
/// <param name="typeId">A kódtétel adatbázisbeli típusa</param>
|
|
/// <param name="intezmenyAzonosito">A kódtétel adatbázisbeli intézmény szöveges azonosítója</param>
|
|
private string GetTypeCacheKey(int tanevId, int typeId, string intezmenyAzonosito)
|
|
=> $"{nameof(Kreta)}_{nameof(DictionaryTableCache)}_{intezmenyAzonosito.ToLower()}_{tanevId}_Type_{typeId}";
|
|
|
|
/// <summary>
|
|
/// Visszadja a kódtétel gyorsítótár kulcsát
|
|
/// </summary>
|
|
/// <param name="tanevId">A kódtétel adatbázisbeli tanév azonosítója</param>
|
|
/// <param name="itemId">A kódtétel adatbázisbeli azonosítója</param>
|
|
/// <param name="intezmenyAzonosito">A kódtétel adatbázisbeli intézmény szöveges azonosítója</param>
|
|
private string GetItemCacheKey(int tanevId, int itemId, string intezmenyAzonosito)
|
|
=> $"{nameof(Kreta)}_{nameof(DictionaryTableCache)}_{intezmenyAzonosito.ToLower()}_{tanevId}_Item_{itemId}";
|
|
|
|
/// <summary>
|
|
/// Visszadja az aktuális intézmény azonosítóját
|
|
/// </summary>
|
|
private static string GetIntezmenyAzonosito()
|
|
=> UserContext.Instance != null && !string.IsNullOrWhiteSpace(UserContext.Instance.IntezmenyAzonosito) ?
|
|
UserContext.Instance.IntezmenyAzonosito :
|
|
SDAServer.Instance.GetOrganizationIdentifier();
|
|
|
|
/// <summary>
|
|
/// Az adatbázisból feltölti a DictionaryItem elemet
|
|
/// </summary>
|
|
/// <param name="sdaDataReader">SDADataReader</param>
|
|
private static DictionaryItem CreateDictionaryItem(SDADataReader sdaDataReader)
|
|
{
|
|
var id = sdaDataReader.GetInt32(0);
|
|
var value = sdaDataReader.GetInt32(1, default);
|
|
var name = sdaDataReader.GetString(2);
|
|
var name1 = sdaDataReader.GetString(3, string.Empty);
|
|
var name2 = sdaDataReader.GetString(4, string.Empty);
|
|
var name3 = sdaDataReader.GetString(5, string.Empty);
|
|
var name4 = sdaDataReader.GetString(6, string.Empty);
|
|
var isVisible = sdaDataReader.GetBoolean(7);
|
|
var code = sdaDataReader.GetString(8, string.Empty);
|
|
var type = sdaDataReader.GetString(9);
|
|
var isProtected = sdaDataReader.GetBoolean(10);
|
|
var color = sdaDataReader.GetString(11, string.Empty);
|
|
var order = sdaDataReader.GetInt32(12, default);
|
|
var bgColor = sdaDataReader.GetString(13, string.Empty);
|
|
var description = sdaDataReader.GetString(14, string.Empty);
|
|
var isActive = sdaDataReader.GetBoolean(15);
|
|
var shortName = sdaDataReader.GetString(16, string.Empty);
|
|
var dictionaryTypeId = sdaDataReader.GetInt32(17);
|
|
|
|
var result = new DictionaryItem(
|
|
id,
|
|
value,
|
|
name,
|
|
name1,
|
|
name2,
|
|
name3,
|
|
name4,
|
|
isVisible,
|
|
code,
|
|
type,
|
|
isProtected,
|
|
color,
|
|
order,
|
|
bgColor,
|
|
description,
|
|
isActive,
|
|
shortName,
|
|
dictionaryTypeId);
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Betölti a kódtételeket
|
|
/// </summary>
|
|
/// <param name="tanevId">A kódtétel adatbázisbeli tanév azonosítója</param>
|
|
/// <param name="intezmenyAzonosito">A kódtétel adatbázisbeli intézmény szöveges azonosítója</param>
|
|
/// <param name="itemId">A kódtétel adatbázisbeli azonosítója</param>
|
|
/// <param name="typeId">A kódtétel adatbázisbeli típusa</param>
|
|
/// <returns>Kódtétel lista</returns>
|
|
private static List<DictionaryItem> Load(int tanevId, string intezmenyAzonosito, int? itemId = null, int? typeId = null)
|
|
{
|
|
if (itemId.HasValue && typeId.HasValue)
|
|
{
|
|
throw new ArgumentException("Csak az egyik adható meg.");
|
|
}
|
|
|
|
if (!itemId.HasValue && !typeId.HasValue)
|
|
{
|
|
throw new ArgumentException("Az egyik megadása kötelező.");
|
|
}
|
|
|
|
var result = new List<DictionaryItem>();
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_VALUE
|
|
,C_NAME
|
|
,C_NAME_1
|
|
,C_NAME_2
|
|
,C_NAME_3
|
|
,C_NAME_4
|
|
,C_VISIBLE
|
|
,C_CODE
|
|
,C_TYPE
|
|
,C_PROTECTED
|
|
,C_COLOR
|
|
,C_ORDER
|
|
,C_BGCOLOR
|
|
,C_DESCRIPTION
|
|
,C_ISACTIVE
|
|
,C_SHORTNAME
|
|
,C_DICTIONARYTYPEID
|
|
FROM T_DICTIONARYITEMBASE_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_TANEVID = @{nameof(tanevId)}
|
|
";
|
|
|
|
if (itemId.HasValue)
|
|
{
|
|
sdaCommand.CommandText += $@"
|
|
AND ID = @{nameof(itemId)}
|
|
";
|
|
sdaCommand.Parameters.Add(nameof(itemId), itemId.Value);
|
|
}
|
|
|
|
if (typeId.HasValue)
|
|
{
|
|
sdaCommand.CommandText += $@"
|
|
AND C_DICTIONARYTYPEID = @{nameof(typeId)}
|
|
ORDER BY
|
|
C_ORDER
|
|
,C_NAME
|
|
";
|
|
sdaCommand.Parameters.Add(nameof(typeId), typeId.Value);
|
|
}
|
|
|
|
sdaCommand.Parameters.Add(nameof(tanevId), SDADBType.Int).Value = tanevId;
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var dictionaryItem = CreateDictionaryItem(sdaDataReader);
|
|
result.Add(dictionaryItem);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (result.Any() && DictionaryItemExtendedPropertiesLoadFunctions.ContainsKey(result.First().DictionaryTypeId))
|
|
{
|
|
DictionaryItemExtendedPropertiesLoadFunctions[result.First().DictionaryTypeId].Invoke(tanevId, intezmenyAzonosito, result);
|
|
// NOTE: Remove-olni kell az összes olyan DictionaryItem-et a listából, aminek null az ExtendedProperties értéke, mert akkor ez azt jelenti,
|
|
// hogy nincs a DictionaryItemBase-hez tartozó altáblában kapcsolódó sor vagy ha van is, akkor az töröltre van állítva.
|
|
if (result.Any(x => x.ExtendedProperties == null))
|
|
{
|
|
result.RemoveAll(x => x.ExtendedProperties == null);
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
private static void LoadAllampolgarsagDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_KOD2
|
|
FROM T_ALLAMPOLGARSAG_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, kod2) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetString(1, string.Empty));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(AllampolgarsagDictionaryItem.Kod2), kod2 }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadMunkakorTipusDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_ALKALMAZOTTMUNKAKORTIPUSID
|
|
,C_ISSZIRSTATOKTATO
|
|
FROM T_MUNKAKORTIPUS_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, alkalmazottMunkaKorTipusId, isSzirStatOktato) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetInt32(1, default),
|
|
sdaDataReader.GetBoolean(2));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(MunkakorTipusDictionaryItem.AlkalmazottMunkaKorTipusId), alkalmazottMunkaKorTipusId },
|
|
{ nameof(MunkakorTipusDictionaryItem.IsSzirStatOktato), isSzirStatOktato }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadOrszagTipusDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_ISOKOD
|
|
,C_KOD2
|
|
,C_OECDKOD
|
|
FROM T_ORSZAGTIPUS_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, isoKod, kod2, oecdKod) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetString(1),
|
|
sdaDataReader.GetString(2, string.Empty),
|
|
sdaDataReader.GetInt32(3, default));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(OrszagTipusDictionaryItem.IsoKod), isoKod },
|
|
{ nameof(OrszagTipusDictionaryItem.Kod2), kod2 },
|
|
{ nameof(OrszagTipusDictionaryItem.OecdKod), oecdKod }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadCsoportTipusDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_ISMUVESZETI
|
|
,C_ISTANORAICELU
|
|
,C_ORAPERC
|
|
FROM T_CSOPORTTIPUS_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, isMuveszeti, isTanoraiCelu, oraPerc) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetBoolean(1),
|
|
sdaDataReader.GetBoolean(2),
|
|
sdaDataReader.GetInt32(3, default));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(CsoportTipusDictionaryItem.IsMuveszeti), isMuveszeti },
|
|
{ nameof(CsoportTipusDictionaryItem.IsTanoraiCelu), isTanoraiCelu },
|
|
{ nameof(CsoportTipusDictionaryItem.OraPerc), oraPerc }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadOktatasiNevelesiFeladatDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_ESLKOZEPESATLAG
|
|
,C_FELADATKATEGORIAID
|
|
FROM T_OKTATASINEVELESIFELADAT_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, eslKozepesAtlag, feladatKategoriaId) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetDouble(1),
|
|
sdaDataReader.GetInt32(2));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(OktatasiNevelesiFeladatDictionaryItem.EslKozepesAtlag), eslKozepesAtlag },
|
|
{ nameof(OktatasiNevelesiFeladatDictionaryItem.FeladatKategoriaId), feladatKategoriaId }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadEvfolyamTipusDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_ALAPORASZAM
|
|
,C_ISOSSZEVONT
|
|
,C_KOVETKEZOEVFOLYAMTIPUSID
|
|
,C_MINIMUMORASZAM
|
|
,C_VISZONYITASILETSZAM
|
|
FROM T_EVFOLYAMTIPUS_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, alapOraszam, isOsszevont, kovetkezoEvfolyamTipusId, minimumOraszam, viszonyitasiLetszam) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetDouble(1),
|
|
sdaDataReader.GetBoolean(2),
|
|
sdaDataReader.GetInt32(3, default),
|
|
sdaDataReader.GetDouble(4),
|
|
sdaDataReader.GetDouble(5));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(EvfolyamTipusDictionaryItem.AlapOraszam), alapOraszam },
|
|
{ nameof(EvfolyamTipusDictionaryItem.IsOsszevont), isOsszevont },
|
|
{ nameof(EvfolyamTipusDictionaryItem.KovetkezoEvfolyamTipusId), kovetkezoEvfolyamTipusId },
|
|
{ nameof(EvfolyamTipusDictionaryItem.MinimumOraszam), minimumOraszam },
|
|
{ nameof(EvfolyamTipusDictionaryItem.ViszonyitasiLetszam), viszonyitasiLetszam }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadNapTipusDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_ISLENEMKOTOTTMUNKAIDO
|
|
,C_ISSORSZAMOZANDO
|
|
,C_ISTANITASINAP
|
|
,C_ISTANORAI
|
|
,C_ISTANORANKIVULI
|
|
FROM T_NAPTIPUS_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, isLeNemKotottMunkaido, isSorszamozando, isTanitasiNap, isTanorai, isTanoranKivuli) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetBoolean(1),
|
|
sdaDataReader.GetBoolean(2),
|
|
sdaDataReader.GetBoolean(3),
|
|
sdaDataReader.GetBoolean(4),
|
|
sdaDataReader.GetBoolean(5));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(NapTipusDictionaryItem.IsLeNemKotottMunkaido), isLeNemKotottMunkaido },
|
|
{ nameof(NapTipusDictionaryItem.IsSorszamozando), isSorszamozando },
|
|
{ nameof(NapTipusDictionaryItem.IsTanitasiNap), isTanitasiNap },
|
|
{ nameof(NapTipusDictionaryItem.IsTanorai), isTanorai },
|
|
{ nameof(NapTipusDictionaryItem.IsTanoranKivuli), isTanoranKivuli }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadSorolasOkaTipusDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_ISBIZONYITVANYBANMEGJELENIK
|
|
,C_ISNAPLOBANMEGJELENIK
|
|
,C_ISTORZSLAPONMEGJELENIK
|
|
FROM T_SOROLASOKATIPUS_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, isBizonyitvanybanMegjelenik, isNaplobanMegjelenik, isTorzslaponMegjelenik) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetBoolean(1),
|
|
sdaDataReader.GetBoolean(2),
|
|
sdaDataReader.GetBoolean(3));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(SorolasOkaTipusDictionaryItem.IsBizonyitvanybanMegjelenik), isBizonyitvanybanMegjelenik },
|
|
{ nameof(SorolasOkaTipusDictionaryItem.IsNaplobanMegjelenik), isNaplobanMegjelenik },
|
|
{ nameof(SorolasOkaTipusDictionaryItem.IsTorzslaponMegjelenik), isTorzslaponMegjelenik }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadErtekelesModDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_ISBOLD
|
|
,C_ISSZAMONKERESKORLATOZOTT
|
|
,C_SULY
|
|
FROM T_ERTEKELESMOD_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, isBold, isSzamonkeresKorlatozott, suly) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetBoolean(1),
|
|
sdaDataReader.GetBoolean(2),
|
|
sdaDataReader.GetInt32(3));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(ErtekelesModDictionaryItem.IsBold), isBold },
|
|
{ nameof(ErtekelesModDictionaryItem.IsSzamonkeresKorlatozott), isSzamonkeresKorlatozott },
|
|
{ nameof(ErtekelesModDictionaryItem.Suly), suly }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadErtekelesTipusDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_ISEGYSZERADHATO
|
|
FROM T_ERTEKELESTIPUS_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, isEgyszerAdhato) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetBoolean(1));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(ErtekelesTipusDictionaryItem.IsEgyszerAdhato), isEgyszerAdhato }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadEsemenyTipusDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_ISELLENORZOBENMEGJELENIK
|
|
,C_ISNAPLOBANMEGJELENIK
|
|
,C_ISTORZSLAPONMEGJELENIK
|
|
FROM T_ESEMENYTIPUS_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, isEllenorzobenMegjelenik, isNaplobanMegjelenik, isTorzslaponMegjelenik) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetBoolean(1),
|
|
sdaDataReader.GetBoolean(2),
|
|
sdaDataReader.GetBoolean(3));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(EsemenyTipusDictionaryItem.IsEllenorzobenMegjelenik), isEllenorzobenMegjelenik },
|
|
{ nameof(EsemenyTipusDictionaryItem.IsNaplobanMegjelenik), isNaplobanMegjelenik },
|
|
{ nameof(EsemenyTipusDictionaryItem.IsTorzslaponMegjelenik), isTorzslaponMegjelenik }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadSzakkepesitesTipusDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_SZAKKEPESITESSZINT
|
|
,C_TANULMANYITERULET
|
|
,C_TERULETSORSZAM
|
|
FROM T_SZAKKEPESITESTIPUS_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, szakkepesitesSzint, tanulmanyiTerulet, teruletSorszam) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetInt32(1, default),
|
|
sdaDataReader.GetInt32(2, default),
|
|
sdaDataReader.GetInt32(3, default));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(SzakkepesitesTipusDictionaryItem.SzakkepesitesSzint), szakkepesitesSzint },
|
|
{ nameof(SzakkepesitesTipusDictionaryItem.TanulmanyiTerulet), tanulmanyiTerulet },
|
|
{ nameof(SzakkepesitesTipusDictionaryItem.TeruletSorszam), teruletSorszam }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadOraTulajdonsagTipusDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_BOOLDEFAULT
|
|
,C_ISORARENDIORA
|
|
FROM T_ORATULAJDONSAGTIPUS_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, boolDefault, isOrarendiOra) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetBoolean(1),
|
|
sdaDataReader.GetBoolean(2));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(OraTulajdonsagTipusDictionaryItem.BoolDefault), boolDefault },
|
|
{ nameof(OraTulajdonsagTipusDictionaryItem.IsOrarendiOra), isOrarendiOra }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadDokumentumKulcsszoTipusDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_POSZEIDONKULCSSZOTIPUS
|
|
FROM T_DOKUMENTUMKULCSSZOTIPUS_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, poszeidonKulcsszoTipus) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetString(1, string.Empty));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(DokumentumKulcsszoTipusDictionaryItem.PoszeidonKulcsszoTipus), poszeidonKulcsszoTipus }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadOktNevelesiKategoriaDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_FELADATCSOPORTTANULOOSZTALYK
|
|
FROM T_OKTNEVELESIKATEGORIA_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, feladatCsoportTanuloOsztalyKapcsolatMaxSzama) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetInt32(1));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(OktNevelesiKategoriaDictionaryItem.FeladatCsoportTanuloOsztalyKapcsolatMaxSzama), feladatCsoportTanuloOsztalyKapcsolatMaxSzama }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadTavolletTipusDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_SAPKOD
|
|
FROM T_TAVOLLETTIPUS_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, sapKod) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetString(1, string.Empty));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(TavolletTipusDictionaryItem.SapKod), sapKod }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadAgazatUjSzktTipusDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_AGAZATIBESOROLAS
|
|
FROM T_AGAZATUJSZKTTIPUS_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, agazatiBesorolas) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetInt32(1, default));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(AgazatUjSzktTipusDictionaryItem.AgazatiBesorolas), agazatiBesorolas }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadSzakmaTipusDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_AGAZATID
|
|
,C_ALAPFOKUOKTATASIIDOTARTAM
|
|
,C_DITIGTALISKOMPETENCIAKERETSZ
|
|
,C_ERETTSEGIOKTATASIIDOTARTAM
|
|
,C_SZAKKEPESITESAZONOSITOSZAM
|
|
FROM T_SZAKMATIPUS_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, agazatId, alapfokuOktatasiIdotartam, digitalisKompetenciaKeretszint, erettsegiOktatasiIdotartam, szakkepesitesAzonositoszam) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetInt32(1, default),
|
|
sdaDataReader.GetInt32(2, default),
|
|
sdaDataReader.GetInt32(3, default),
|
|
sdaDataReader.GetInt32(4, default),
|
|
sdaDataReader.GetString(5, string.Empty));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(SzakmaTipusDictionaryItem.AgazatId), agazatId },
|
|
{ nameof(SzakmaTipusDictionaryItem.AlapfokuOktatasiIdotartam), alapfokuOktatasiIdotartam },
|
|
{ nameof(SzakmaTipusDictionaryItem.DigitalisKompetenciaKeretszint), digitalisKompetenciaKeretszint },
|
|
{ nameof(SzakmaTipusDictionaryItem.ErettsegiOktatasiIdotartam), erettsegiOktatasiIdotartam },
|
|
{ nameof(SzakmaTipusDictionaryItem.SzakkepesitesAzonositoszam), szakkepesitesAzonositoszam }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void LoadAgazatReszSzakmaTipusDictionaryItems(int tanevId, string intezmenyAzonosito, List<DictionaryItem> dictionaryItems)
|
|
{
|
|
if (!dictionaryItems.Any())
|
|
{
|
|
throw new ArgumentException("Nincs DictionaryItem a listában!");
|
|
}
|
|
|
|
using (var sdaConnection = new SDAConnection(SDAServer.Instance.GetIntezmenyConnectionString(intezmenyAzonosito)))
|
|
{
|
|
sdaConnection.Open();
|
|
|
|
using (var sdaCommand = sdaConnection.CreateCommand())
|
|
{
|
|
sdaCommand.Parameters.Add("TanevId", SDADBType.Int).Value = tanevId;
|
|
var dictionaryItemIds = string.Join(", ", dictionaryItems.Select(x => x.Id));
|
|
|
|
sdaCommand.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
,C_OKTATASINEVELESIFELADATID
|
|
FROM T_AGAZATRESZSZAKMATIPUS_OSSZES
|
|
WHERE TOROLT = 'F'
|
|
AND C_ALTANEVID = @TanevId
|
|
AND ID IN ({dictionaryItemIds})
|
|
";
|
|
|
|
using (var sdaDataReader = sdaCommand.ExecuteReader())
|
|
{
|
|
while (sdaDataReader.Read())
|
|
{
|
|
var (id, oktatasiNevelesiFeladatId) = (
|
|
sdaDataReader.GetInt32(0),
|
|
sdaDataReader.GetInt32(1, default));
|
|
|
|
var dictionaryItem = dictionaryItems.Single(x => x.Id == id);
|
|
var extendedProperties = new Dictionary<string, object>
|
|
{
|
|
{ nameof(AgazatReszSzakmaTipusDictionaryItem.OktatasiNevelesiFeladatId), oktatasiNevelesiFeladatId }
|
|
};
|
|
dictionaryItem.ExtendedProperties = extendedProperties;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|