This commit is contained in:
skidoodle 2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

View file

@ -0,0 +1,24 @@
using System.Collections.Generic;
using Kreta.Client.KozpontiKreta.Model;
using Kreta.Core.KozpontiModels.MdszModels;
using Kreta.Core.KozpontiModels.TargyiEszkozModels;
using Kreta.Core.KozpontiModels.UzletiTervezesModels;
using Kreta.Enums.ManualEnums;
using Kreta.Framework;
namespace Kreta.Client.KozpontiKreta.Interface
{
public interface IKozpontiKretaClient
{
List<MdszResponseModel> GetDiakOlimpiaList(MdszRequestModel model);
KozpontiNebuloResponseModel NebuloJelenlet(KozpontiNebuloRequestModel model);
byte[] GetRiportDokumentum(KozpontiKretaDokumentumTipusEnum tipus, SystemType systemType, string intezmenyAzonosito, string tanevId, string formatum = "");
TantargyFelosztasResponse PostTTFEllenorzes(string intezmenyAzonosito, string tanevId);
TantargyFelosztasResponse GetTTFEllenorzes(string intezmenyAzonosito, string tanevId);
List<UzletiTervezesIntezmenyResponseModel> GetIntezmenyUzletiTerv(UzletiTervezesIntezmenyRequestModel model);
List<UzletiTervezesAlkalmazottResponseModel> GetIntezmenyUzletiTervAlkalmazottaknak(UzletiTervezesAlkalmazottRequestModel model);
List<TargyiEszkozResponseModel> GetTargyiEszkozAlkalmazott(TargyiEszkozAlkalmazottRequestModel model);
List<TargyiEszkozResponseModel> GetTargyiEszkozok(TargyiEszkozIntezmenyRequestModel model);
KotelezoOraszamResponseModel GetKotelezoOraszamok(KotelezoOraszamRequestModel model);
}
}

View file

@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using Kreta.Client.KozpontiKreta.Model;
using Kreta.Core.KozpontiModels.MdszModels;
using Newtonsoft.Json;
using RestSharp;
namespace Kreta.Client.KozpontiKreta
{
public class KozpontiClient
{
private readonly string baseUrl;
private readonly string apiKey;
public KozpontiClient(string baseUrl, string apiKey)
{
this.baseUrl = baseUrl;
this.apiKey = apiKey;
}
private IRestResponse Http(Method method, string relativeUri, Dictionary<string, string> parameters = null, Object body = null)
{
var restRequest = new RestRequest(relativeUri, method);
restRequest.AddHeader("ApiKey", apiKey);
if (parameters != null && parameters.Count > 0)
{
foreach (var parameter in parameters)
{
restRequest.AddParameter(parameter.Key, parameter.Value);
}
}
if (method == Method.POST && body != null)
{
restRequest.AddJsonBody(body);
}
var result = new RestClient(string.Format(baseUrl)).Execute(restRequest);
return result;
}
private TResponse Http<TResponse>(Method method, string relativeUri, Dictionary<string, string> parameters = null, Object body = null)
{
var result = Http(method, relativeUri, parameters, body);
var response = JsonConvert.DeserializeObject<TResponse>(result.Content);
return response;
}
private TResponse GetAsync<TResponse>(string relativeUri, Dictionary<string, string> parameters = null)
{
return Http<TResponse>(Method.GET, relativeUri, parameters);
}
private TResponse PostAsync<TResponse>(string relativeUri, Dictionary<string, string> parameters = null, Object body = null)
{
return Http<TResponse>(Method.POST, relativeUri, parameters, body);
}
private void Post(string relativeUri, Dictionary<string, string> parameters = null, Object body = null)
{
Http(Method.POST, relativeUri, parameters, body);
}
public List<MdszResponseModel> GetDiakOlimpiaList(MdszRequestModel model)
{
var response = PostAsync<List<MdszResponseModel>>("/api/Mdsz/external/get", null, model);
return response;
}
public KozpontiNebuloResponseModel NebuloJelenlet(KozpontiNebuloRequestModel model)
{
var response = PostAsync<KozpontiNebuloResponseModel>("/api/nebulo/external/megjelent", null, model);
return response;
}
public KozpontiNebuloEngedelyezettResponseModel GetBeiratkozasLetszamList(KozpontiNebuloEngedelyezettRequestModel model)
{
var response = PostAsync<KozpontiNebuloEngedelyezettResponseModel>("/api/Approves/external/engedelyezett", null, model);
return response;
}
}
}

View file

@ -0,0 +1,237 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using Kreta.Client.ClientBase;
using Kreta.Client.KozpontiKreta.Interface;
using Kreta.Client.KozpontiKreta.Model;
using Kreta.Core.Configuratiaton.Interface;
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;
using Kreta.Resources;
namespace Kreta.Client.KozpontiKreta
{
internal class KozpontiKretaClient : RestSharpClientBase, IKozpontiKretaClient
{
private readonly IKozpontiKretaConfiguration KozpontiKretaConfiguration;
private const string DiakOlimpiaRelativeUrl = "/api/Mdsz/external/get";
private const string NebuloJelenletRelativeUrl = "/api/nebulo/external/megjelent";
private const string ApiPath = "/api/";
private const string TtfPath = "Document/TTFExportExternal";
private const string RiportPath = "Report/ExportReportExternal";
private const string TtfKiegeszitettAdatokPath = "Document/OnlineReportsExportExternal";
private const string TTFEllenorzesPath = "ttfapproves/external";
private const string TtfElfogadottPath = "Document/ApprovedTTFExportExternal";
private const string TargyiEszkozAlkalmazottPath = "/api/saptool/riport/external/targyieszkozalkalmazott";
private const string SzemelyijuttatasIntezmenyPath = "/api/sapperspayments/riport/external/szemelyijuttatasintezmeny";
private const string SzemelyijuttatasAlkalmazottakPath = "/api/sapperspayments/riport/external/szemelyijuttatasalkalmazottak";
private const string TargyiEszkozokIntezmenyPath = "/api/saptool/riport/external/targyieszkozintezmeny";
private const string KotelezoOraszamPath = "/api/Employee/external/kotelezooraszam";
public KozpontiKretaClient(IKozpontiKretaConfiguration kozpontiKretaConfiguration)
{
KozpontiKretaConfiguration = kozpontiKretaConfiguration ?? throw new ArgumentNullException(nameof(kozpontiKretaConfiguration));
BaseUrl = kozpontiKretaConfiguration.KtrUrl;
}
public List<MdszResponseModel> GetDiakOlimpiaList(MdszRequestModel model)
{
var header = new Dictionary<string, string>
{
{ nameof(KozpontiKretaConfiguration.ApiKey), KozpontiKretaConfiguration.ApiKey }
};
var response = Post<List<MdszResponseModel>>(DiakOlimpiaRelativeUrl, header, body: model);
var result = response.Result;
return result;
}
public KozpontiNebuloResponseModel NebuloJelenlet(KozpontiNebuloRequestModel model)
{
var header = new Dictionary<string, string>
{
{ nameof(KozpontiKretaConfiguration.ApiKey), KozpontiKretaConfiguration.ApiKey }
};
var response = Post<KozpontiNebuloResponseModel>(NebuloJelenletRelativeUrl, header, body: model);
var result = response.Result;
return result;
}
private (string DokumentumKey, string DokumentumPath) GetDokumentumDetails(KozpontiKretaDokumentumTipusEnum tipus, SystemType systemType)
{
switch (tipus)
{
case KozpontiKretaDokumentumTipusEnum.OsztalyokSzamaRiport:
return (DokumentumKey: "/OSZTALYOK_CSOPORTOK-004-3", DokumentumPath: RiportPath);
case KozpontiKretaDokumentumTipusEnum.CsoportokSzamaRiport:
return (DokumentumKey: "/OSZTALYOK_CSOPORTOK-006-3", DokumentumPath: RiportPath);
case KozpontiKretaDokumentumTipusEnum.FeladatellatasiHelyekRiport:
return (DokumentumKey: "/INTEZMENY-001-3", DokumentumPath: RiportPath);
case KozpontiKretaDokumentumTipusEnum.ReszletesAlkalmazottRiport:
return (DokumentumKey: DokumentumKeyByKornyezet(tipus, systemType), DokumentumPath: RiportPath);
case KozpontiKretaDokumentumTipusEnum.ReszletesTanulokRiport:
return (DokumentumKey: "/SZAKKEPZES-001-3", DokumentumPath: RiportPath);
case KozpontiKretaDokumentumTipusEnum.AgazatiTanuloiLetszamEvfolyamonkentNemenkentRiport:
return (DokumentumKey: "/LETSZAMOK-010-3", DokumentumPath: RiportPath);
case KozpontiKretaDokumentumTipusEnum.TtfExcel:
case KozpontiKretaDokumentumTipusEnum.TtfPdf:
return (DokumentumKey: string.Empty, DokumentumPath: TtfPath);
case KozpontiKretaDokumentumTipusEnum.TtfKiegeszitettAdatok:
return (DokumentumKey: string.Empty, DokumentumPath: TtfKiegeszitettAdatokPath);
case KozpontiKretaDokumentumTipusEnum.TtfElfogadottExcel:
case KozpontiKretaDokumentumTipusEnum.TtfElfogadottPdf:
return (DokumentumKey: string.Empty, DokumentumPath: TtfElfogadottPath);
default:
return (DokumentumKey: string.Empty, DokumentumPath: string.Empty);
}
}
private string DokumentumKeyByKornyezet(KozpontiKretaDokumentumTipusEnum kozpontiKretaDokumentumTipus, SystemType systemType)
{
//systemType = SystemType.NemzetiSzakkepzesiEsFelnottkepzesiHivatal;
if (kozpontiKretaDokumentumTipus == KozpontiKretaDokumentumTipusEnum.ReszletesAlkalmazottRiport)
{
switch (systemType)
{
case SystemType.AZURE:
case SystemType.NSZFH_EMA:
case SystemType.KK:
return "/ALKALMAZOTTAK-018-3-A";
case SystemType.NSZFH:
return "/ALKALMAZOTTAK-018-3-B";
case SystemType.HOI:
return "/ALKALMAZOTTAK-019-3";
}
}
return string.Empty;
}
public byte[] GetRiportDokumentum(KozpontiKretaDokumentumTipusEnum tipus, SystemType systemType, string intezmenyAzonosito, string tanevId, string formatum = "")
{
var (DokumentumKey, DokumentumPath) = GetDokumentumDetails(tipus, systemType);
var header = new Dictionary<string, string>
{
{ nameof(KozpontiKretaConfiguration.ApiKey), KozpontiKretaConfiguration.ApiKey }
};
var response = Get<HttpResponseMessage>($"{ApiPath}{DokumentumPath}{DokumentumKey}/{intezmenyAzonosito}/{tanevId}/{formatum}", headers: header, requestTimeout: 600000);
if (response.StatusCode != HttpStatusCode.OK)
{
if (response.StatusCode == HttpStatusCode.NoContent)
{
response.StatusDescription = NyomtatvanyokResource.UresDokumentum;
}
throw new ClientException(response.StatusDescription, response.StatusCode);
}
return response.RawBytes;
}
public TantargyFelosztasResponse PostTTFEllenorzes(string intezmenyAzonosito, string tanevId)
{
var header = new Dictionary<string, string>
{
{ nameof(KozpontiKretaConfiguration.ApiKey), KozpontiKretaConfiguration.ApiKey }
};
return Post<TantargyFelosztasResponse>($"{ApiPath}{TTFEllenorzesPath}/{intezmenyAzonosito}/{tanevId}", headers: header).Result;
}
public TantargyFelosztasResponse GetTTFEllenorzes(string intezmenyAzonosito, string tanevId)
{
var header = new Dictionary<string, string>
{
{ nameof(KozpontiKretaConfiguration.ApiKey), KozpontiKretaConfiguration.ApiKey }
};
return Get<TantargyFelosztasResponse>($"{ApiPath}{TTFEllenorzesPath}/{intezmenyAzonosito}/{tanevId}", headers: header).Result;
}
public List<UzletiTervezesIntezmenyResponseModel> GetIntezmenyUzletiTerv(UzletiTervezesIntezmenyRequestModel model)
{
var header = new Dictionary<string, string>
{
{ nameof(KozpontiKretaConfiguration.ApiKey), KozpontiKretaConfiguration.ApiKey }
};
var response = Post<List<UzletiTervezesIntezmenyResponseModel>>(SzemelyijuttatasIntezmenyPath, header, body: model);
var result = response.Result;
return result;
}
public List<UzletiTervezesAlkalmazottResponseModel> GetIntezmenyUzletiTervAlkalmazottaknak(UzletiTervezesAlkalmazottRequestModel model)
{
var header = new Dictionary<string, string>
{
{ nameof(KozpontiKretaConfiguration.ApiKey), KozpontiKretaConfiguration.ApiKey }
};
var response = Post<List<UzletiTervezesAlkalmazottResponseModel>>(SzemelyijuttatasAlkalmazottakPath, header, body: model);
var result = response.Result;
return result;
}
public List<TargyiEszkozResponseModel> GetTargyiEszkozAlkalmazott(TargyiEszkozAlkalmazottRequestModel model)
{
var header = new Dictionary<string, string>
{
{ nameof(KozpontiKretaConfiguration.ApiKey), KozpontiKretaConfiguration.ApiKey }
};
var response = Post<List<TargyiEszkozResponseModel>>(TargyiEszkozAlkalmazottPath, header, body: model);
if (response.StatusCode != HttpStatusCode.OK)
{
throw new BlException(Core.Enum.BlExceptionType.ElvartErtekNemTalalhato);
}
var result = response.Result;
return result;
}
public List<TargyiEszkozResponseModel> GetTargyiEszkozok(TargyiEszkozIntezmenyRequestModel model)
{
var header = new Dictionary<string, string>
{
{ nameof(KozpontiKretaConfiguration.ApiKey), KozpontiKretaConfiguration.ApiKey }
};
var response = Post<List<TargyiEszkozResponseModel>>(TargyiEszkozokIntezmenyPath, header, body: model);
return response.Result;
}
public KotelezoOraszamResponseModel GetKotelezoOraszamok(KotelezoOraszamRequestModel model)
{
var header = new Dictionary<string, string>
{
{ nameof(KozpontiKretaConfiguration.ApiKey), KozpontiKretaConfiguration.ApiKey }
};
var response = Post<KotelezoOraszamResponseModel>(KotelezoOraszamPath, header, body: model);
return response.Result;
}
}
}

View file

@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace Kreta.Client.KozpontiKreta.Model
{
public class KotelezoOraszamRequestModel
{
public string IntezmenyAzonosito { get; set; }
public int TanevId { get; set; }
public List<int> AlkalmazottLista { get; set; }
}
}

View file

@ -0,0 +1,22 @@
using System.Collections.Generic;
namespace Kreta.Client.KozpontiKreta.Model
{
public class KotelezoOraszamResponseModel
{
public string IntezmenyAzonosito { get; set; }
public int TanevId { get; set; }
public List<KotelezoOraszamAlkalmazottResponseModel> AlkalmazottLista { get; set; }
}
public class KotelezoOraszamAlkalmazottResponseModel
{
public int AlkalmazottId { get; set; }
public string OktatasiAzonosito { get; set; }
public string SzTSzAzonosito { get; set; }
public string Adoszam { get; set; }
public string KotelezoOraszamSzoveg { get; set; }
public float KotelezoOraszamMin { get; set; }
public float KotelezoOraszamMax { get; set; }
}
}

View file

@ -0,0 +1,8 @@
namespace Kreta.Client.KozpontiKreta.Model
{
public class KozpontiNebuloEngedelyezettRequestModel
{
public string IntezmenyAzonosito { get; set; }
public int TanevId { get; set; }
}
}

View file

@ -0,0 +1,9 @@
public class KozpontiNebuloEngedelyezettResponseModel
{
public string IntezmenyAzonosito { get; set; }
public int TanevId { get; set; }
public int? EngedelyezettOsztalyLetszam { get; set; }
public int? EngedelyezettOsztaly { get; set; }
public int? EngedelyezettOsszevontOsztalyLetszam { get; set; }
public int? EngedelyezettOsszevontOsztaly { get; set; }
}

View file

@ -0,0 +1,21 @@
using System;
namespace Kreta.Client.KozpontiKreta.Model
{
public class KozpontiNebuloRequestModel
{
public string IntezmenyAzonosito { get; set; }
public int NebuloId { get; set; }
public string NebuloVezeteknev { get; set; }
public string NebuloUtonev { get; set; }
public string AnyjaSzuletesiVezeteknev { get; set; }
public string AnyjaSzuletesiUtonev { get; set; }
public string SzuletesiHely { get; set; }
public DateTime SzuletesiIdo { get; set; }
public bool Importalt { get; set; }
public bool EugyBAIRogzitett { get; set; }
public int? FelvetelStatuszId { get; set; }
public bool Torolt { get; set; }
public int Tipus { get; set; }
}
}

View file

@ -0,0 +1,7 @@
public class KozpontiNebuloResponseModel
{
public string IntezmenyAzonosito { get; set; }
public bool Sikeres { get; set; }
public int StatuszKod { get; set; }
public string StatuszUzenet { get; set; }
}

View file

@ -0,0 +1,18 @@
using System;
namespace Kreta.Client.KozpontiKreta.Model
{
public class ProjektResponseModel
{
public string ID { get; set; }
public bool IsJelentkezheto { get; set; }
public bool IsJelentkezett { get; set; }
public string ProjektAzonosito { get; set; }
public string ProjektNeve { get; set; }
public DateTime? ProjektKezdete { get; set; }
public DateTime? ProjektVege { get; set; }
public DateTime? TSZTOMegkotesDatum { get; set; }
public DateTime JelentkezesiHatarido { get; set; }
}
}

View file

@ -0,0 +1,43 @@
namespace Kreta.Client.KozpontiKreta.Model
{
public class TantargyFelosztasResponse
{
public int IntezmenyId { get; set; }
public int? SearchOsztalyCsoport { get; set; }
public int? SearchTantargy { get; set; }
public int? SearchTanar { get; set; }
public int? SearchEvfolyam { get; set; }
public int? SearchTanev { get; set; }
public double? SearchOraszam { get; set; }
public int? SearchFeladatellatasihely { get; set; }
public int? SearchFoglalkozasTipusa { get; set; }
public bool ElfogadottTTF { get; set; }
public bool ElfogadottESL { get; set; }
public bool VeglegesTTF { get; set; }
public bool VeglegesESL { get; set; }
public bool VeglegesETTF { get; set; }
public bool Islocked { get; set; }
public int StatusCode { get; set; }
public string RegNumber { get; set; }
public string StatusTitle { get; set; }
public string StatusText { get; set; }
}
}