kreta/Kreta.BusinessLogic/Helpers/KozpontiKretaHelper.cs
2024-03-13 00:33:46 +01:00

98 lines
3.5 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using Kreta.BusinessLogic.HelperClasses;
using Kreta.BusinessLogic.Interfaces;
using Kreta.Client;
using Kreta.Client.KozpontiKreta.Interface;
using Kreta.Client.KozpontiKreta.Model;
using Kreta.Core;
using Kreta.Core.Exceptions;
using Kreta.Core.KozpontiModels.MdszModels;
using Kreta.Core.KozpontiModels.TargyiEszkozModels;
using Kreta.Core.KozpontiModels.UzletiTervezesModels;
using Kreta.Enums.ManualEnums;
using Kreta.Framework;
namespace Kreta.BusinessLogic.Helpers
{
internal class KozpontiKretaHelper : IKozpontiKretaHelper
{
private readonly IKozpontiKretaClient KozpontiKretaClient;
public KozpontiKretaHelper(IKozpontiKretaClient kozpontiKretaClient)
{
KozpontiKretaClient = kozpontiKretaClient ?? throw new ArgumentNullException(nameof(kozpontiKretaClient));
}
public KozpontiNebuloResponseModel NebuloJelenlet(KozpontiNebuloRequestModel model)
{
return KozpontiKretaClient.NebuloJelenlet(model);
}
public List<MdszResponseModel> GetDiakOlimpiaList(MdszRequestModel model)
{
return KozpontiKretaClient.GetDiakOlimpiaList(model);
}
public List<UzletiTervezesIntezmenyResponseModel> GetIntezmenyUzletiTerv(UzletiTervezesIntezmenyRequestModel model)
{
return KozpontiKretaClient.GetIntezmenyUzletiTerv(model);
}
public List<UzletiTervezesAlkalmazottResponseModel> GetIntezmenyUzletiTervAlkalmazottaknak(UzletiTervezesAlkalmazottRequestModel model)
{
return KozpontiKretaClient.GetIntezmenyUzletiTervAlkalmazottaknak(model);
}
public List<TargyiEszkozResponseModel> GetTargyiEszkozAlkalmazott(TargyiEszkozAlkalmazottRequestModel model)
{
return KozpontiKretaClient.GetTargyiEszkozAlkalmazott(model);
}
public List<TargyiEszkozResponseModel> GetTargyiEszkozok(TargyiEszkozIntezmenyRequestModel model)
{
return KozpontiKretaClient.GetTargyiEszkozok(model);
}
public MemoryStream GetRiportDokumentum(KozpontiKretaDokumentumTipusEnum tipus, SystemType systemType, TanevCO tanevCo, string intezmenyAzonosito, int selectedTanevId, string formatum = "")
{
try
{
return new MemoryStream(KozpontiKretaClient.GetRiportDokumentum(tipus, systemType, intezmenyAzonosito, GetTanevId(tanevCo), formatum));
}
catch (ClientException ex)
{
throw new BlException(ex.Message, ex.StatusCode);
}
}
public TantargyFelosztasSearchCo PostTTFEllenorzes(string intezmenyAzonosito, TanevCO tanevCo)
{
return KozpontiKretaClient.PostTTFEllenorzes(intezmenyAzonosito, GetTanevId(tanevCo));
}
public TantargyFelosztasSearchCo GetTTFEllenorzes(string intezmenyAzonosito, TanevCO tanevCo)
{
return KozpontiKretaClient.GetTTFEllenorzes(intezmenyAzonosito, GetTanevId(tanevCo));
}
public KotelezoOraszamResponseModel GetKotelezoOraszam(KotelezoOraszamRequestModel model)
{
return KozpontiKretaClient.GetKotelezoOraszamok(model);
}
private string GetTanevId(TanevCO tanevCo)
{
string tanevId = string.Empty;
if (tanevCo != null && tanevCo.Sorszam.IsEntityId())
{
tanevId = tanevCo.Sorszam.ToString();
}
return tanevId;
}
}
}