using System.Data; using Kreta.DataAccessManual.Interfaces; using Kreta.DataAccessManual.Util; using Kreta.Framework; using SDA.DataProvider; namespace Kreta.DataAccessManual { internal class RolesDAL : DataAccessBase, IRolesDAL { public RolesDAL(DalHandler handler) : base(handler) { } /// /// visszaadja a felhasználó összes szerepkörét. /// /// public DataTable GetUserRoles(int? felhasznaloid) { using (var command = new SDACommand()) { command.Connection = UserContext.Instance.SDAConnection; command.Transaction = UserContext.Instance.SDATransaction; command.CommandType = CommandType.StoredProcedure; command.CommandText = "sp_GetUserRoles"; command.Parameters.Add("FELHASZNALOID", felhasznaloid ?? UserContext.Instance.FelhasznaloId); var ds = new DataSet(); using (var adapter = new SDADataAdapter()) { adapter.SelectCommand = command; adapter.Fill(ds); } return ds.Tables[0]; } } /// /// visszaadja a felhasználó összes jogosultágát. /// /// public DataTable GetFelhasznaloJogosultsag(int felhasznaloId, int szerepkorId) { using (var command = new SDACommand()) { command.Connection = UserContext.Instance.SDAConnection; command.Transaction = UserContext.Instance.SDATransaction; command.CommandType = CommandType.StoredProcedure; command.CommandText = "sp_GetFelhasznaloJogok"; command.Parameters.Add("FELHASZNALOID", felhasznaloId); command.Parameters.Add("SZEREPKORTIPUS", szerepkorId); var ds = new DataSet(); using (var adapter = new SDADataAdapter()) { adapter.SelectCommand = command; adapter.Fill(ds); } return ds.Tables[0]; } } } }