init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
77
Kreta.Job.Tasks/EugyintezesJob.cs
Normal file
77
Kreta.Job.Tasks/EugyintezesJob.cs
Normal file
|
@ -0,0 +1,77 @@
|
|||
namespace Kreta.Job.Tasks
|
||||
{
|
||||
using Hangfire.Server;
|
||||
using Kreta.Client.Eugyintezes;
|
||||
using Kreta.Client.Eugyintezes.Configuration;
|
||||
using Kreta.DataAccessManual;
|
||||
using Kreta.Enums.ManualEnums;
|
||||
using Kreta.Job.Tasks.Core;
|
||||
using Kreta.Resources;
|
||||
using static Kreta.Core.Constants;
|
||||
|
||||
public class EugyintezesJob : IEugyintezesJob
|
||||
{
|
||||
public void BaiSzinkronizacio(PerformContext context, string baseUrl, string apiKey, string intezmenyAzonosio, int kretaId, string jsonData)
|
||||
{
|
||||
int retryCount = context.GetJobParameter<int>("RetryCount");
|
||||
var eUgyClient = new EugyintezesClient(new EugyConfig { BaseUrl = baseUrl, ApiKey = apiKey });
|
||||
var result = eUgyClient.PostBAIHatarozatok(jsonData);
|
||||
|
||||
Dal.OrganizationConnection.Run(intezmenyAzonosio, h =>
|
||||
{
|
||||
var dal = h.Nebulo();
|
||||
if (!string.IsNullOrWhiteSpace(result) && result.Replace("\"", "").Length > 0)
|
||||
{
|
||||
dal.UpdateNebuloStatusz(kretaId, result, (int)EugyStatuszEnum.Sikeres);
|
||||
}
|
||||
else if (result == "\"\"")
|
||||
{
|
||||
dal.UpdateNebuloStatusz(kretaId, result.Replace("\"", ""), (int)EugyStatuszEnum.HibasRosszAStatuszHianypotlas);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (General.BaiAdatszinkronRetryAttempts <= retryCount)
|
||||
{
|
||||
dal.UpdateNebuloStatusz(kretaId, result, (int)EugyStatuszEnum.Hibas);
|
||||
}
|
||||
throw new System.Exception("Ervénytelen kísérlet!");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void TeremBerbeadhatoStatuszValtozas(PerformContext context, string baseUrl, string apiKey, string intezmenyAzonosio, string jsonData)
|
||||
{
|
||||
int retryCount = context.GetJobParameter<int>("RetryCount");
|
||||
var eUgyClient = new EugyintezesClient(new EugyConfig { BaseUrl = baseUrl, ApiKey = apiKey });
|
||||
var result = eUgyClient.PostTeremBerbeadhatoStatuszValtozas(jsonData, intezmenyAzonosio);
|
||||
|
||||
if (General.EugySzinkronRetryAttempts <= retryCount)
|
||||
{
|
||||
throw new System.Exception(ErrorResource.EugySzinkronRetryAttempts);
|
||||
}
|
||||
}
|
||||
|
||||
public void TanuloOsztalyBesorolasStatuszValtozas(PerformContext context, string baseUrl, string apiKey, string intezmenyAzonosio, string jsonData)
|
||||
{
|
||||
int retryCount = context.GetJobParameter<int>("RetryCount");
|
||||
var eUgyClient = new EugyintezesClient(new EugyConfig { BaseUrl = baseUrl, ApiKey = apiKey });
|
||||
var result = eUgyClient.PostTanuloOsztalyBesorolasStatuszValtozas(jsonData);
|
||||
|
||||
if (General.EugySzinkronRetryAttempts <= retryCount)
|
||||
{
|
||||
throw new System.Exception(ErrorResource.EugySzinkronRetryAttempts);
|
||||
}
|
||||
}
|
||||
|
||||
private class EugyConfig : IEugyintezesClientConfiguration
|
||||
{
|
||||
public string BaseUrl { get; set; }
|
||||
|
||||
public string ApiKey { get; set; }
|
||||
|
||||
public bool IsUzenetekEnable { get; set; }
|
||||
|
||||
public int UzenetekFrequencyRate { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue