using System.Data; using System.Linq; 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 MunkaszerzodesDal : DataAccessBase, IMunkaszerzodesDal { public MunkaszerzodesDal(DalHandler handler) : base(handler) { } public MunkaszerzodesDal(DalHandler handler, GridParameters parameters) : base(handler, parameters) { } public IMunkaSzerzodes Get() { return MunkaSzerzodes.GiveAnInstance(); } public IMunkaSzerzodes Get(int id) { var entity = MunkaSzerzodes.GiveAnInstance(); entity.LoadByID(id); return entity; } public DataSet GetSzakkepzesiMunkaszerzodesek(SzakkepzesiMunkaszerzodesSearchPco pco, int tanevId, int intezmenyId) { using (var command = new SDACommand()) { command.Connection = UserContext.Instance.SDAConnection; command.Transaction = UserContext.Instance.SDATransaction; command.CommandType = CommandType.StoredProcedure; command.CommandText = "uspGetSzakkepzesiMunkaszerzodesek"; command.Parameters.Add("pTanevId", tanevId); command.Parameters.Add("pIntezmenyId", intezmenyId); if (!string.IsNullOrWhiteSpace(pco.Honap)) { command.Parameters.Add("pHonap", pco.Honap); } 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 (pco.SzervezetIdList?.Any() ?? false) { var pSzervezetIdListString = string.Join(",", pco.SzervezetIdList.Select(x => x.ToString())); command.Parameters.Add("pSzervezetIdListString", SDADBType.String).Value = pSzervezetIdListString; } if (!string.IsNullOrWhiteSpace(pco.DualisKepzohelyNev)) { command.Parameters.Add("pDualisKepzohelyNev", pco.DualisKepzohelyNev); } if (!string.IsNullOrWhiteSpace(pco.DualisKepzohelyAdoszama)) { command.Parameters.Add("pDualisKepzohelyAdoszama", pco.DualisKepzohelyAdoszama); } var ds = new DataSet(); using (var adapter = new SDADataAdapter()) { adapter.SelectCommand = command; adapter.Fill(ds); } return ds; } } } }