100 lines
3.6 KiB
C#
100 lines
3.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using Kreta.Core;
|
|
using Kreta.DataAccess.Interfaces;
|
|
using Kreta.DataAccessManual.Interfaces;
|
|
using Kreta.DataAccessManual.Util;
|
|
using Kreta.Framework;
|
|
using Kreta.Framework.Util;
|
|
using SDA.DataProvider;
|
|
using SDA.Kreta.Entities;
|
|
|
|
namespace Kreta.DataAccessManual
|
|
{
|
|
internal class KirSzirFeladatellatasiHelyDAL : DataAccessBase, IKirSzirFeladatellatasiHelyDAL
|
|
{
|
|
public KirSzirFeladatellatasiHelyDAL(DalHandler handler) : base(handler)
|
|
{
|
|
}
|
|
|
|
public KirSzirFeladatellatasiHelyDAL(DalHandler handler, GridParameters parameters) : base(handler, parameters)
|
|
{
|
|
}
|
|
public IKirSzirFeladatellatasiHely Get()
|
|
{
|
|
return KirSzirFeladatellatasiHely.GiveAnInstance();
|
|
}
|
|
|
|
public IKirSzirFeladatellatasiHely Get(int id)
|
|
{
|
|
var entity = KirSzirFeladatellatasiHely.GiveAnInstance();
|
|
entity.LoadByID(id);
|
|
return entity;
|
|
}
|
|
|
|
public int? GetByFeladatellatasiHelyId(int intezmenyId, int tanevId, int feladatellatasiHelyId, DateTime datum)
|
|
{
|
|
using (var command = new SDACommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
|
|
command.Parameters.Add(nameof(intezmenyId), intezmenyId);
|
|
command.Parameters.Add(nameof(tanevId), tanevId);
|
|
command.Parameters.Add(nameof(feladatellatasiHelyId), feladatellatasiHelyId);
|
|
command.Parameters.Add(nameof(datum), datum);
|
|
command.CommandText = $@"
|
|
SELECT
|
|
ID
|
|
FROM
|
|
T_KIRSZIRFELADATELLATASIHELY_OSSZES
|
|
WHERE
|
|
TOROLT = 'F'
|
|
AND C_FELADATELLATASIHELYID = @{nameof(feladatellatasiHelyId)}
|
|
AND C_DATUM = @{nameof(datum)}
|
|
AND C_INTEZMENYID = @{nameof(intezmenyId)}
|
|
AND C_TANEVID = @{nameof(tanevId)}";
|
|
|
|
var id = command.ExecuteScalar();
|
|
|
|
if (int.TryParse(id?.ToString(), out int result))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public DataSet GetKirSzirFeladatellatasiHelyList(int tanevId, DateTime datum, int? feladatKategoriaId = null)
|
|
{
|
|
string commandText = @"
|
|
SELECT
|
|
fh.ID as ID
|
|
,fh.C_FELADATELLATASIHELYID AS FeladatellatasiHelyId
|
|
,C_OKTATASINEVELESIFELADATNEV AS Nev
|
|
,C_MUKODESIHELYNEV AS MukodesiHelyNev
|
|
,C_MUKODESIHELYNEV + ' - ' + C_OKTATASINEVELESIFELADATNEV AS TeljesNev
|
|
FROM T_KIRSZIRFELADATELLATASIHELY_OSSZES fh
|
|
WHERE fh.C_TANEVID = :pTanevId
|
|
AND fh.C_DATUM = :pDatum" +
|
|
(feladatKategoriaId.IsEntityId() ? "AND fh.C_FELADATKATEGORIAID = :pfeladatKategoriaId" : "") + @"
|
|
AND fh.TOROLT = 'F'
|
|
ORDER BY fh.C_FELADATELLATASIHELYID
|
|
";
|
|
|
|
var commandParameterList = new List<CommandParameter>
|
|
{
|
|
new CommandParameter("pTanevId", tanevId),
|
|
new CommandParameter("pDatum", datum)
|
|
};
|
|
if (feladatKategoriaId.IsEntityId())
|
|
{
|
|
commandParameterList.Add(new CommandParameter("pfeladatKategoriaId", feladatKategoriaId));
|
|
}
|
|
DataSet dataSet = GetData(commandText, commandParameterList);
|
|
return dataSet;
|
|
}
|
|
}
|
|
}
|