init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
98
Kreta.BusinessLogic/Helpers/EszkozIgenylesHelper.cs
Normal file
98
Kreta.BusinessLogic/Helpers/EszkozIgenylesHelper.cs
Normal file
|
@ -0,0 +1,98 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Kreta.BusinessLogic.Classes;
|
||||
using Kreta.Client.CoreApi;
|
||||
using Kreta.Client.CoreApi.Response;
|
||||
using Kreta.Core;
|
||||
using Kreta.Core.ConnectionType;
|
||||
using Kreta.Core.Validation.Exceptions;
|
||||
using Kreta.Core.Validation.Exceptions.Enum;
|
||||
using Kreta.DataAccessManual;
|
||||
using Kreta.DataAccessManual.Util;
|
||||
using Kreta.Enums.ManualEnums;
|
||||
|
||||
namespace Kreta.BusinessLogic.Helpers
|
||||
{
|
||||
public class EszkozIgenylesHelper : LogicBase
|
||||
{
|
||||
public EszkozIgenylesHelper(IConnectionType connectionType) : base(connectionType)
|
||||
{
|
||||
}
|
||||
|
||||
public int EszkozIgenylesInsert(ICoreApiClient coreApiClient, EszkozIgenylesCreateDto dto, string intezmenyGuid, int tanevSorszam)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = coreApiClient.EszkozIgenylesInsert(dto, intezmenyGuid, tanevSorszam);
|
||||
return response.NewId;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ValidationException(ValidationErrorType.Undefined, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void EszkozIgenylesUpdate(ICoreApiClient coreApiClient, EszkozIgenylesUpdateDto dto, string intezmenyGuid, int tanevSorszam)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = coreApiClient.EszkozIgenylesUpdate(dto, intezmenyGuid, tanevSorszam);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ValidationException(ValidationErrorType.Undefined, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public List<EszkozIgenylesDto> EszkozIgenylesGet(ICoreApiClient coreApiClient, string intezmenyGuid, int tanevSorszam, int? alkalmazottId, int? gondviseloId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = coreApiClient.EszkozIgenylesGet(intezmenyGuid, tanevSorszam);
|
||||
|
||||
if (alkalmazottId.HasValue)
|
||||
{
|
||||
result = result.Where(x => x.AlkalmazottId == alkalmazottId.Value).ToList();
|
||||
}
|
||||
|
||||
if (gondviseloId.HasValue)
|
||||
{
|
||||
result = result.Where(x => x.GondviseloId == gondviseloId.Value).ToList();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ValidationException(ValidationErrorType.Undefined, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEszkozKiosztva(int tanuloId)
|
||||
{
|
||||
return Dal.CustomConnection.Run(ConnectionType, h =>
|
||||
{
|
||||
var eszkozIgenyles = h.EszkozigenylesDal();
|
||||
var dataSet = eszkozIgenyles.IsEszkozKiosztva(IntezmenyId, TanevId, tanuloId);
|
||||
|
||||
if (dataSet.Tables[0].Rows.Count < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return SDAConvert.ToBooleanFromTF(dataSet.Tables[0].Rows[0]["C_ISESZKOZKIOSZTVA"]);
|
||||
});
|
||||
}
|
||||
|
||||
public string EszkozUgyintezesUrl()
|
||||
{
|
||||
return Dal.CustomConnection.Run(ConnectionType, (h) =>
|
||||
{
|
||||
var intezmenyConfigHelper = new IntezmenyConfigHelper(new DalHandlerConnectionType(ConnectionType, h));
|
||||
var eszkozUgyintezesUrl = intezmenyConfigHelper.GetIntezmenyConfig<string>(IntezmenyConfigModulEnum.EszkozUgyintezes, IntezmenyConfigTipusEnum.Url);
|
||||
|
||||
return eszkozUgyintezesUrl;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue