init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,140 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Mime;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
using Kreta.BusinessLogic.HelperClasses;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Helpers.Nyomtatvanyok.Iktatas;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Core;
|
||||
using Kreta.Core.Iktato.Poszeidon.Factory.Interface;
|
||||
using Kreta.Enums.ManualEnums;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.Nyomtatvanyok.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.Nyomtatvanyok.Controllers
|
||||
{
|
||||
[MvcRoleClaimsAuthorize(true)]
|
||||
[MvcRolePackageDenyAuthorize(TanevEnum.AktEsLezartTanev, KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue)]
|
||||
[MvcRolePackageAuthorize(TanevEnum.AktEsLezartTanev, KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class IktatottDokumentumokController : BaseNyomtatvanyokController
|
||||
{
|
||||
private IIktatoRepositoryFactory IktatoRepositoryFactory { get; }
|
||||
private IktatoServiceConfiguration IktatoServiceConfiguration { get; }
|
||||
|
||||
public IktatottDokumentumokController(IIktatoRepositoryFactory iktatoRepositoryFactory, IktatoServiceConfiguration iktatoServiceConfiguration)
|
||||
{
|
||||
IktatoRepositoryFactory = iktatoRepositoryFactory;
|
||||
IktatoServiceConfiguration = iktatoServiceConfiguration;
|
||||
}
|
||||
|
||||
public ActionResult Index()
|
||||
{
|
||||
var model = new IktatottDokumentumokSearchModel();
|
||||
return View("Index", model);
|
||||
}
|
||||
|
||||
public ActionResult IktatottDokumentumokDetail(int id)
|
||||
{
|
||||
return PartialView(id);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult DokumentumLetoltese(int iktatottDokumentumId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var phelper = new PoszeidonHelper(ConnectionTypeExtensions.GetSessionConnectionType(), IktatoRepositoryFactory, IktatoServiceConfiguration);
|
||||
|
||||
var (fajlnev, tartalom) = phelper.Lekeres(iktatottDokumentumId.ToString());
|
||||
|
||||
return new FileContentResult(tartalom, MediaTypeNames.Application.Octet)
|
||||
{
|
||||
FileDownloadName = HttpUtility.UrlEncode(fajlnev, Encoding.UTF8),
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.NotFound, ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult DokumentumTobbesLetoltese(List<TobbesLetoltesModel> letoltendoDokumentumok)
|
||||
{
|
||||
var hasEntry = false;
|
||||
var errors = new List<string>();
|
||||
var OutPut = new MemoryStream();
|
||||
var ZipOutPut = new ZipOutputStream(OutPut);
|
||||
foreach (var letoltendoDokumentum in letoltendoDokumentumok)
|
||||
{
|
||||
try
|
||||
{
|
||||
var phelper = new PoszeidonHelper(ConnectionTypeExtensions.GetSessionConnectionType(), IktatoRepositoryFactory, IktatoServiceConfiguration);
|
||||
|
||||
var (fajlnev, tartalom) = phelper.Lekeres(letoltendoDokumentum.IktatottDokumentumId.ToString());
|
||||
if (tartalom.Length == 0)
|
||||
{
|
||||
throw new ApplicationException(NyomtatvanyokResource.UresDokumentum);
|
||||
}
|
||||
using (var ms = new MemoryStream(tartalom))
|
||||
{
|
||||
hasEntry = true;
|
||||
AddZipEntry(ZipOutPut, ms, fajlnev);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errors.Add(string.Format(NyomtatvanyokResource.TobbesLetoltesHibasDokumentumFormatum, letoltendoDokumentum.FajlNev, ex.Message));
|
||||
}
|
||||
}
|
||||
ZipOutPut.Finish();
|
||||
OutPut.Position = 0;
|
||||
var errorMessages = errors.Count > 0 ? string.Format(NyomtatvanyokResource.TobbesLetoltesHibasDokumentumListaFormatum, string.Join(Environment.NewLine, errors)) : "";
|
||||
if (hasEntry)
|
||||
{
|
||||
var zipnevmodel = new NyomtatvanyNevGeneralasModel() { TanevID = ClaimData.SelectedTanevID.Value };
|
||||
var nyomtatvanyNeve = NyomtatvanyokResource.TobbesLetotesNyomtatvanyNeve;
|
||||
var fileNev = $"{CommonExtensions.NevGeneralas(nyomtatvanyNeve, zipnevmodel)}.{Constants.ImportExport.FileFormatZip}";
|
||||
|
||||
return new FileContentResult(OutPut.ToArray(), MediaTypeNames.Application.Octet)
|
||||
{
|
||||
FileDownloadName = HttpUtility.UrlEncode(fileNev, Encoding.UTF8),
|
||||
};
|
||||
}
|
||||
|
||||
throw new StatusError(HttpStatusCode.NotFound, errorMessages);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult OpenKulcsszoInfoPopUp(int iktatottDokumentumId)
|
||||
{
|
||||
var helper = new KulcsszoHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
var infoModel = helper.GetKulcsszoTipusErtekParos(iktatottDokumentumId);
|
||||
|
||||
var model = new Web.Models.EditorTemplates.PopUpModel(infoModel, "Info_PopUp");
|
||||
|
||||
model.AddCancelBtn(model, "DokumentumokHelper.kulcsszoInfoCancel");
|
||||
|
||||
return PartialView(Constants.General.PopupView, model);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult IktatasUjrainditasa(int iktatottDokumentumId)
|
||||
{
|
||||
var helper = new PoszeidonHelper(ConnectionTypeExtensions.GetSessionConnectionType(), IktatoRepositoryFactory, IktatoServiceConfiguration);
|
||||
|
||||
helper.RestartIktatasJob(iktatottDokumentumId);
|
||||
|
||||
return new EmptyResult();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue