137 lines
6.1 KiB
C#
137 lines
6.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using Kreta.Core;
|
|
using Kreta.DataAccessManual.Util;
|
|
using Kreta.Enums;
|
|
|
|
namespace Kreta.DataAccessManual.ParameterClasses
|
|
{
|
|
public class CsoportSearchPco
|
|
{
|
|
public string SzervezetNeve { get; set; }
|
|
public string SzervezetAdoszama { get; set; }
|
|
public DateTime SearchDate { get; set; }
|
|
public string CsoportNev { get; set; }
|
|
public int? EvfolyamId { get; set; }
|
|
public int? CsoportvezetoId { get; set; }
|
|
public int? TeremId { get; set; }
|
|
public int? VegzosSearch { get; set; }
|
|
public int? CsoportTipusId { get; set; }
|
|
public int? KeresesOsztalyId { get; set; }
|
|
public DateTime? NaploMegnyitasDatum { get; set; }
|
|
public DateTime? NaploLezarasDatum { get; set; }
|
|
public int? FeladatEllatasiHelyId { get; set; }
|
|
public bool? UresCsoport { get; set; }
|
|
public bool? NACsoportTipus { get; set; }
|
|
public bool? NaEvfolyamTipusa { get; set; }
|
|
|
|
public int? FeladatKategoriaId { get; set; }
|
|
public int? SearchMuveszetiAgId { get; set; }
|
|
public bool IsFromSzervezet { get; set; }
|
|
public int? SzervezetId { get; set; }
|
|
public int? TanulokszamaTol { get; set; }
|
|
public int? TanulokszamaIg { get; set; }
|
|
|
|
/// <param name="parameters">Paraméterek listája.</param>
|
|
/// <param name="bontasAlias">'OsztalyBontas' -ra használt alias, ha nincs ilyen join akkor üres string vagy null!</param>
|
|
/// <param name="osztalycsoportAlias">T_OSZTALYCSOPORT_OSSZES -re használt alias, ha van.</param>
|
|
/// <param name="csoportAlias">T_CSOPORT_OSSZES -re használt alias, ha van.</param>
|
|
public StringBuilder ToWhereClause(IList<CommandParameter> parameters, string bontasAlias, string osztalycsoportAlias = "T_OSZTALYCSOPORT_OSSZES", string csoportAlias = "T_CSOPORT_OSSZES")
|
|
{
|
|
StringBuilder whereClause = new StringBuilder();
|
|
|
|
if (!string.IsNullOrWhiteSpace(CsoportNev))
|
|
{
|
|
whereClause.Append($" AND lower({osztalycsoportAlias}.C_NEV) like '%' + @{nameof(CsoportNev)} + '%'");
|
|
parameters.Add(new CommandParameter(nameof(CsoportNev), CsoportNev.ToLowerInvariant()));
|
|
}
|
|
|
|
if (NaEvfolyamTipusa.HasValue && NaEvfolyamTipusa.Value)
|
|
{
|
|
whereClause.Append($@" AND
|
|
(({csoportAlias}.C_OSZTALYBONTASID IS NULL AND ({osztalycsoportAlias}.C_EVFOLYAMTIPUSA = :pEvfolyamID or {osztalycsoportAlias}.C_EVFOLYAMTIPUSA IS NULL))
|
|
OR ({bontasAlias}.ID IS NOT NULL AND ({bontasAlias}.C_EVFOLYAMTIPUSA = :pEvfolyamID or {bontasAlias}.C_EVFOLYAMTIPUSA IS NULL)))");
|
|
parameters.Add(new CommandParameter("pEvfolyamID", (int)EvfolyamTipusEnum.na));
|
|
}
|
|
else if (EvfolyamId.HasValue)
|
|
{
|
|
whereClause.Append($@" AND {osztalycsoportAlias}.C_EVFOLYAMTIPUSA = :pEvfolyamID");
|
|
parameters.Add(new CommandParameter("pEvfolyamID", EvfolyamId));
|
|
}
|
|
|
|
if (CsoportvezetoId.HasValue)
|
|
{
|
|
whereClause.Append($@" AND {csoportAlias}.C_CSOPORTVEZETOID = :pCsopvezID");
|
|
parameters.Add(new CommandParameter("pCsopvezID", CsoportvezetoId));
|
|
}
|
|
|
|
if (TeremId.HasValue)
|
|
{
|
|
whereClause.Append($@" AND {osztalycsoportAlias}.C_TEREMID = :pTeremID");
|
|
parameters.Add(new CommandParameter("pTeremID", TeremId));
|
|
}
|
|
|
|
if (VegzosSearch.HasValue)
|
|
{
|
|
if (VegzosSearch == 1)
|
|
{
|
|
whereClause.Append($@" AND {osztalycsoportAlias}.C_VEGZOSEVFOLYAM = 'T'");
|
|
}
|
|
else if (VegzosSearch == 0)
|
|
{
|
|
whereClause.Append($@" AND {osztalycsoportAlias}.C_VEGZOSEVFOLYAM = 'F'");
|
|
}
|
|
}
|
|
|
|
if (NACsoportTipus.HasValue && NACsoportTipus.Value)
|
|
{
|
|
whereClause.Append($@" AND {csoportAlias}.C_TIPUSA = :pCsopTipID");
|
|
parameters.Add(new CommandParameter("pCsopTipID", (int)CsoportTipusEnum.na));
|
|
}
|
|
else if (CsoportTipusId.HasValue)
|
|
{
|
|
whereClause.Append($@" AND {csoportAlias}.C_TIPUSA = :pCsopTipID");
|
|
parameters.Add(new CommandParameter("pCsopTipID", CsoportTipusId));
|
|
}
|
|
|
|
if (KeresesOsztalyId.HasValue)
|
|
{
|
|
whereClause.Append($@" AND {csoportAlias}.C_OSZTALYBONTASID = :pOsztalyID");
|
|
parameters.Add(new CommandParameter("pOsztalyID", KeresesOsztalyId));
|
|
}
|
|
|
|
if (NaploMegnyitasDatum.HasValue)
|
|
{
|
|
whereClause.Append($@" AND {csoportAlias}.C_CSOPORTNAPLOMEGNYITASA >= :pNaploNyit");
|
|
parameters.Add(new CommandParameter("pNaploNyit", NaploMegnyitasDatum));
|
|
}
|
|
|
|
if (NaploLezarasDatum.HasValue)
|
|
{
|
|
whereClause.Append($@" AND {csoportAlias}.C_CSOPORTNAPLOZARASA <= :pNaploZar");
|
|
parameters.Add(new CommandParameter("pNaploZar", NaploLezarasDatum));
|
|
}
|
|
|
|
if (FeladatEllatasiHelyId.HasValue)
|
|
{
|
|
whereClause.Append($@" AND {osztalycsoportAlias}.C_FELADATELLATASIHELYID = :pFeladatEllatasiHelyID");
|
|
parameters.Add(new CommandParameter("pFeladatEllatasiHelyID", FeladatEllatasiHelyId));
|
|
}
|
|
|
|
if (FeladatKategoriaId.IsEntityId())
|
|
{
|
|
whereClause.Append($@" AND {osztalycsoportAlias}.C_FELADATKATEGORIAID = :pFeladatKategoriaId");
|
|
parameters.Add(new CommandParameter("pFeladatKategoriaId", FeladatKategoriaId));
|
|
}
|
|
|
|
if (SearchMuveszetiAgId.HasValue)
|
|
{
|
|
whereClause.Append($@" AND {osztalycsoportAlias}.C_MUVESZETIAGID = :pMuveszetiAgId");
|
|
parameters.Add(new CommandParameter("pMuveszetiAgId", SearchMuveszetiAgId));
|
|
}
|
|
|
|
return whereClause;
|
|
}
|
|
}
|
|
}
|