65 lines
2.3 KiB
C#
65 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using Kreta.Core.ConnectionType;
|
|
using Kreta.DataAccessManual;
|
|
using Kreta.DataAccessManual.Util;
|
|
|
|
namespace Kreta.BusinessLogic.Helpers
|
|
{
|
|
public class NaptariHetHelper : LogicBase
|
|
{
|
|
public NaptariHetHelper(IConnectionType connectionType) : base(connectionType) { }
|
|
|
|
public DataSet GetNaptariHetList()
|
|
=> Dal.CustomConnection.Run(ConnectionType, h =>
|
|
{
|
|
return h.NaptariHet(GridParameters).GetNaptariHetList(TanevId);
|
|
});
|
|
|
|
public DataSet GetHetirendHelyettesitesList(Dictionary<int, int?> modifiedHetirendList)
|
|
=> Dal.CustomConnection.Run(ConnectionType, h =>
|
|
{
|
|
return h.NaptariHet(GridParameters).GetHetirendHelyettesitesList(TanevId, modifiedHetirendList);
|
|
});
|
|
|
|
public void SetHetirend(Dictionary<int, int?> modifiedHetirendList)
|
|
{
|
|
Dal.CustomConnection.Run(ConnectionType, h =>
|
|
{
|
|
var dal = h.NaptariHet();
|
|
dal.DeleteHelyettesites(TanevId, modifiedHetirendList);
|
|
|
|
var szunetIds = modifiedHetirendList.Where(x => !x.Value.HasValue).Select(x => x.Key).ToList();
|
|
dal.DeleteHetesek(TanevId, szunetIds, FelhasznaloId);
|
|
|
|
dal.SetHetirend(modifiedHetirendList, IntezmenyId, TanevId);
|
|
|
|
var helper = new AdatszotarHelper(new DalHandlerConnectionType(ConnectionType, h));
|
|
|
|
helper.GenerateNaptariNapok();
|
|
});
|
|
}
|
|
|
|
public List<int> GetSortedHetirendIdList()
|
|
{
|
|
return Dal.CustomConnection.Run(ConnectionType, h =>
|
|
{
|
|
return h.NaptariHet().GetSortedHetirendIdList(TanevId);
|
|
});
|
|
}
|
|
|
|
public int GetNaptariHetSorszamByDate(DateTime datum)
|
|
=> Dal.CustomConnection.Run(ConnectionType, h =>
|
|
{
|
|
return h.NaptariHet(GridParameters).GetNaptariHetSorszamByDate(datum, TanevId);
|
|
});
|
|
|
|
public int? GetNaptariHetHetirendByDate(DateTime datum)
|
|
=> Dal.CustomConnection.Run(ConnectionType, h =>
|
|
{
|
|
return h.NaptariHet(GridParameters).GetNaptariHetHetirendByDate(datum, TanevId);
|
|
});
|
|
}
|
|
}
|