152 lines
7 KiB
C#
152 lines
7 KiB
C#
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using Kreta.BusinessLogic.Helpers;
|
|
using Kreta.Client.Eugyintezes;
|
|
using Kreta.Client.Eugyintezes.Configuration;
|
|
using Kreta.Core.ConnectionType;
|
|
using Kreta.Enums.ManualEnums;
|
|
using Kreta.Resources;
|
|
using Kreta.Web.Areas.OsztalyCsoport.Models;
|
|
using Kreta.Web.Helpers;
|
|
using Kreta.Web.Security;
|
|
using Newtonsoft.Json;
|
|
using RestSharp;
|
|
|
|
namespace Kreta.Web.Areas.Beiratkozas.Models
|
|
{
|
|
public static class NebuloWebLogic
|
|
{
|
|
public static void CreateKovTanevTanuloFromFelvettNebulo(int? nebuloId)
|
|
{
|
|
var helper = new OsztalyCsoportbaSorolasHelper(ConnectionTypeExtensions.GetSessionConnectionType(), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID, kovTanev: true);
|
|
KovTanevNebuloBesorolasModel model = new KovTanevNebuloBesorolasModel();
|
|
model.ToElements = helper.ConvertDDLItemToNormal(helper.FelvettEsMegNemLetezoKovTanevesNebulok(nebuloId.HasValue));
|
|
|
|
if (nebuloId.HasValue)
|
|
{
|
|
model.ToElements = model.ToElements.Where(x => x.Id == nebuloId).ToList();
|
|
}
|
|
|
|
if (model.ToElements.Count > 0)
|
|
{
|
|
var tanevHelper = new TanevHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
|
var kovTanevId = tanevHelper.GetKovTanevId();
|
|
|
|
new OsztalyCsoportbaSorolasHelper(new SessionConnectionType(ClaimData.SessionId, ClaimData.FelhasznaloId, ClaimData.IntezmenyId, ClaimData.IntezmenyAzonosito, kovTanevId), ClaimData.IsSzakkepzoIntezmeny, ClaimData.IsSelectedTanev21_22OrLater, ClaimData.AktivTanevID, ClaimData.KovTanevID, kovTanev: true).TanulokLetrehozasaBAINebulokbol(model, ClaimData.IsSzirIntezmeny);
|
|
}
|
|
}
|
|
|
|
public static void BAIPreCheck(IEugyintezesClientConfiguration config)
|
|
{
|
|
var nebuloHelper = new NebuloHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
|
var ds = nebuloHelper.GetBAIPreCheckUgyszamList();
|
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
List<PreCheckModel> ugyszamList = new List<PreCheckModel>();
|
|
foreach (DataRow row in ds.Tables[0].Rows)
|
|
{
|
|
ugyszamList.Add(new PreCheckModel { Ugyiratszam = row.Field<string>("eUgyszam"), TanuloOktatasiAzonosito = row.Field<string>("oktAzon") });
|
|
}
|
|
|
|
var jsonData = JsonConvert.SerializeObject(ugyszamList);
|
|
EugyintezesClient eUgyClient = new EugyintezesClient(config);
|
|
ProgressBAIPreCheckResult(eUgyClient.GetBAIPreCheck(jsonData));
|
|
}
|
|
}
|
|
|
|
public static bool KretaPreCheck()
|
|
{
|
|
var nebuloHelper = new NebuloHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
|
return nebuloHelper.GetKretaPreCheck();
|
|
}
|
|
|
|
private static void ProgressBAIPreCheckResult(string result)
|
|
{
|
|
var resultList = JsonConvert.DeserializeObject<List<KerelemStatuszokResponseModel>>(result);
|
|
var nebuloHelper = new NebuloHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
|
|
|
if (resultList != null)
|
|
{
|
|
foreach (var item in resultList)
|
|
{
|
|
int statusz = (int)EugyStatuszEnum.NemSzinkronizalt;
|
|
|
|
if (item.Statusz == null)
|
|
{ statusz = (int)EugyStatuszEnum.HibasNincsIlyenUgyszam; }
|
|
else if (item.Statusz.ToUpper() == "HIANYPOTLAS")
|
|
{ statusz = (int)EugyStatuszEnum.HibasRosszAStatuszHianypotlas; }
|
|
else if (item.Statusz.ToUpper() == "KESZ" || item.Statusz.ToUpper() == "LEZART")
|
|
{ statusz = (int)EugyStatuszEnum.HibasRosszAStatusz; }
|
|
|
|
nebuloHelper.UpdateNebuloStatusz(item.Ugyiratszam, item.TanuloOktatasiAzonosito, statusz);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void BAIDontesAtadas(IEugyintezesClientConfiguration config, int kretaId, string jsonData)
|
|
{
|
|
var nebuloHelper = new NebuloHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
|
nebuloHelper.UpdateNebuloStatusz(kretaId, "", (int)EugyStatuszEnum.Folyamatban);
|
|
|
|
Hangfire.BackgroundJob.Enqueue<Job.Tasks.Core.IEugyintezesJob>((a) => a.BaiSzinkronizacio(null, config.BaseUrl, config.ApiKey, ClaimData.IntezmenyAzonosito, kretaId, jsonData));
|
|
}
|
|
|
|
public static IRestResponse NebuloInsert(IEugyintezesClientConfiguration config, string kretaIntezmenyAzonosito, string jsonData)
|
|
{
|
|
EugyintezesClient eUgyClient = new EugyintezesClient(config);
|
|
return eUgyClient.NebuloInsert(kretaIntezmenyAzonosito, jsonData);
|
|
}
|
|
|
|
public static IRestResponse NebuloStatuszUpdate(IEugyintezesClientConfiguration config, string kretaIntezmenyAzonosito, string jsonData)
|
|
{
|
|
EugyintezesClient eUgyClient = new EugyintezesClient(config);
|
|
return eUgyClient.NebuloStatuszUpdate(kretaIntezmenyAzonosito, jsonData);
|
|
}
|
|
|
|
public static IRestResponse NebuloDataUpdate(IEugyintezesClientConfiguration config, string kretaIntezmenyAzonosito, string jsonData)
|
|
{
|
|
EugyintezesClient eUgyClient = new EugyintezesClient(config);
|
|
return eUgyClient.NebuloDataUpdate(kretaIntezmenyAzonosito, jsonData);
|
|
}
|
|
|
|
public static IRestResponse NebuloDelete(IEugyintezesClientConfiguration config, string kretaIntezmenyAzonosito, string jsonData)
|
|
{
|
|
EugyintezesClient eUgyClient = new EugyintezesClient(config);
|
|
return eUgyClient.NebuloDelete(kretaIntezmenyAzonosito, jsonData);
|
|
}
|
|
|
|
public static string ProcessEugyChangeErrorResult(IRestResponse eUgyResult)
|
|
{
|
|
var respModel = JsonConvert.DeserializeObject<NebuloEUgySaveResponseModel>(eUgyResult.Content);
|
|
|
|
var errorMsg = string.Empty;
|
|
errorMsg += BeiratkozasResource.EugyErrorResponseMsg;
|
|
|
|
foreach (var item in respModel.HibaLista)
|
|
{
|
|
errorMsg += "<br><br><strong>" + item.KretaIntezmenyNev + "</strong>";
|
|
errorMsg += "<br>" + item.KretaIntezmenyCim;
|
|
errorMsg += "<br>" + BeiratkozasResource.OMAzonosito + ": " + item.KretaIntezmenyOmAzonosito;
|
|
}
|
|
|
|
return errorMsg;
|
|
}
|
|
|
|
public static string ProcessEugyInsertErrorResult(List<NebuloEUgySaveResponseModel> respModel)
|
|
{
|
|
var errorMsg = string.Empty;
|
|
errorMsg += BeiratkozasResource.EugyErrorResponseMsg;
|
|
|
|
foreach (var item in respModel[0].HibaLista)
|
|
{
|
|
errorMsg += "<br><br><strong>" + item.KretaIntezmenyNev + "</strong>";
|
|
errorMsg += "<br>" + item.KretaIntezmenyCim;
|
|
errorMsg += "<br>" + BeiratkozasResource.OMAzonosito + ": " + item.KretaIntezmenyOmAzonosito;
|
|
}
|
|
|
|
return errorMsg;
|
|
}
|
|
}
|
|
}
|