Example #1
0
        public List <NegocioUbicacionObtenerPorIdUsuarioDto> ObtenerPorIdUsuario(RequestNegocioUbicacionObtenerPorIdUsuarioDto filtro)
        {
            //Obtener Negocio Ubicacion
            List <NegocioUbicacionObtenerPorIdUsuarioDto> resultado = new List <NegocioUbicacionObtenerPorIdUsuarioDto>();

            try
            {
                const string query = "Maestro.usp_NegocioUbicacion_ObtenerPorIdUsuario";

                using (var cn = HelperClass.ObtenerConeccion())
                {
                    if (cn.State == ConnectionState.Closed)
                    {
                        cn.Open();
                    }

                    resultado = cn.Query <NegocioUbicacionObtenerPorIdUsuarioDto>(query, new
                    {
                        filtro.IdUsuario,
                        filtro.Buscar,
                        filtro.IdNegocio,
                        filtro.NumeroPagina,
                        filtro.CantidadRegistros,
                        filtro.ColumnaOrden,
                        filtro.DireccionOrden
                    }, commandType: CommandType.StoredProcedure).ToList();
                }
            }
            catch (Exception ex)
            {
                Log(Level.Error, (ex.InnerException == null ? ex.Message : ex.InnerException.Message));
            }
            return(resultado);
        }
Example #2
0
        //Obtener Ubicacion por ID Usuario
        public List<NegocioUbicacionObtenerPorIdUsuarioDto> ObtenerPorIdUsuario(RequestNegocioUbicacionObtenerPorIdUsuarioDto filtro)
        {
            if (filtro == null) filtro = new RequestNegocioUbicacionObtenerPorIdUsuarioDto();
            if (filtro.NumeroPagina == 0) filtro.NumeroPagina = 1;
            if (filtro.CantidadRegistros == 0) filtro.CantidadRegistros = 10;
            if (string.IsNullOrEmpty(filtro.ColumnaOrden)) filtro.ColumnaOrden = "IdNegocioUbicacion";
            if (string.IsNullOrEmpty(filtro.DireccionOrden)) filtro.DireccionOrden = "desc";

            var lista = _adNegocioUbicacion.ObtenerPorIdUsuario(filtro);
            if (lista == null)
            {
                lista = new List<NegocioUbicacionObtenerPorIdUsuarioDto>();
            }
            return lista;
        }
Example #3
0
        public async Task <ActionResult <ResponseNegocioUbicacionObtenerPorIdUsuarioDto> > ObtenerPorIdUsuario([FromBody] RequestNegocioUbicacionObtenerPorIdUsuarioDto filtro)
        {
            ResponseNegocioUbicacionObtenerPorIdUsuarioDto respuesta = new ResponseNegocioUbicacionObtenerPorIdUsuarioDto();
            var result = await Task.FromResult(_lnNegocioUbicacion.ObtenerPorIdUsuario(filtro));

            respuesta.ProcesadoOk = 1;
            respuesta.Cuerpo      = result;

            if (result.Any())
            {
                respuesta.CantidadTotalRegistros = result.First().TotalItems;
            }

            return(Ok(respuesta));
        }