コード例 #1
0
        public IEnumerable <PlantillaTourResponse> LeeImageTour(int pNroPedido, int pNroPropuesta, int pNroVersion)
        {
            string lineagg = "0";

            try
            {
                List <PlantillaTourResponse> lstPlantillaTour = new List <PlantillaTourResponse>();
                lineagg += ",1";
                using (SqlConnection con = new SqlConnection(Data.Data.StrCnx_WebsSql))
                {
                    SqlCommand cmd = new SqlCommand("latinamericajourneys.LAJ_ImagenTour_S", con);

                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@NroPedido", SqlDbType.Int).Value    = pNroPedido;
                    cmd.Parameters.Add("@NroPropuesta", SqlDbType.Int).Value = pNroPropuesta;
                    cmd.Parameters.Add("@NroVersion", SqlDbType.Int).Value   = pNroVersion;
                    lineagg += ",2";
                    con.Open();
                    cmd.ExecuteNonQuery();
                    SqlDataReader rdr = cmd.ExecuteReader();
                    lineagg += ",3";
                    while (rdr.Read())
                    {
                        lineagg += ",4";


                        PlantillaTourResponse fPlantillaTour = new PlantillaTourResponse
                        {
                            NroPlantilla = rdr["NroPlantilla"].ToString(),
                            IdImg        = rdr["NroPlantilla"].ToString(),
                            Imagen       = rdr["Imagen"].ToString(),
                            StrURL       = rdr["StrURL"].ToString(),
                            Calificacion = rdr["Calificacion"].ToString()
                        };

                        lstPlantillaTour.Add(item: fPlantillaTour);
                    }
                    lineagg += ",5";
                    con.Close();
                }

                return(lstPlantillaTour);
            }
            catch (Exception ex)
            {
                throw new Exception {
                          Source = lineagg
                };
            }
        }
コード例 #2
0
        public IHttpActionResult GetImageTour(PlantillaTourRequest Pla)
        {
            PlantillaTourResponse objPlantillaTour = new PlantillaTourResponse();
            LoginAccess           objPlantilla     = new LoginAccess();

            var lstImagenTour = objPlantilla.LeeImageTour(Int32.Parse(Pla.NroPedido), Int32.Parse(Pla.NroPropuesta), Int32.Parse(Pla.NroVersion));

            if (lstImagenTour.Count() > 0)
            {
                return(Ok(lstImagenTour.ToList()));
            }
            else
            {
                var message = new HttpResponseMessage(HttpStatusCode.BadRequest)
                {
                    Content = new StringContent("No se encontro la Plantilla para el Tour.")
                };

                throw new HttpResponseException(message);
            }
        }