init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
160
Kreta.DataAccessManual/DiakolimpiaDAL.cs
Normal file
160
Kreta.DataAccessManual/DiakolimpiaDAL.cs
Normal file
|
@ -0,0 +1,160 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using Kreta.DataAccess.Interfaces;
|
||||
using Kreta.DataAccessManual.Interfaces;
|
||||
using Kreta.DataAccessManual.ParameterClasses;
|
||||
using Kreta.DataAccessManual.Util;
|
||||
using Kreta.Enums;
|
||||
using Kreta.Framework.Util;
|
||||
using SDA.Kreta.Entities;
|
||||
|
||||
namespace Kreta.DataAccessManual
|
||||
{
|
||||
internal class DiakolimpiaDAL : DataAccessBase, IDiakolimpiaDAL
|
||||
{
|
||||
public DiakolimpiaDAL(DalHandler handler, GridParameters parameters)
|
||||
: base(handler, parameters)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DiakolimpiaDAL(DalHandler handler) : base(handler)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IDiakolimpia Get()
|
||||
{
|
||||
return Diakolimpia.GiveAnInstance();
|
||||
}
|
||||
|
||||
public IDiakolimpia Get(int id)
|
||||
{
|
||||
var entity = Diakolimpia.GiveAnInstance();
|
||||
entity.LoadByID(id);
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void FullUpdate(IDiakolimpia dto)
|
||||
{
|
||||
var entity = dto as Diakolimpia;
|
||||
entity.FullUpdate(true);
|
||||
DalHelper.Commit();
|
||||
}
|
||||
|
||||
public void Update(IDiakolimpia dto)
|
||||
{
|
||||
var entity = dto as Diakolimpia;
|
||||
entity.FullUpdate();
|
||||
DalHelper.Commit();
|
||||
}
|
||||
|
||||
public void Insert(IDiakolimpia dto)
|
||||
{
|
||||
var entity = dto as Diakolimpia;
|
||||
entity.Insert(true);
|
||||
|
||||
dto.ID = entity.ID;
|
||||
DalHelper.Commit();
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
var entity = Diakolimpia.GiveAnInstance();
|
||||
entity.LoadByID(id);
|
||||
|
||||
Delete(entity);
|
||||
}
|
||||
|
||||
public void Delete(IDiakolimpia dto)
|
||||
{
|
||||
var entity = dto as Diakolimpia;
|
||||
entity.Delete();
|
||||
|
||||
DalHelper.Commit();
|
||||
}
|
||||
|
||||
public DataSet GetDiakolimpiaGrid(DiakolimpiaSearchPCO searchPco, int tanevId)
|
||||
{
|
||||
List<CommandParameter> paramlist = new List<CommandParameter> {
|
||||
new CommandParameter(nameof(tanevId), tanevId)
|
||||
,new CommandParameter("OktNevKatTipus", (int)OktNevelesiKategoriaEnum.NevelesOktatas)
|
||||
};
|
||||
|
||||
StringBuilder commandText = new StringBuilder($@"
|
||||
SELECT
|
||||
felhasznalo.ID,
|
||||
felhasznalo.C_NYOMTATASINEV Nev,
|
||||
felhasznalo.C_SZULETESIDATUM SzuletesiDatum,
|
||||
felhasznalo.C_ANYJANEVE AnyjaNeve,
|
||||
Osztaly.C_NEV Osztalya,
|
||||
felhasznalo.C_OKTATASIAZONOSITO OktatasiAzonosito
|
||||
FROM
|
||||
T_FELHASZNALO_OSSZES felhasznalo
|
||||
JOIN T_TANULO_OSSZES tanulo on felhasznalo.ID = tanulo.ID
|
||||
INNER JOIN
|
||||
(SELECT
|
||||
ocs.C_NEV, T_TANULOCSOPORT_OSSZES.C_TANULOID, ocs.ID
|
||||
FROM
|
||||
T_TANULOCSOPORT_OSSZES
|
||||
JOIN
|
||||
T_OSZTALY_OSSZES ON T_TANULOCSOPORT_OSSZES.C_OSZTALYCSOPORTID = T_OSZTALY_OSSZES.ID
|
||||
JOIN
|
||||
T_OSZTALYCSOPORT_OSSZES ocs ON T_TANULOCSOPORT_OSSZES.C_OSZTALYCSOPORTID = ocs.ID AND ocs.C_FELADATKATEGORIAID = @OktNevKatTipus
|
||||
JOIN
|
||||
T_TANEV_OSSZES ON ocs.C_TANEVID = T_TANEV_OSSZES.ID
|
||||
WHERE
|
||||
ocs.TOROLT = 'F'
|
||||
AND T_TANEV_OSSZES.TOROLT = 'F'
|
||||
AND T_TANULOCSOPORT_OSSZES.TOROLT = 'F'
|
||||
AND T_TANULOCSOPORT_OSSZES.C_BELEPESDATUM < GETDATE()
|
||||
AND (T_TANULOCSOPORT_OSSZES.C_KILEPESDATUM IS NULL OR T_TANULOCSOPORT_OSSZES.C_KILEPESDATUM > GETDATE())
|
||||
) Osztaly ON Osztaly.C_TANULOID = felhasznalo.ID
|
||||
WHERE
|
||||
felhasznalo.TOROLT = 'F'
|
||||
AND tanulo.TOROLT = 'F'
|
||||
AND tanulo.C_ALTANEVID = @{nameof(tanevId)}
|
||||
");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchPco.SearchNev))
|
||||
{
|
||||
commandText.Append($" AND LOWER(felhasznalo.C_NYOMTATASINEV) LIKE '%' + @{nameof(searchPco.SearchNev)} + '%'");
|
||||
paramlist.Add(new CommandParameter(nameof(searchPco.SearchNev), searchPco.SearchNev.ToLowerInvariant()));
|
||||
}
|
||||
|
||||
if (searchPco.SearchSzuletesiDatumtol.HasValue)
|
||||
{
|
||||
commandText.Append($" AND felhasznalo.C_SZULETESIDATUM >= @{nameof(searchPco.SearchSzuletesiDatumtol)}");
|
||||
paramlist.Add(new CommandParameter(nameof(searchPco.SearchSzuletesiDatumtol), searchPco.SearchSzuletesiDatumtol));
|
||||
}
|
||||
|
||||
if (searchPco.SearchSzuletesiDatumig.HasValue)
|
||||
{
|
||||
commandText.Append($" AND felhasznalo.C_SZULETESIDATUM <= @{nameof(searchPco.SearchSzuletesiDatumig)}");
|
||||
paramlist.Add(new CommandParameter(nameof(searchPco.SearchSzuletesiDatumig), searchPco.SearchSzuletesiDatumig));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchPco.SearchAnyjaNeve))
|
||||
{
|
||||
commandText.Append($" AND LOWER(felhasznalo.C_ANYJANEVE) LIKE '%' + @{nameof(searchPco.SearchAnyjaNeve)} + '%'");
|
||||
paramlist.Add(new CommandParameter(nameof(searchPco.SearchAnyjaNeve), searchPco.SearchAnyjaNeve.ToLowerInvariant()));
|
||||
}
|
||||
|
||||
if (searchPco.SearchOsztalya.HasValue)
|
||||
{
|
||||
commandText.Append($" AND Osztaly.ID = @{nameof(searchPco.SearchOsztalya)}");
|
||||
paramlist.Add(new CommandParameter(nameof(searchPco.SearchOsztalya), searchPco.SearchOsztalya));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchPco.SearchOktatasiAzonosito))
|
||||
{
|
||||
commandText.Append($" AND LOWER(felhasznalo.C_OKTATASIAZONOSITO) LIKE '%' + @{nameof(searchPco.SearchOktatasiAzonosito)} + '%'");
|
||||
paramlist.Add(new CommandParameter(nameof(searchPco.SearchOktatasiAzonosito), searchPco.SearchOktatasiAzonosito.ToLowerInvariant()));
|
||||
}
|
||||
|
||||
DataSet ds = GetData(commandText.ToString(), paramlist);
|
||||
return ds;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue