init
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Web.Mvc;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Interfaces;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Core.Exceptions;
|
||||
using Kreta.Enums.ManualEnums;
|
||||
using Kreta.Web.Areas.Intezmeny.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Models.EditorTemplates;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.Intezmeny.Controllers
|
||||
{
|
||||
[MvcRoleClaimsAuthorize(true)]
|
||||
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue)]
|
||||
[MvcRolePackageAuthorize(TanevEnum.AktTanev, KretaClaimPackages.Adminisztrator.ClaimValue, KretaClaimPackages.IsSzakkepzoIntezmeny.ClaimValue)]
|
||||
public class OktatottSzakmakController : Controller
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public static string GridName => "OktatottSzakmakGrid";
|
||||
public static string SearchFormName => "OktatottSzakmakSearchForm";
|
||||
|
||||
public static string DownloadFileFormName => "OktatottSzakmakDownloadFileForm";
|
||||
|
||||
public static string MultipleModifyPopUpId => "OktatottSzakmakMultipleModifyPopUpWindow";
|
||||
public static string ModifyPopUpId => "OktatottSzakmakModifyPopUpIdWindow";
|
||||
public static string InfoPopUpId => "OktatottSzakmakInfoPopUpWindow";
|
||||
|
||||
public static string ModifyFormName => "OktatottSzakmakModifyForm";
|
||||
public static string MultipleModifyFormName => "OktatottSzakmakMultipleModifyForm";
|
||||
|
||||
public static string OktatottSzakmaTanulokGridName => "OktatottSzakmaTanulokGrid";
|
||||
public static string OktatottSzakmaTanulokSearchFormName => "OktatottSzakmaTanulokSearchForm";
|
||||
|
||||
#endregion Properties
|
||||
|
||||
private readonly IFileServiceHelper _fileServiceHelper;
|
||||
|
||||
public OktatottSzakmakController(IFileServiceHelper fileServiceHelper)
|
||||
{
|
||||
_fileServiceHelper = fileServiceHelper ?? throw new ArgumentNullException(nameof(fileServiceHelper));
|
||||
}
|
||||
|
||||
public ActionResult Index()
|
||||
{
|
||||
var model = new OktatottSzakmakSearchModel();
|
||||
return View("Index", model);
|
||||
}
|
||||
|
||||
public ActionResult OpenOktatottSzakmaMultipleModifyPopUp(List<int> ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
var coList = new UjSzktSzakmajegyzekOsszerendelesHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetUjSzktSzakmajegyzekOsszerendelesCoList(ids);
|
||||
var model = new OktatottSzakmaMultipleModifyModel(coList);
|
||||
var popUpModel = new PopUpModel(model, "MultipleModify_PopUp");
|
||||
popUpModel.AddCancelBtn(popUpModel, "OktatottSzakmakHelper.oktatottSzakmaMultipleModifyPopUpCancel");
|
||||
popUpModel.AddOkBtn(popUpModel, "OktatottSzakmakHelper.oktatottSzakmaMultipleModifyPopUpSave");
|
||||
return PartialView(Constants.General.PopupView, popUpModel);
|
||||
}
|
||||
catch (BlException ex)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public ActionResult OpenOktatottSzakmaModifyPopUp(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var co = new UjSzktSzakmajegyzekOsszerendelesHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetUjSzktSzakmajegyzekOsszerendelesCo(id);
|
||||
var model = new OktatottSzakmaModifyModel(co);
|
||||
var popUpModel = new PopUpModel(model, "Modify_PopUp");
|
||||
popUpModel.AddCancelBtn(popUpModel, "OktatottSzakmakHelper.oktatottSzakmaModifyPopUpCancel");
|
||||
popUpModel.AddOkBtn(popUpModel, "OktatottSzakmakHelper.oktatottSzakmaModifyPopUpSave");
|
||||
return PartialView(Constants.General.PopupView, popUpModel);
|
||||
}
|
||||
catch (BlException ex)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public ActionResult OpenOktatottSzakmaInfoPopUp(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var co = new UjSzktSzakmajegyzekOsszerendelesHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetUjSzktSzakmajegyzekOsszerendelesCo(id);
|
||||
var model = new OktatottSzakmaInfoModel(co);
|
||||
var popUpModel = new PopUpModel(model, "Info_PopUp");
|
||||
popUpModel.AddCancelBtn(popUpModel, "OktatottSzakmakHelper.oktatottSzakmaInfoPopUpCancel");
|
||||
return PartialView(Constants.General.PopupView, popUpModel);
|
||||
}
|
||||
catch (BlException ex)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public ActionResult DownloadFile(FormCollection form)
|
||||
{
|
||||
var fileId = int.Parse(form["FileIdHiddenField"]);
|
||||
|
||||
var helper = new FileHelper(ConnectionTypeExtensions.GetSessionConnectionType(), _fileServiceHelper);
|
||||
|
||||
var (fajlnev, tartalom) = helper.GetFileData(fileId);
|
||||
var stream = new MemoryStream(tartalom);
|
||||
var result = File(stream, System.Web.MimeMapping.GetMimeMapping(fajlnev), fajlnev);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user