This commit is contained in:
skidoodle 2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

View file

@ -0,0 +1,85 @@
using System.Collections.Generic;
using System.Data;
using Kreta.BusinessLogic.HelperClasses;
using Kreta.Core.ConnectionType;
using Kreta.DataAccessManual;
using Kreta.DataAccessManual.Interfaces;
using Kreta.DataAccessManual.ParameterClasses;
namespace Kreta.BusinessLogic.Helpers
{
public class FelmentesHelper : LogicBase
{
public FelmentesHelper(IConnectionType connectionType) : base(connectionType) { }
public List<FelmentesGridItemCo> GetFelmentesGrid(FelmentesSearchCo co)
{
FelmentesSearchPco pco = ConvertToPco(co);
var ds = Dal.CustomConnection.Run(ConnectionType, h =>
{
IFelmentesDal dal = h.FelmentesDal(GridParameters);
return dal.GetFelmentesGrid(pco, IntezmenyId, TanevId);
});
var result = new List<FelmentesGridItemCo>();
if (ds != null && ds.Tables.Count > 0)
{
foreach (DataRow dataRow in ds.Tables[0].Rows)
{
var item = new FelmentesGridItemCo(dataRow);
result.Add(item);
}
}
return result;
}
public FelmentesGridItemCo GetFelmentesById(int felmentesId)
{
FelmentesSearchPco pco = new FelmentesSearchPco { ID = felmentesId };
var ds = Dal.CustomConnection.Run(ConnectionType, h =>
{
IFelmentesDal dal = h.FelmentesDal(GridParameters);
return dal.GetFelmentesGrid(pco, IntezmenyId, TanevId);
});
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
return new FelmentesGridItemCo(ds.Tables[0].Rows[0]);
}
else
{
return new FelmentesGridItemCo();
}
}
private FelmentesSearchPco ConvertToPco(FelmentesSearchCo co)
{
FelmentesSearchPco pco = new FelmentesSearchPco()
{
ID = co.ID,
TanuloNeve = co.TanuloNeve,
TanuloOsztalyId = co.TanuloOsztalyId,
TantargyId = co.TantargyId,
KezdeteDateFrom = co.KezdeteDateFrom,
KezdeteDateTo = co.KezdeteDateTo,
VegeDateFrom = co.VegeDateFrom,
VegeDateTo = co.VegeDateTo,
IsTanoraLatogatasaAloli = co.IsTanoraLatogatasaAloli,
IsErtekelesAloli = co.IsErtekelesAloli,
IsSzovegesenErtekelheto = co.IsSzovegesenErtekelheto,
FelmentesOka = co.FelmentesOka,
RogzitesDateFrom = co.RogzitesDateFrom,
RogzitesDateTo = co.RogzitesDateTo,
RogzitoNeve = co.RogzitoNeve,
ModositasDateFrom = co.ModositasDateFrom,
ModositasDateTo = co.ModositasDateTo,
ModositoNeve = co.ModositoNeve,
Torolt = co.Torolt
};
return pco;
}
}
}