Ejemplo n.º 1
0
        public async Task <HttpResponseMessage> ValidaExisteTokenPassword(int idPersona, string tokenPassword)
        {
            var respuesta    = new ConsultaPorIdResponse <E_PERSONA> {
            };
            var    strMetodo = "WSViajes - ValidaExisteTokenPassword ";
            string sid       = Guid.NewGuid().ToString();

            try
            {
                respuesta.Data = await new PersonaNegocio().ConsultarPorToken(tokenPassword);


                if (respuesta.Data != null)
                {
                    if (respuesta.Data.IdPersona != idPersona)
                    {
                        respuesta.CodigoError = 10001;
                        respuesta.Mensaje     = $"El token no corresponde al usuario";
                    }
                    else
                    {
                        respuesta.Exito   = true;
                        respuesta.Mensaje = $"Registros cargados con éxito";
                    }
                }
                else
                {
                    respuesta.CodigoError = 10000;
                    respuesta.Mensaje     = $"El token proporciondo no es válido, puede que ya haya sido utilizado.";
                }
            }
            catch (ServiceException Ex)
            {
                respuesta.CodigoError = Ex.Codigo;
                respuesta.Mensaje     = Ex.Message;
            }
            catch (Exception Ex)
            {
                string strErrGUI  = Guid.NewGuid().ToString();
                string strMensaje = "Error Interno del Servicio [GUID: " + strErrGUI + "].";
                Log.Error("[" + strMetodo + "]" + "[SID:" + sid + "]" + strMensaje, Ex);

                respuesta.CodigoError = 10001;
                respuesta.Mensaje     = "ERROR INTERNO DEL SERVICIO [" + strErrGUI + "]";
            }

            return(Request.CreateResponse(System.Net.HttpStatusCode.OK, respuesta));
        }
Ejemplo n.º 2
0
        public async Task <HttpResponseMessage> RptGanancias([FromUri] FiltrosReporteGanancias pFiltros)
        {
            var respuesta    = new ConsultaPorIdResponse <E_LISTA_PAGINADA <E_RPT_GANANCIAS> > {
            };
            var    strMetodo = "WSViajes - RptGanancias ";
            string sid       = Guid.NewGuid().ToString();

            try
            {
                //Initialize the mapper
                var config = new MapperConfiguration(cfg =>
                                                     cfg.CreateMap <FiltrosReporteGanancias, E_FILTROS_REPORTE_GANANCIAS>()
                                                     );

                //Using automapper
                var mapper     = new Mapper(config);
                var filtrosMap = mapper.Map <E_FILTROS_REPORTE_GANANCIAS>(pFiltros);

                respuesta.Data = await new ReportesNegocio().ConsultaReporteGanancias(filtrosMap);

                if (respuesta.Data.TotalRows > 0)
                {
                    respuesta.Exito   = true;
                    respuesta.Mensaje = $"Registros cargados con éxito";
                }
                else
                {
                    respuesta.CodigoError = 10000;
                    respuesta.Mensaje     = $"No existen banners.";
                }
            }
            catch (ServiceException Ex)
            {
                respuesta.CodigoError = Ex.Codigo;
                respuesta.Mensaje     = Ex.Message;
            }
            catch (Exception Ex)
            {
                string strErrGUI  = Guid.NewGuid().ToString();
                string strMensaje = "Error Interno del Servicio [GUID: " + strErrGUI + "].";
                Log.Error(Ex, "[" + strMetodo + "]" + "[SID:" + sid + "]" + strMensaje);

                respuesta.CodigoError = 10001;
                respuesta.Mensaje     = "ERROR INTERNO DEL SERVICIO [" + strErrGUI + "]";
            }

            return(Request.CreateResponse(System.Net.HttpStatusCode.OK, respuesta));
        }
Ejemplo n.º 3
0
        public async Task <HttpResponseMessage> GetProductoFavoritoByIds(int idPersona, int idProducto)
        {
            var respuesta    = new ConsultaPorIdResponse <E_PRODUCTO> {
            };
            var    strMetodo = "WSViajes - GetProductoFavoritoByIds ";
            string sid       = Guid.NewGuid().ToString();

            try
            {
                respuesta.Data = await new ProductoNegocio().ConsultarFavoritosByIds(idPersona, idProducto);

                if (respuesta.Data != null)
                {
                    respuesta.Exito   = true;
                    respuesta.Mensaje = $"Registros cargados con éxito";
                }
                else
                {
                    respuesta.CodigoError = 10000;
                    respuesta.Mensaje     = $"No existen productos con los parámetros solicitados";
                }
            }
            catch (ServiceException Ex)
            {
                respuesta.CodigoError = Ex.Codigo;
                respuesta.Mensaje     = Ex.Message;
            }
            catch (Exception Ex)
            {
                string strErrGUI  = Guid.NewGuid().ToString();
                string strMensaje = "Error Interno del Servicio [GUID: " + strErrGUI + "].";
                Log.Error(Ex, "[" + strMetodo + "]" + "[SID:" + sid + "]" + strMensaje);

                respuesta.CodigoError = 10001;
                respuesta.Mensaje     = "ERROR INTERNO DEL SERVICIO [" + strErrGUI + "]";
            }

            return(Request.CreateResponse(System.Net.HttpStatusCode.OK, respuesta));
        }
Ejemplo n.º 4
0
        public async Task <HttpResponseMessage> ConsultaBannerById(Guid idBanner)
        {
            var respuesta    = new ConsultaPorIdResponse <E_BANNER> {
            };
            var    strMetodo = "WSViajes - ConsultaBannerById ";
            string sid       = Guid.NewGuid().ToString();

            try
            {
                respuesta.Data = await new BannerNegocio().ConsultarPorId(idBanner);

                if (respuesta.Data != null)
                {
                    respuesta.Exito   = true;
                    respuesta.Mensaje = $"Registros cargados con éxito";
                }
                else
                {
                    respuesta.CodigoError = 10000;
                    respuesta.Mensaje     = $"No existen locales con los parámetros solicitados";
                }
            }
            catch (ServiceException Ex)
            {
                respuesta.CodigoError = Ex.Codigo;
                respuesta.Mensaje     = Ex.Message;
            }
            catch (Exception Ex)
            {
                string strErrGUI  = Guid.NewGuid().ToString();
                string strMensaje = "Error Interno del Servicio [GUID: " + strErrGUI + "].";
                Log.Error(Ex, "[" + strMetodo + "]" + "[SID:" + sid + "]" + strMensaje);

                respuesta.CodigoError = 10001;
                respuesta.Mensaje     = "ERROR INTERNO DEL SERVICIO [" + strErrGUI + "]";
            }

            return(Request.CreateResponse(System.Net.HttpStatusCode.OK, respuesta));
        }