init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,109 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Kreta.BusinessLogic.Exceptions;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Enums.ManualEnums;
|
||||
using Kreta.Framework.Util;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.ApiControllers;
|
||||
using Kreta.Web.Areas.Adatszolgaltatasok.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Security;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kreta.Web.Areas.Adatszolgaltatasok.Controllers
|
||||
{
|
||||
//Note: kikapcsolva, mert jelenleg nincs használatban
|
||||
|
||||
[MvcRoleClaimsAuthorize(true)]
|
||||
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue)]
|
||||
//[MvcRolePackageAuthorize(KretaClaimPackages.Fenntarto.ClaimValue, KretaClaimPackages.Adminisztrator.ClaimValue)]
|
||||
public class EnaploAdatszolgaltatasController : Controller
|
||||
{
|
||||
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue)]
|
||||
public ActionResult Index()
|
||||
{
|
||||
EnaploAdatszolgaltatasApiController api = new EnaploAdatszolgaltatasApiController();
|
||||
EnaploAdatszolgaltatasModel model = api.GetEnaploAdatszolgaltatas();
|
||||
model.IgenNemList = GetIgenNemList();
|
||||
|
||||
return View("Index", model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Uploads the agreement.
|
||||
/// </summary>
|
||||
/// <param name="szerzodesFile">The szerzodes file.</param>
|
||||
/// <param name="model">The model.</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ActionResult UploadSzerzodes(HttpPostedFileBase szerzodesFile, EnaploAdatszolgaltatasModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var input_file = szerzodesFile.InputStream;
|
||||
MemoryStream memoryStream = new MemoryStream();
|
||||
|
||||
var fileName = szerzodesFile.FileName;
|
||||
|
||||
byte[] buffer = new byte[16 * 1024];
|
||||
int read;
|
||||
while ((read = input_file.Read(buffer, 0, buffer.Length)) > 0)
|
||||
{
|
||||
memoryStream.Write(buffer, 0, read);
|
||||
}
|
||||
|
||||
var helper = new AdatszolgaltatasokHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
|
||||
|
||||
helper.SaveorUpdateSzerzodesForEnaploAdatszolgaltatas(memoryStream, fileName, model.ID);
|
||||
}
|
||||
catch (InvalidDataException ex)
|
||||
{
|
||||
return Content(ex.Message);
|
||||
}
|
||||
catch (KretaInvalidFileFormatException e)
|
||||
{
|
||||
return Content(e.Message);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return Content(JsonConvert.SerializeObject(e));
|
||||
}
|
||||
|
||||
return Content(string.Empty);
|
||||
}
|
||||
|
||||
[MvcValidateAjaxAntiForgeryToken]
|
||||
[HttpPost]
|
||||
public ActionResult RemoveSzerzodes(HttpPostedFileBase szerzodesFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Fájl törlés hack
|
||||
}
|
||||
catch (InvalidDataException ex)
|
||||
{
|
||||
return Content(ex.Message);
|
||||
}
|
||||
catch (KretaInvalidFileFormatException e)
|
||||
{
|
||||
return Content(e.Message);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return Content(JsonConvert.SerializeObject(e));
|
||||
}
|
||||
|
||||
return Content(string.Empty);
|
||||
}
|
||||
|
||||
public List<SelectListItem> GetIgenNemList()
|
||||
{
|
||||
IDictionary<string, string> dictionary = FrameworkEnumExtensions.EnumToListManual<IgenNemEnum>();
|
||||
return dictionary.ToSelectListItemList();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue