init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,125 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Kreta.BusinessLogic.Classes;
|
||||
using Kreta.BusinessLogic.HelperClasses;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Interfaces;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Enums;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.ModelBinder.Mvc;
|
||||
using Kreta.Web.Models.EditorTemplates;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.Adatszolgaltatasok.Controllers
|
||||
{
|
||||
[MvcRoleClaimsAuthorize(true)]
|
||||
[MvcRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class SZIRStatController : Controller
|
||||
{
|
||||
private readonly IFileServiceHelper fileServiceHelper;
|
||||
|
||||
public SZIRStatController(IFileServiceHelper fileServiceHelper)
|
||||
{
|
||||
this.fileServiceHelper = fileServiceHelper ?? throw new ArgumentNullException(nameof(fileServiceHelper));
|
||||
}
|
||||
|
||||
public ActionResult Index()
|
||||
{
|
||||
var panelBarBaseModel = new PanelBarBaseModel { PanelName = "SZIRStatPanel" };
|
||||
var panelBarChildModelList = new List<PanelBarChildModel>();
|
||||
|
||||
SZIRStatHelper szirStatHelper = new SZIRStatHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
var szirStatTipusok = Enum.GetValues(typeof(SzirStatTipusEnum)).OfType<SzirStatTipusEnum>().ToList();
|
||||
|
||||
foreach (SzirStatTipusEnum szirStatTipus in szirStatTipusok)
|
||||
{
|
||||
var data = new List<object>();
|
||||
string szirStatTipusNev = szirStatTipus.GetDisplayName(ClaimData.SelectedTanevID.Value);
|
||||
int szirStatTipusId = (int)szirStatTipus;
|
||||
if (szirStatTipus != SzirStatTipusEnum.osa1int)
|
||||
{
|
||||
Dictionary<int, string> szirStatFeladatellatasiHelyFileNevDictionary = szirStatHelper.GetKirSzirFeladatellatasiHelyList();
|
||||
foreach (var szirStatFeladatellatasiHelyId in szirStatFeladatellatasiHelyFileNevDictionary.Keys)
|
||||
{
|
||||
data.Add(new PanelBarChildDataModel
|
||||
{
|
||||
TipusId = szirStatTipusId,
|
||||
FeladatellatasiHelyId = szirStatFeladatellatasiHelyId,
|
||||
Description = szirStatFeladatellatasiHelyFileNevDictionary[szirStatFeladatellatasiHelyId]
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
data.Add(new PanelBarChildDataModel
|
||||
{
|
||||
TipusId = szirStatTipusId,
|
||||
FeladatellatasiHelyId = 0,
|
||||
Description = Core.Constants.General.Intezmeny
|
||||
});
|
||||
}
|
||||
panelBarChildModelList.Add(new PanelBarChildModel() { PartialViewName = "PanelBarDefaultView", PartialViewTitle = szirStatTipusNev, Data = data });
|
||||
}
|
||||
panelBarBaseModel.ChildModels = panelBarChildModelList;
|
||||
|
||||
return View("Index", panelBarBaseModel);
|
||||
}
|
||||
|
||||
public ActionResult LoadSZIRStatDokumentumPartial(SZIRStatDokumentumModel model)
|
||||
{
|
||||
SZIRStatCO co = new SZIRStatHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetSzirStatFileByTipusIdAndFeladatellatasiHelyId(model.SzirStatTipusId, model.FeladatellatasiHelyId);
|
||||
return PartialView("SZIRStat_Dokumentum_Partial", ConvertCoToModel(co));
|
||||
}
|
||||
|
||||
public ActionResult DeleteAndReLoadSZIRStatDokumentumPartial(SZIRStatDokumentumModel model)
|
||||
{
|
||||
SZIRStatCO co = new SZIRStatHelper(ConnectionTypeExtensions.GetSessionConnectionType(), fileServiceHelper).DeleteSzirStatFileAndGetSzirStatFileByTipusIdAndFeladatellatasiHelyId(model.SzirStatTipusId, model.FeladatellatasiHelyId);
|
||||
return PartialView("SZIRStat_Dokumentum_Partial", ConvertCoToModel(co));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult UploadFile([ModelBinder(typeof(AlapdokumentumFileUploadBinder))] IEnumerable<System.Web.HttpPostedFileBase> files, int SzirStatTipusId, int FeladatellatasiHelyId)
|
||||
{
|
||||
if (files != null && files.Any())
|
||||
{
|
||||
List<HttpPostedFileBase> uploadedFiles = files.ToList();
|
||||
var helper = new SZIRStatHelper(ConnectionTypeExtensions.GetSessionConnectionType(), fileServiceHelper);
|
||||
helper.Upload(uploadedFiles[0], ClaimData.IntezmenyGuid.Value, SzirStatTipusId, FeladatellatasiHelyId);
|
||||
}
|
||||
return Content("");
|
||||
}
|
||||
|
||||
public ActionResult DownloadFile(FormCollection form)
|
||||
{
|
||||
string dokumentumId = form["FileIdHiddenField"];
|
||||
|
||||
SZIRStatHelper helper = new SZIRStatHelper(ConnectionTypeExtensions.GetSessionConnectionType(), fileServiceHelper);
|
||||
|
||||
(string fajlnev, byte[] tartalom) = helper.GetFileData(int.Parse(dokumentumId));
|
||||
MemoryStream stream = new MemoryStream(tartalom);
|
||||
FileStreamResult result = File(stream, System.Web.MimeMapping.GetMimeMapping(fajlnev), fajlnev);
|
||||
return result;
|
||||
}
|
||||
|
||||
private SZIRStatDokumentumModel ConvertCoToModel(SZIRStatCO co)
|
||||
{
|
||||
return new SZIRStatDokumentumModel()
|
||||
{
|
||||
SzirStatTipusId = co.SzirStatTipusId,
|
||||
FeladatellatasiHelyId = co.FeladatellatasiHelyId,
|
||||
FeladatellatasiHelyNev = co.FeladatellatasiHelyNev,
|
||||
SzirStatFileId = co.SzirStatFileId,
|
||||
FileId = co.FileId,
|
||||
FileNev = co.FileNev,
|
||||
FeltoltesDatuma = co.FeltoltesDatuma,
|
||||
Statusz = co.Statusz
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue