100 lines
3.3 KiB
C#
100 lines
3.3 KiB
C#
using System.Data;
|
|
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 DictionaryItemBaseNyelvDal : DataAccessBase, IDictionaryItemBaseNyelvDal
|
|
{
|
|
public DictionaryItemBaseNyelvDal(DalHandler handler) : base(handler) { }
|
|
public DictionaryItemBaseNyelvDal(DalHandler handler, GridParameters parameters) : base(handler, parameters) { }
|
|
|
|
public IDictionaryItemBaseNyelv Get()
|
|
{
|
|
return DictionaryItemBaseNyelv.GiveAnInstance();
|
|
}
|
|
|
|
public IDictionaryItemBaseNyelv Get(int id)
|
|
{
|
|
var entity = DictionaryItemBaseNyelv.GiveAnInstance();
|
|
entity.LoadByID(id);
|
|
return entity;
|
|
}
|
|
|
|
public int Insert(IDictionaryItemBaseNyelv dto)
|
|
{
|
|
var entity = dto as DictionaryItemBaseNyelv;
|
|
|
|
entity.Insert();
|
|
dto.ID = entity.ID;
|
|
FollowUp(entity);
|
|
DalHelper.Commit();
|
|
|
|
return dto.ID;
|
|
}
|
|
|
|
public void Delete(int id)
|
|
{
|
|
var entity = Get(id) as DictionaryItemBaseNyelv;
|
|
entity.Delete();
|
|
|
|
DalHelper.Commit();
|
|
}
|
|
|
|
public DataSet GetDictionaryItemBaseNyelvByDictionaryItemId(int dictionaryItemId, int intezmenyId, int tanevId)
|
|
{
|
|
using (var cmd = new SDACommand())
|
|
{
|
|
cmd.Connection = UserContext.Instance.SDAConnection;
|
|
cmd.Transaction = UserContext.Instance.SDATransaction;
|
|
cmd.CommandType = CommandType.StoredProcedure;
|
|
|
|
cmd.CommandText = "uspGetDictionaryItemBaseNyelvByDictionaryItemId";
|
|
cmd.Parameters.Add("pDictionaryItemId", dictionaryItemId);
|
|
cmd.Parameters.Add("pTanevId", tanevId);
|
|
cmd.Parameters.Add("pIntezmenyId", intezmenyId);
|
|
|
|
var ds = new DataSet();
|
|
using (var adapter = new SDADataAdapter())
|
|
{
|
|
adapter.SelectCommand = cmd;
|
|
adapter.Fill(ds);
|
|
}
|
|
|
|
return ds;
|
|
}
|
|
}
|
|
|
|
public void FullUpdate(IDictionaryItemBaseNyelv dto)
|
|
{
|
|
var entity = dto as DictionaryItemBaseNyelv;
|
|
entity.FullUpdate();
|
|
FollowUp(entity);
|
|
DalHelper.Commit();
|
|
}
|
|
|
|
public void FollowUpDictionaryItemBaseNyelv(int intezmenyId, int aktTanevId, int kovTanevId, int id)
|
|
{
|
|
using (SDACommand command = new SDACommand())
|
|
{
|
|
command.Connection = UserContext.Instance.SDAConnection;
|
|
command.Transaction = UserContext.Instance.SDATransaction;
|
|
command.CommandText = "uspFollowUpDictionaryItemBaseNyelv";
|
|
command.Parameters.Add("IntezmenyId", intezmenyId);
|
|
command.Parameters.Add("aktTanevId", aktTanevId);
|
|
command.Parameters.Add("kovetkezoTanevId", kovTanevId);
|
|
command.Parameters.Add("Id", id);
|
|
command.CommandType = CommandType.StoredProcedure;
|
|
|
|
command.ExecuteNonQuery();
|
|
|
|
DalHelper.Commit();
|
|
}
|
|
}
|
|
}
|
|
}
|