init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,75 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Results;
|
||||
using Kreta.BusinessLogic.Classes.ComboBox;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Core;
|
||||
using Kreta.Core.KIR.Domain.Model;
|
||||
using Kreta.Core.KIR.Factory.Interface;
|
||||
using Kreta.Web.Areas.KirImportExport.Logic;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.KirImportExport.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public abstract class BaseApiController : ApiController
|
||||
{
|
||||
protected internal IKirServiceFactory KirServiceFactory { get; }
|
||||
protected internal IKir2ServiceFactory Kir2ServiceFactory { get; }
|
||||
protected internal AuthHeaderModel AuthHeaderModel { get; }
|
||||
protected internal KirImportHelper KirImportHelper { get; }
|
||||
protected internal KirExportHelper2 KirExportHelper { get; }
|
||||
protected internal string KirKretaKodCacheKey => $"{ClaimData.FelhasznaloNev}_{ClaimData.FelhasznaloId}_{ClaimData.IntezmenyAzonosito}_KirKretaKod";
|
||||
protected internal string KirTokenCacheKey => $"{ClaimData.FelhasznaloNev}_{ClaimData.FelhasznaloId}_{ClaimData.IntezmenyAzonosito}_KirToken";
|
||||
protected internal readonly string KirPedagugisListCacheKey;
|
||||
protected internal readonly string KirTanuloListCacheKey;
|
||||
|
||||
protected internal BaseApiController(IKirServiceFactory kirServiceFactory, IKir2ServiceFactory kir2ServiceFactory)
|
||||
{
|
||||
KirServiceFactory = kirServiceFactory ?? throw new ArgumentNullException(nameof(kirServiceFactory));
|
||||
Kir2ServiceFactory = kir2ServiceFactory ?? throw new ArgumentNullException(nameof(kir2ServiceFactory));
|
||||
|
||||
if (Cache.Get($"{ClaimData.FelhasznaloNev}_{ClaimData.FelhasznaloId}_{ClaimData.IntezmenyAzonosito}_KirLogin") is AuthHeaderModel authHeaderModel)
|
||||
{
|
||||
AuthHeaderModel = authHeaderModel;
|
||||
|
||||
var kirImportHelper = new KirImportHelper(kirServiceFactory, authHeaderModel);
|
||||
|
||||
KirPedagugisListCacheKey = $"{ClaimData.IntezmenyAzonosito}_{ClaimData.FelhasznaloId}_KirPedagugisList";
|
||||
KirTanuloListCacheKey = $"{ClaimData.IntezmenyAzonosito}_{ClaimData.FelhasznaloId}_KirTanuloList";
|
||||
|
||||
if (Cache.Get(KirKretaKodCacheKey) is string kretaKod && !string.IsNullOrWhiteSpace(kretaKod))
|
||||
{
|
||||
kirImportHelper.KretaKod = kretaKod;
|
||||
}
|
||||
|
||||
KirImportHelper = kirImportHelper;
|
||||
|
||||
if (HttpContext.Current.Request.UrlReferrer.AbsoluteUri.Contains("IndexExport"))
|
||||
{
|
||||
string kirToken = Cache.Get(KirTokenCacheKey) as string;
|
||||
|
||||
if (authHeaderModel.KirToken != kirToken)
|
||||
{
|
||||
authHeaderModel.KirToken = kirToken;
|
||||
}
|
||||
|
||||
AuthHeaderModel = authHeaderModel;
|
||||
|
||||
var kirExportHelper = new KirExportHelper2(kir2ServiceFactory, authHeaderModel, ClaimData.OrganizationCode, ClaimData.IntezmenyAzonosito);
|
||||
|
||||
KirExportHelper = kirExportHelper;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public JsonResult<List<ComboBoxListItem>> GetKirTelephelyList()
|
||||
{
|
||||
return Json(new KirImportLogic().GetKirTelephelyList(KirImportHelper));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue