56 lines
2.1 KiB
C#
56 lines
2.1 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Kreta.BusinessLogic.Helpers;
|
|
using Kreta.Core.ConnectionType;
|
|
using Kreta.Core.Enum;
|
|
using Kreta.Core.Exceptions;
|
|
using Kreta.Core.Logic;
|
|
using Kreta.Enums;
|
|
using Kreta.Naplo.Dao.V3.Ora;
|
|
using Kreta.Naplo.Domain.V3.Common;
|
|
using Kreta.Naplo.Domain.V3.Ora;
|
|
|
|
namespace Kreta.Naplo.BusinessLogic.V3.Ora
|
|
{
|
|
public class OraSubqueries
|
|
{
|
|
public static List<OraFeljegyzesResponse> GetOraFeljegyzesek(DefaultConnectionParameters dcp, OraFeljegyzesRequest request)
|
|
{
|
|
var result = new List<OraFeljegyzesResponse>();
|
|
|
|
var tanoraHelper = new TanoraHelper(new MobileConnectionType(dcp.FelhasznaloId, dcp.IntezmenyId, dcp.IntezmenyAzonosito, dcp.TanevId));
|
|
if (!tanoraHelper.IsValidTanoraId(request.TanoraId))
|
|
{
|
|
throw new BlException(BlExceptionType.ElvartErtekNemTalalhato);
|
|
}
|
|
var tanulokFeljegyzesek = tanoraHelper.GetTanuloFeljegyzesek(request.TanoraId).ToDaoList<FeljegyzesResponseDao>().GroupBy(f => f.TanuloId);
|
|
|
|
foreach (var tanuloFeljegyzesek in tanulokFeljegyzesek)
|
|
{
|
|
result.Add(new OraFeljegyzesResponse
|
|
{
|
|
TanuloId = tanuloFeljegyzesek.Key,
|
|
FeljegyzesLista = tanuloFeljegyzesek.Select(f => new FeljegyzesResponse
|
|
{
|
|
Id = f.Id,
|
|
Tipus = f.Tipus
|
|
}).ToList()
|
|
});
|
|
}
|
|
return result;
|
|
}
|
|
|
|
internal static HashSet<TanuloJelenletResponse> GetTanuloJelenlet(DefaultConnectionParameters dcp, TanuloJelenletRequest request)
|
|
{
|
|
return dcp.DalHandler.MulasztasDal()
|
|
.GetTanuloJelenletDataSet(dcp.TanevId, request.TanoraId)
|
|
.ToDaoList<MulasztasResponseDao>()
|
|
.Select(m => new TanuloJelenletResponse
|
|
{
|
|
TanuloId = m.TanuloId,
|
|
MulasztasTipus = m.Tipus ?? (int)MulasztasTipusEnum.jelenlet,
|
|
Keses = m.Keses
|
|
}).ToHashSet();
|
|
}
|
|
}
|
|
}
|