init
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Kreta.Core.ConnectionType;
|
||||
using Kreta.Core.Logic;
|
||||
using Kreta.DataAccessManual;
|
||||
using Kreta.Ellenorzo.BL.VN.Logic;
|
||||
using Kreta.Ellenorzo.Dao.VN.Tantargy;
|
||||
using Kreta.Ellenorzo.Domain.VN.Common;
|
||||
using Kreta.Ellenorzo.Domain.VN.Tantargy;
|
||||
using Kreta.Ellenorzo.Enums.VN;
|
||||
|
||||
namespace Kreta.Ellenorzo.BL.VN.Tantargy
|
||||
{
|
||||
internal static class TantargySubqueries
|
||||
{
|
||||
internal static HashSet<TantargyResponse> ListTanuloAktualisanTanultTantargy(DefaultConnectionParameters dcp, TanuloAktualisanTanultTantargyListRequest request, bool removeOsztalyfonokiTantargyKategoriaHaNincsErtekeles = true)
|
||||
{
|
||||
var response = new HashSet<TantargyResponse>(new TantargyResponse());
|
||||
|
||||
var tantargyIdsWithoutMagatartasSzorgalom = request.TantargyUids?
|
||||
.Where(t => !t.Equals(TantargyLogic.MagatartasTantargy.Uid) && !t.Equals(TantargyLogic.SzorgalomTantargy.Uid))
|
||||
.Select(t => t.Id).ToList();
|
||||
|
||||
if ((tantargyIdsWithoutMagatartasSzorgalom == null || !tantargyIdsWithoutMagatartasSzorgalom.Any()) && request.TantargyUids != null && request.TantargyUids.Any())
|
||||
{
|
||||
if (request.TantargyUids.Contains(TantargyLogic.MagatartasTantargy.Uid))
|
||||
{
|
||||
_ = response.Add(TantargyLogic.MagatartasTantargy);
|
||||
}
|
||||
|
||||
if (request.TantargyUids.Contains(TantargyLogic.SzorgalomTantargy.Uid))
|
||||
{
|
||||
_ = response.Add(TantargyLogic.SzorgalomTantargy);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
var tanultTantargyak = Dal.CustomConnection.Run(new MobileConnectionType(dcp.FelhasznaloId, dcp.IntezmenyId, dcp.IntezmenyAzonosito, dcp.TanevId),
|
||||
h => h.Tantargy().GetTanuloAktualisanTanultTantargyai(dcp.TanuloId,
|
||||
nameof(MagatartasSzorgalomTantargy.Magatartas),
|
||||
nameof(MagatartasSzorgalomTantargy.Szorgalom),
|
||||
tantargyIdsWithoutMagatartasSzorgalom,
|
||||
request.OktatasiNevelesiFeladatId)).ToDaoList<TanultTantargyDao>();
|
||||
|
||||
if (removeOsztalyfonokiTantargyKategoriaHaNincsErtekeles)
|
||||
{
|
||||
TantargyLogic.RemoveOsztalyfonokiKategoriasTantargyak(tanultTantargyak);
|
||||
}
|
||||
|
||||
foreach (var tantargy in tanultTantargyak)
|
||||
{
|
||||
bool hasMagatartasOrSzorgalom = false;
|
||||
if (tantargy.TantargyUid.Contains(nameof(MagatartasSzorgalomTantargy.Magatartas)))
|
||||
{
|
||||
hasMagatartasOrSzorgalom = true;
|
||||
_ = response.Add(TantargyLogic.MagatartasTantargy);
|
||||
}
|
||||
|
||||
if (tantargy.TantargyUid.Contains(nameof(MagatartasSzorgalomTantargy.Szorgalom)))
|
||||
{
|
||||
hasMagatartasOrSzorgalom = true;
|
||||
_ = response.Add(TantargyLogic.SzorgalomTantargy);
|
||||
}
|
||||
|
||||
if (!hasMagatartasOrSzorgalom)
|
||||
{
|
||||
_ = response.Add(new TantargyResponse(Convert.ToInt32(tantargy.TantargyUid), tantargy.Nev, tantargy.TargykategoriaId, tantargy.TargyKategoriaNev, tantargy.Fotargy.Value, tantargy.FotargyId, tantargy.FotargyNev, tantargy.SorSzam)
|
||||
{
|
||||
FotargyKategoriaId = tantargy.FotargyKategoriaId,
|
||||
TantargyInTtf = tantargy.TtfBol
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
TantargyLogic.OrderTantargyList(response, dcp.TanevId);
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user