Ejemplo n.º 1
0
        public IEnumerable <Consulta3> SeleccionarConsulta3()
        {
            var listaConsulta3 = new List <Consulta3>();

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                SqlCommand cmd = new SqlCommand("Consulta3", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OutListadoBeneficiariosId", 0);
                cmd.Parameters.AddWithValue("@OutResultCode", 0);
                con.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    var datosConsulta3 = new Consulta3();
                    datosConsulta3.id = Convert.ToInt32(dr["id"]);
                    datosConsulta3.ValorDocIdentidad    = Convert.ToInt32(dr["ValorDocIdentidad"]);
                    datosConsulta3.CreditoTotalRecibido = Convert.ToDouble(dr["CreditoTotalRecibido"]);
                    datosConsulta3.MayorAporte          = Convert.ToInt32(dr["MayorAporte"]);
                    datosConsulta3.CantidadDeAportes    = Convert.ToInt32(dr["CantidadDeAportes"]);
                    listaConsulta3.Add(datosConsulta3);
                }
                con.Close();
            }
            return(listaConsulta3);
        }
Ejemplo n.º 2
0
        public IActionResult ConsultarTransporteTerrestre([FromBody] ConsultarTransporteTerrestre model)
        {
            try
            {
                DateTime dateTimeInicio;
                DateTime dateTimeFinal;
                if (!DateTime.TryParseExact(model.FechaInicio, "dd'/'MM'/'yyyy",
                                            CultureInfo.InvariantCulture,
                                            DateTimeStyles.None,
                                            out dateTimeInicio))
                {
                    return(BadRequest("Formato de fecha invalido, formato permitido dd/MM/aaaa"));
                }
                if (!DateTime.TryParseExact(model.FechaFinal, "dd'/'MM'/'yyyy",
                                            CultureInfo.InvariantCulture,
                                            DateTimeStyles.None,
                                            out dateTimeFinal))
                {
                    return(BadRequest("Formato de fecha invalido, formato permitido dd/MM/aaaa"));
                }
                ParametrosDTO parametros = new ParametrosDTO();
                Consulta3     consultaTransporteTerrestre = new Consulta3
                {
                    Origin             = model.Origen,
                    Destination        = model.Destino,
                    QuantityTravellers = model.CantidadPasajeros.ToString(),
                    Class     = "Bar",
                    EndDate   = model.FechaFinal,
                    StartDate = model.FechaInicio
                };
                parametros.parameters.transporteTerrestre.consulta = consultaTransporteTerrestre;
                ResponseConsultaTransporteTerrestre response = new ResponseConsultaTransporteTerrestre();
                List <ResponseBase> transportes = new List <ResponseBase>
                {
                    new ResponseBase
                    {
                        Origin      = model.Origen,
                        Destination = model.Destino,
                        Stardate    = DateTime.Now.AddDays(1),
                        EndDate     = DateTime.Now.AddDays(5),
                        TicketCode  = "4456d81asd9",
                        Price       = 2000000
                    },
                    new ResponseBase
                    {
                        Origin      = model.Origen,
                        Destination = model.Destino,
                        Stardate    = DateTime.Now.AddDays(1),
                        EndDate     = DateTime.Now.AddDays(5),
                        TicketCode  = "4456d81asd9",
                        Price       = 2000000
                    },
                    new ResponseBase
                    {
                        Origin      = model.Origen,
                        Destination = model.Destino,
                        Stardate    = DateTime.Now.AddDays(1),
                        EndDate     = DateTime.Now.AddDays(5),
                        TicketCode  = "4456d81asd9",
                        Price       = 2000000
                    },
                    new ResponseBase
                    {
                        Origin      = model.Origen,
                        Destination = model.Destino,
                        Stardate    = DateTime.Now.AddDays(1),
                        EndDate     = DateTime.Now.AddDays(5),
                        TicketCode  = "4456d81asd9",
                        Price       = 2000000
                    }
                };
                response.transportes = transportes;
                return(Ok(response));
            }
            catch (Exception ex)
            {
                Logger.LogError("Excepcion generada en ConsultarVuelos: " + ex.Message);
                return(StatusCode(500, "Ocurrio un error"));

                throw;
            }
        }