init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,136 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Results;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kreta.BusinessLogic.Classes.ComboBox;
|
||||
using Kreta.BusinessLogic.HelperClasses.ImportCo;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Logic;
|
||||
using Kreta.BusinessLogic.Security;
|
||||
using Kreta.Core.Exceptions;
|
||||
using Kreta.Enums.ManualEnums;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.Felhasznalok.Models;
|
||||
using Kreta.Web.Helpers;
|
||||
using Kreta.Web.Helpers.Error;
|
||||
using Kreta.Web.Helpers.Grid;
|
||||
using Kreta.Web.Security;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kreta.Web.Areas.Felhasznalok.ApiControllers
|
||||
{
|
||||
[ApiRoleClaimsAuthorize(true)]
|
||||
[ApiRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue, KretaClaimPackages.Osztalyfonok.ClaimValue, KretaClaimPackages.CsoportVezeto.ClaimValue)]
|
||||
public class FelhasznalokApiController : ApiController
|
||||
{
|
||||
public DataSourceResult GetFelhasznalokGrid(string data, DataSourceRequest request)
|
||||
{
|
||||
var model = JsonConvert.DeserializeObject<FelhasznalokSearchModel>(data);
|
||||
|
||||
var co = FelhasznalokSearchModel.ConvertModelToCo(model);
|
||||
|
||||
var gridParameter = Converter.GridParameter(request);
|
||||
|
||||
var helper = new FelhasznaloHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
var icHelper = new IntezmenyConfigHelper(ConnectionTypeExtensions.GetSystemConnectionType());
|
||||
|
||||
var hrModulEnabled = icHelper.GetIntezmenyConfig<bool>(IntezmenyConfigModulEnum.HRModul, IntezmenyConfigTipusEnum.IsEnabled);
|
||||
|
||||
var coList = helper.GetFelhasznaloList(co, hrModulEnabled);
|
||||
|
||||
var modelList = new List<FelhasznalokGridModel>();
|
||||
foreach (var item in coList)
|
||||
{
|
||||
var gridModel = new FelhasznalokGridModel(item);
|
||||
modelList.Add(gridModel);
|
||||
}
|
||||
|
||||
return modelList.ToDataSourceResult(gridParameter);
|
||||
}
|
||||
|
||||
public JsonResult<List<ComboBoxListItem>> GetFelhasznaloTipusList([DataSourceRequest] DataSourceRequest request)
|
||||
{
|
||||
var listItems = new List<ComboBoxListItem>
|
||||
{
|
||||
new ComboBoxListItem {Text = FelhasznalokResource.Alkalmazott , Value = ((int) FelhasznaloTipusEnum.Alkalmazott).ToString()},
|
||||
new ComboBoxListItem {Text = FelhasznalokResource.Gondviselo, Value = ((int) FelhasznaloTipusEnum.Gondviselo).ToString()},
|
||||
new ComboBoxListItem {Text = FelhasznalokResource.Tanulo, Value = ((int) FelhasznaloTipusEnum.Tanulo).ToString()}
|
||||
};
|
||||
return Json(listItems);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ApiRolePackageDenyAuthorize(KretaClaimPackages.IsSzirIntezmeny.ClaimValue)]
|
||||
public HttpResponseMessage DeleteSelectedFelhasznaloBelepes(List<FelhasznalokBelepesTorlesModel> model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var helper = new FelhasznaloHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
foreach (var item in model)
|
||||
{
|
||||
helper.DeleteFelhasznaloBelepes(item.Id, item.IsGondviselo);
|
||||
}
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public HttpResponseMessage GetExportGondviselokBelepesiAdatokNelkul(string data, DataSourceRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
var model = JsonConvert.DeserializeObject<FelhasznalokSearchModel>(data);
|
||||
|
||||
var gridParameter = Converter.GridParameter(request);
|
||||
|
||||
var helper = new FelhasznaloHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
var coList = helper.GetGondviseloBelepesItemCoList(FelhasznalokSearchModel.ConvertModelToCo(model));
|
||||
|
||||
var simpleExportColumnCos = SimpleExportLogic.GetSimpleExportColumnCos<FelhasznaloBelepesImportItemCo>(FelhasznaloBelepesImportItemCo.GondviseloNemImportalhatoSorokExportAttributeId, helper.GetGondviseloBelepesiAdatokNelkulDropDownColumnSourceDictionary());
|
||||
|
||||
var memoryStream = SimpleExportLogic.GetExport(ImportExportFelhasznaloBelepesResource.GondviseloFelhasznaloBelepesiAdatok, simpleExportColumnCos, coList, ClaimData.SelectedTanevID.Value);
|
||||
|
||||
return HttpResponseExtensions.GetFileHttpResponse(memoryStream.ToArray(), FelhasznalokResource.GonviselokBelepesiAdatokNelkulExportFileName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.HibaTortentAFajlExportalasaKozben) { UnHandledException = ex };
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage BovitettJogosultsagGeneralas(List<int> gondviseloIdList)
|
||||
{
|
||||
try
|
||||
{
|
||||
var hozzaferesGeneralasaHelper = new HozzaferesGeneralasaHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
||||
|
||||
var belepesList = hozzaferesGeneralasaHelper.SetGondviseloToBovitett(gondviseloIdList, false);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(belepesList.EmailErrors))
|
||||
{
|
||||
throw new BlException(belepesList.EmailErrors);
|
||||
}
|
||||
|
||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||
}
|
||||
catch (BlException ex)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new StatusError(HttpStatusCode.BadRequest, ErrorResource.NemSikerultAMuvelet) { UnHandledException = ex };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue