51 lines
1.9 KiB
C#
51 lines
1.9 KiB
C#
using System;
|
|
using System.Web.Mvc;
|
|
using Kreta.BusinessLogic.Helpers;
|
|
using Kreta.BusinessLogic.Security;
|
|
using Kreta.Client.SzirApi;
|
|
using Kreta.Web.Areas.Adatszolgaltatasok.Models;
|
|
using Kreta.Web.Helpers;
|
|
using Kreta.Web.Security;
|
|
|
|
namespace Kreta.Web.Areas.Adatszolgaltatasok.Controllers
|
|
{
|
|
[MvcRoleClaimsAuthorize(true)]
|
|
[MvcRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
|
public class NemAllamiIntOktKoltsegvetesController : Controller
|
|
{
|
|
private readonly ISzirApiClient _szirApiClient;
|
|
|
|
public NemAllamiIntOktKoltsegvetesController(ISzirApiClient szirApiClient)
|
|
{
|
|
_szirApiClient = szirApiClient ?? throw new ArgumentNullException(nameof(szirApiClient));
|
|
}
|
|
|
|
public ActionResult Index()
|
|
{
|
|
var model = new NemAllamiModel();
|
|
try
|
|
{
|
|
var connectionType = ConnectionTypeExtensions.GetSessionConnectionType();
|
|
var helper = new SZIRAdatszolgHelper(connectionType);
|
|
var tanevSorszam = new TanevHelper(connectionType).GetTanevInfo().Sorszam;
|
|
model.IsSzirStatAdatszolgBekuldeseDisabled = !helper.IsVezetoAlkalmazott(ClaimData.FelhasznaloId) ||
|
|
helper.IsSzirStatAdatszolgBekuldeseDisabled(_szirApiClient, tanevSorszam, ClaimData.IntezmenyAzonosito);
|
|
|
|
return View("Index", model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return View("Index", model);
|
|
}
|
|
}
|
|
|
|
public ActionResult NemAllamiDetail(int id)
|
|
{
|
|
var szirStatHelper = new SZIRAdatszolgHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
|
var co = szirStatHelper.GetNemAllamiCo(id);
|
|
|
|
var model = new NemAllamiDetailModel().ConvertCoToModel(co);
|
|
return PartialView(model);
|
|
}
|
|
}
|
|
}
|