using System.Data; using Kreta.DataAccess.Interfaces; using Kreta.DataAccessManual.Interfaces; using Kreta.DataAccessManual.Util; using Kreta.Framework; using SDA.DataProvider; using SDA.Kreta.Entities; namespace Kreta.DataAccessManual { internal class KirTelephelyDAL : DataAccessBase, IKirTelephelyDal { public KirTelephelyDAL(DalHandler dalHandler) : base(dalHandler) { } public string GetKretaKodByTelephelyId(int telephelyId, int tanevId) { using (var command = new SDACommand()) { command.Connection = UserContext.Instance.SDAConnection; command.Transaction = UserContext.Instance.SDATransaction; command.CommandType = CommandType.Text; command.Parameters.Add(nameof(telephelyId), telephelyId); command.Parameters.Add(nameof(tanevId), tanevId); command.CommandText = $@" SELECT KirTelephely.C_KRETAKOD FROM T_KIRTELEPHELY_OSSZES KirTelephely where KirTelephely.TOROLT = 'F' and KirTelephely.C_KOD = @{nameof(telephelyId)} and KirTelephely.C_TANEVID = @{nameof(tanevId)}"; return command.ExecuteScalar()?.ToString(); } } public void Insert(IKirTelephely dto) { var entity = dto as KirTelephely; entity.Insert(true); dto.ID = entity.ID; DalHelper.Commit(); } public IKirTelephely Get() { return KirTelephely.GiveAnInstance(); } } }