98 lines
3.8 KiB
C#
98 lines
3.8 KiB
C#
using System;
|
|
using System.Net;
|
|
using System.Web.Mvc;
|
|
using Kreta.BusinessLogic.HelperClasses;
|
|
using Kreta.BusinessLogic.Helpers;
|
|
using Kreta.BusinessLogic.Security;
|
|
using Kreta.Client.KGR;
|
|
using Kreta.Core;
|
|
using Kreta.Web.Areas.GRModul.Models;
|
|
using Kreta.Web.Helpers;
|
|
using Kreta.Web.Helpers.Error;
|
|
using Kreta.Web.Helpers.Modal;
|
|
using Kreta.Web.Models.EditorTemplates;
|
|
using Kreta.Web.Security;
|
|
|
|
namespace Kreta.Web.Areas.GRModul.Controllers
|
|
{
|
|
[MvcRoleClaimsAuthorize(true)]
|
|
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue)]
|
|
[MvcRolePackageAuthorize(KretaClaimPackages.KKGazdasagiUgyintezo.ClaimValue)]
|
|
public class KotelezettsegvallalasController : Controller
|
|
{
|
|
|
|
private readonly IKGRClient _kgrClient;
|
|
|
|
public KotelezettsegvallalasController(IKGRClient kgrClient)
|
|
{
|
|
_kgrClient = kgrClient ?? throw new ArgumentNullException(nameof(kgrClient));
|
|
}
|
|
|
|
public ActionResult Index()
|
|
{
|
|
var model = new KotvallSearchModel
|
|
{
|
|
Tanev = ClaimData.SelectedTanevID.HasValue ? ClaimData.SelectedTanevID.Value : ClaimData.AktivTanevID.Value,
|
|
};
|
|
return View(model);
|
|
}
|
|
|
|
public ActionResult OpenNewModInfoPopUp(int? id, bool? isInfoView)
|
|
{
|
|
var model = new KotvallModel();
|
|
try
|
|
{
|
|
if (id.IsEntityId())
|
|
{
|
|
var helper = new KotvallKezelesHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
|
|
|
KotvallItemCo co = helper.GetKotvallItem(_kgrClient, ClaimData.IntezmenyGuid ?? throw new ApplicationException("Nincs intézmény egyedi azonosito"), id.Value);
|
|
model = KotvallModel.ConvertToModel(co);
|
|
}
|
|
else
|
|
{
|
|
model.BejelentoNeve = ClaimData.FelhasznaloNev;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
if (ex.Data["IntezmenyBeszerzesHiba"] != null)
|
|
{
|
|
throw new StatusError(HttpStatusCode.BadRequest, null) { Json = ex.Data["IntezmenyBeszerzesHiba"], };
|
|
}
|
|
throw new StatusError(HttpStatusCode.BadRequest, ex.Message, ex);
|
|
}
|
|
|
|
model.IsInfoView = isInfoView.HasValue && isInfoView.Value;
|
|
model.Id = id;
|
|
var pm = new PopUpModel(model, "_Kotvall_NewModInfo");
|
|
|
|
pm.Buttons.Add(new ModalButtonModel() { Name = "BtnKotVallCancel", Text = Resources.CommonResource.Megse, EventName = "KotvallHelper.kotvallCancel" });
|
|
|
|
if (!isInfoView.HasValue || !isInfoView.Value)
|
|
{
|
|
pm.Buttons.Add(new ModalButtonModel() { Name = "BtnKotVallmentesOk", Text = Resources.CommonResource.Mentes, EventName = "KotvallHelper.kotvallSave" });
|
|
}
|
|
|
|
return PartialView(Constants.General.PopupView, pm);
|
|
}
|
|
|
|
public ActionResult OpenKiegeszitoInfoPopUp(int? id)
|
|
{
|
|
var model = new KotvallKiegeszitoModel();
|
|
if (id.IsEntityId())
|
|
{
|
|
var helper = new KotvallKezelesHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
|
|
|
KotvallItemCo co = helper.GetKotvallItem(_kgrClient, ClaimData.IntezmenyGuid ?? throw new ApplicationException("Nincs intézmény egyedi azonosito"), id.Value);
|
|
model = KotvallKiegeszitoModel.ConvertToModel(co);
|
|
}
|
|
model.Id = id;
|
|
var pm = new PopUpModel(model, "_Kotvall_KiegeszitoInfo");
|
|
|
|
pm.Buttons.Add(new ModalButtonModel() { Name = "BtnKotVallCancel", Text = Resources.CommonResource.Vissza, EventName = "KotvallHelper.kotvallCancel" });
|
|
|
|
return PartialView(Constants.General.PopupView, pm);
|
|
}
|
|
}
|
|
}
|