예제 #1
0
        private City FillCityWithData(City city, ShowtimeData data)
        {
            city.Movies = data.Movies;
            city.Theaters = data.Theaters;

            foreach (var cartelera in data.Carteleras)
            {
                var theater = city.Theaters.Where(x => x.Code == cartelera.TheaterCode).SingleOrDefault();

                //cinepolis bug
                if (theater == null)
                    continue;

                foreach (var sala in cartelera.ShowtimeRooms)
                    theater.Showtimes.AddRange(sala.Showtimes);
            }
            return city;
        }
예제 #2
0
        private void GetCinepolisShowsComplete(object sender, DownloadStringCompletedEventArgs e)
        {
            using (var sreader = new StringReader(e.Result))
            {
                var reader = XmlReader.Create(sreader);
                var data = new ShowtimeData()
                {
                    Date = _date,
                    City = _city
                };

                while (reader.Read() && (reader.Name != "cinepolis" || reader.NodeType != XmlNodeType.EndElement))
                {
                    if (reader.Name.Equals("vigencia"))
                    {
                        data.Expiration = ReadExpiration(reader);
                    }

                    if (reader.Name.Equals("pelicula"))
                    {
                        data.Movies.Add(ReadMovie(reader));
                    }

                    if (reader.Name.Equals("complejo"))
                    {
                        data.Theaters.Add(ReadTheater(reader));
                    }

                    if (reader.Name.Equals("cartelera"))
                    {
                        data.Carteleras.Add(ReadShowtimeScheadule(reader));
                    }
                }
                if (data.Carteleras.Count == 0)
                    OnCompleteShows(null);
                else
                    OnCompleteShows(FillCityWithData(_city, data));
            }
        }