Ejemplo n.º 1
0
        public void CargarAlojamientos(String nombreSeleccionado)
        {
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();
            h.OutputFormat = SautinSoft.HtmlToRtf.eOutputFormat.TextUnicode;

            foreach (XmlElement nodo in listaService)
            {
                if (Convert.ToString(nodo["basicData"]["name"].InnerText).Equals(nombreSeleccionado))
                {
                    try
                    {
                        alojamiento.nombre             = Convert.ToString(nodo["basicData"]["name"].InnerText);
                        alojamiento.email              = nodo["basicData"]["email"].InnerText;
                        alojamiento.telefono           = nodo["basicData"]["phone"].InnerText;
                        alojamiento.codPostal          = nodo["geoData"]["zipcode"].InnerText;
                        alojamiento.fechaActualizacion = nodo.Attributes["fechaActualizacion"].Value;
                        alojamiento.web          = nodo["basicData"]["web"].InnerText;
                        alojamiento.direccion    = nodo["geoData"]["address"].InnerText;
                        alojamiento.pais         = nodo["geoData"]["country"].InnerText;
                        alojamiento.ciudad       = nodo["geoData"]["subAdministrativeArea"].InnerText;
                        alojamiento.tipo         = nodo["extradata"].SelectSingleNode("item[@name='Tipo']").InnerText;
                        alojamiento.categoria    = nodo["extradata"]["categorias"]["categoria"].SelectSingleNode("item[@name='Categoria']").InnerText;
                        alojamiento.subCategoria = nodo["extradata"]["categorias"]["categoria"]["subcategorias"]["subcategoria"].SelectSingleNode("item[@name='SubCategoria']").InnerText;
                        alojamiento.descripcion  = h.ConvertString(nodo["basicData"]["body"].InnerText);
                        multimedia = nodo["multimedia"];
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                }
            }

            CargarDireccionesImagenes();
        }
Ejemplo n.º 2
0
        public static void cargarNodo()
        {
            List <string> imagenes = new List <string>();

            XmlNodeList listaAlojamientos = documento.SelectNodes("serviceList/service");

            SautinSoft.HtmlToRtf html = new SautinSoft.HtmlToRtf();
            html.OutputFormat = SautinSoft.HtmlToRtf.eOutputFormat.TextUnicode;

            foreach (XmlNode a in listaAlojamientos)
            {
                alojamiento             = new Alojamiento();
                alojamiento.Codigo      = a.Attributes["id"].Value;
                alojamiento.Nombre      = WebUtility.HtmlDecode(a["basicData"]["name"].InnerText);
                alojamiento.Email       = a["basicData"]["email"].InnerText;
                alojamiento.Telefono    = a["basicData"]["phone"].InnerText;
                alojamiento.Descripcion = html.ConvertString(a["basicData"]["body"].InnerText).Replace("\r\nTrial version converts only first 100000 characters. Evaluation only.", "");
                alojamiento.Web         = a["basicData"]["web"].InnerText;
                alojamiento.Direccion   = a["geoData"]["address"].InnerText;
                alojamiento.Localidad   = a["geoData"]["subAdministrativeArea"].InnerText;
                alojamiento.CP          = a["geoData"]["zipcode"].InnerText;

                XmlNodeList listaMultimedia = a["multimedia"].ChildNodes;
                imagenes = new List <string>();
                foreach (XmlElement m in listaMultimedia)
                {
                    imagenes.Add(m.InnerText);
                }
                alojamiento.Imagenes = imagenes;

                XmlNodeList listaExtradata = a["extradata"].ChildNodes;
                foreach (XmlElement e in listaExtradata)
                {
                    if (e.Name == "categorias")
                    {
                        //XmlNodeList listaCategoria = e["categoria"].ChildNodes;
                        XmlNodeList listaCategoria = e.SelectNodes("categoria");
                        foreach (XmlElement c in listaCategoria)
                        {
                            if (c.Name == "subcategorias")
                            {
                                XmlNodeList listaSubcategoria = c["subcategoria"].ChildNodes;
                                foreach (XmlElement s in listaSubcategoria)
                                {
                                    if (s.Attributes["name"].Value == "SubCategoria")
                                    {
                                        alojamiento.Estrellas = s.InnerText;
                                    }
                                }
                            }
                        }
                    }
                }
                alojamientos.Add(alojamiento);
            }
        }