Ejemplo n.º 1
0
 public async Task <Response <List <Rol> > > GetAllAsync() =>
 ReturnResult((await CreateMapper()).MapList((await SqlAccessService.SelectData("with recursivo as ( select  SP2.RolId, " +
                                                                                "SP2.PermisoId from Rol_Permiso  SP2  where  " +
                                                                                " sp2.RolId is null  UNION ALL select  sp.RolId," +
                                                                                " sp.PermisoId from Rol_Permiso sp join recursivo r " +
                                                                                "on r.PermisoId= sp.RolId) select * from recursivo r  " +
                                                                                "inner join permiso p on r.PermisoId = p.Id"))));
        public new async Task <Response <List <TraduccionValue> > > Get(List <Idioma> idiomas)
        {
            var result = (await CreateMapper()).MapList(await SqlAccessService.SelectData("SELECT Tr.Id," +
                                                                                          "Tr.Traduccion," +
                                                                                          "T.KeyValue," +
                                                                                          "Tr.Id_Idioma," +
                                                                                          "Tr.Id_Termino " +
                                                                                          "FROM Traducciones AS Tr " +
                                                                                          "INNER JOIN  Terminos T " +
                                                                                          "ON Tr.Id_Termino = T.Id  " +
                                                                                          $"WHERE Tr.Id_Idioma IN ({ string.Join(",", idiomas.Select(x => x.Id))})"));

            return(Response <List <TraduccionValue> > .From(result));
        }
Ejemplo n.º 3
0
        public async Task <Response <Rol> > GetByUsuarioIdAsync(int usuarioId)
        {
            var query = await SqlAccessService.SelectData(" with recursivo as" +
                                                          " (" +
                                                          " select  SP2.RolId, SP2.PermisoId from Rol_Permiso SP2" +
                                                          " join Usuarios ur on ur.Rol_Id = sp2.PermisoId" +
                                                          $" where  sp2.RolId is null and ur.Id = {usuarioId}" +
                                                          " UNION ALL" +
                                                          " select  sp.RolId, sp.PermisoId from Rol_Permiso sp" +
                                                          " join recursivo r on r.PermisoId= sp.RolId" +
                                                          ")" +
                                                          " select * from recursivo r  inner join permiso p on r.PermisoId = p.Id");

            var map = (await CreateMapper()).Map(query);

            return(ReturnResult(map));
        }
Ejemplo n.º 4
0
        public async Task <Response <List <Rol> > > Get()
        {
            var query = await SqlAccessService.SelectData(" with recursivo as" +
                                                          " (" +
                                                          " select  SP2.RolId, SP2.PermisoId from Rol_Permiso SP2" +
                                                          " where  sp2.RolId is null" +
                                                          " UNION ALL" +
                                                          " select  sp.RolId, sp.PermisoId from Rol_Permiso sp" +
                                                          " join recursivo r on r.PermisoId= sp.RolId" +
                                                          ")" +
                                                          " select * from recursivo r  inner join permiso p on r.PermisoId = p.Id" +
                                                          " group by RolId, PermisoId, Id, Nombre, Descripcion, ByDefault,[Type]");

            var map = (await CreateMapper()).MapList(query);

            return(ReturnResult(map));
        }
        public async Task <Response <List <TraduccionValue> > > GetAllKeys()
        {
            var result = (await CreateMapper()).MapList(await SqlAccessService.SelectData("SELECT Id as Id_Termino, KeyValue FROM Terminos"));

            return(Response <List <TraduccionValue> > .From(result));
        }
Ejemplo n.º 6
0
 public async Task <Response <List <TEntity> > > GetAsync() =>
 ReturnResult((await CreateMapper()).MapList((await SqlAccessService.SelectData((await EntityToColumns <TEntity> .MapAsync())
                                                                                .Send()))));