189 lines
6.9 KiB
C#
189 lines
6.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using Kreta.DataAccess.Interfaces;
|
|
using Kreta.DataAccessManual.Interfaces;
|
|
using Kreta.DataAccessManual.ParameterClasses;
|
|
using Kreta.DataAccessManual.Util;
|
|
using Kreta.Framework;
|
|
using Kreta.Framework.Util;
|
|
using SDA.DataProvider;
|
|
using SDA.Kreta.Entities;
|
|
|
|
namespace Kreta.DataAccessManual
|
|
{
|
|
internal class DualisSzerzodesFileDal : DataAccessBase, IDualisSzerzodesFileDal
|
|
{
|
|
public DualisSzerzodesFileDal(DalHandler handler) : base(handler)
|
|
{
|
|
}
|
|
|
|
public DualisSzerzodesFileDal(DalHandler handler, GridParameters parameters) : base(handler, parameters)
|
|
{
|
|
}
|
|
|
|
public IDualisSzerzodesFile Get()
|
|
{
|
|
return DualisSzerzodesFile.GiveAnInstance();
|
|
}
|
|
|
|
public IDualisSzerzodesFile Get(int id)
|
|
{
|
|
var entity = DualisSzerzodesFile.GiveAnInstance();
|
|
entity.LoadByID(id);
|
|
return entity;
|
|
}
|
|
|
|
public DataSet GetTanarDualisSzerzodesek(int tanarId, int tanevId)
|
|
{
|
|
using (var command = new SDACommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.CommandType = CommandType.StoredProcedure;
|
|
command.CommandText = "uspGetDualisSzerzodesek";
|
|
|
|
command.Parameters.Add("pTanarId", tanarId);
|
|
command.Parameters.Add("pTanevId", tanevId);
|
|
|
|
var ds = new DataSet();
|
|
using (var adapter = new SDADataAdapter())
|
|
{
|
|
adapter.SelectCommand = command;
|
|
adapter.Fill(ds);
|
|
}
|
|
|
|
DataTable dt = SortingAndPaging(ds.Tables[0], GridParameters);
|
|
|
|
return dt.AsDataSet();
|
|
}
|
|
}
|
|
|
|
public DataSet GetDualisSzerzodesek(DualisSzerzodesSearchPco pco, int tanevId)
|
|
{
|
|
using (var command = new SDACommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.CommandType = CommandType.StoredProcedure;
|
|
command.CommandText = "uspGetAdminDualisSzerzodesek";
|
|
|
|
command.Parameters.Add("pTanevId", tanevId);
|
|
|
|
if (pco.TanarId.HasValue)
|
|
command.Parameters.Add("pTanarId", pco.TanarId);
|
|
if (!string.IsNullOrWhiteSpace(pco.NevSearch))
|
|
command.Parameters.Add("pNevSearch", pco.NevSearch);
|
|
if (!string.IsNullOrWhiteSpace(pco.AnyjaNeve))
|
|
command.Parameters.Add("pAnyjaNeve", pco.AnyjaNeve);
|
|
if (!string.IsNullOrWhiteSpace(pco.SzuletesiHely))
|
|
command.Parameters.Add("pSzuletesiHely", pco.SzuletesiHely);
|
|
if (pco.SzuletesiIdoTol.HasValue)
|
|
command.Parameters.Add("pSzuletesiIdoTol", pco.SzuletesiIdoTol);
|
|
if (pco.SzuletesiIdoIg.HasValue)
|
|
command.Parameters.Add("pSzuletesiIdoIg", pco.SzuletesiIdoIg);
|
|
if (!string.IsNullOrWhiteSpace(pco.OktatasiAzonosito))
|
|
command.Parameters.Add("pOktatasiAzonosito", pco.OktatasiAzonosito);
|
|
if (!string.IsNullOrWhiteSpace(pco.DualisKepzohelyNev))
|
|
command.Parameters.Add("pDualisKepzohelyNev", pco.DualisKepzohelyNev);
|
|
if (!string.IsNullOrWhiteSpace(pco.DualisKepzohelyAdoszama))
|
|
command.Parameters.Add("pDualisKepzohelyAdoszama", pco.DualisKepzohelyAdoszama);
|
|
if (pco.FeltoltesDatumTol.HasValue)
|
|
command.Parameters.Add("pFeltoltesDatumTol", pco.FeltoltesDatumTol);
|
|
if (pco.FeltoltesDatumIg.HasValue)
|
|
command.Parameters.Add("pFeltoltesDatumIg", pco.FeltoltesDatumIg);
|
|
if (pco.Statusz.HasValue)
|
|
command.Parameters.Add("pStatusz", pco.Statusz);
|
|
|
|
var ds = new DataSet();
|
|
using (var adapter = new SDADataAdapter())
|
|
{
|
|
adapter.SelectCommand = command;
|
|
adapter.Fill(ds);
|
|
}
|
|
|
|
return ds;
|
|
}
|
|
}
|
|
|
|
public List<int> GetDualisSzerzodesId(int intezmenyId, int tanevId, int felhasznaloId, int tanuloId)
|
|
{
|
|
using (var command = new SDACommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.CommandType = CommandType.StoredProcedure;
|
|
command.CommandText = "uspGetDualisSzerzodesId";
|
|
|
|
command.Parameters.Add("pIntezmenyId", intezmenyId);
|
|
command.Parameters.Add("pTanevId", tanevId);
|
|
command.Parameters.Add("pFelhasznaloId", felhasznaloId);
|
|
command.Parameters.Add("pTanuloId", tanuloId);
|
|
|
|
var ds = new DataSet();
|
|
using (var adapter = new SDADataAdapter())
|
|
{
|
|
adapter.SelectCommand = command;
|
|
adapter.Fill(ds);
|
|
}
|
|
var result = new List<int>();
|
|
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count == 1)
|
|
{
|
|
foreach (DataRow row in ds.Tables[0].Rows)
|
|
{
|
|
if (row["ID"] != null && row["ID"] != DBNull.Value)
|
|
{
|
|
result.Add(Convert.ToInt32(row["ID"]));
|
|
}
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
public int Insert(IDualisSzerzodesFile dto)
|
|
{
|
|
var entity = dto as DualisSzerzodesFile;
|
|
|
|
entity.Insert();
|
|
dto.ID = entity.ID;
|
|
DalHelper.Commit();
|
|
|
|
return dto.ID;
|
|
}
|
|
|
|
public void Update(IDualisSzerzodesFile dto)
|
|
{
|
|
if (dto is DualisSzerzodesFile entity)
|
|
{
|
|
entity.Update();
|
|
DalHelper.Commit();
|
|
}
|
|
}
|
|
|
|
public void Delete(int id, int userId)
|
|
{
|
|
var entity = Get(id) as DualisSzerzodesFile;
|
|
|
|
entity.Torolt = true;
|
|
|
|
entity.FullUpdate();
|
|
DalHelper.Commit();
|
|
}
|
|
|
|
public void UpdateTanuloDualisSzerzodesei()
|
|
{
|
|
using (var command = new SDACommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.CommandType = CommandType.StoredProcedure;
|
|
command.CommandText = "dev.uspUpdateTanuloDualisSzerzodesei";
|
|
|
|
command.ExecuteNonQuery();
|
|
DalHelper.Commit();
|
|
}
|
|
}
|
|
}
|
|
}
|