public bool Populate(XmlNode result)
		{
			if (result["id"] == null) return false;
			try
			{
				MovieName = string.Empty;
				OriginalName = string.Empty;
				Overview = string.Empty;
				Images = new List<MovieDB_Image_Result>();

				if (result["id"] != null) MovieID = int.Parse(result["id"].InnerText);
				if (result["name"] != null) MovieName = result["name"].InnerText;
				if (result["original_name"] != null) OriginalName = result["original_name"].InnerText;
				if (result["overview"] != null) Overview = result["overview"].InnerText;

				//XmlNodeList imgs = result.SelectNodes("image");
				XmlNodeList imgs = result["images"].GetElementsByTagName("image");

				foreach (XmlNode img in imgs)
				{
					MovieDB_Image_Result imageResult = new MovieDB_Image_Result();
					if (imageResult.Populate(img))
						Images.Add(imageResult);

				}
			}
			catch (Exception ex)
			{
				logger.ErrorException(ex.ToString(), ex);
				return false;
			}

			return true;
		}
Exemple #2
0
        public bool Populate(XmlNode result)
        {
            if (result["id"] == null)
            {
                return(false);
            }
            try
            {
                MovieName    = string.Empty;
                OriginalName = string.Empty;
                Overview     = string.Empty;
                Images       = new List <MovieDB_Image_Result>();

                if (result["id"] != null)
                {
                    MovieID = int.Parse(result["id"].InnerText);
                }
                if (result["name"] != null)
                {
                    MovieName = result["name"].InnerText;
                }
                if (result["original_name"] != null)
                {
                    OriginalName = result["original_name"].InnerText;
                }
                if (result["overview"] != null)
                {
                    Overview = result["overview"].InnerText;
                }

                //XmlNodeList imgs = result.SelectNodes("image");
                XmlNodeList imgs = result["images"].GetElementsByTagName("image");

                foreach (XmlNode img in imgs)
                {
                    MovieDB_Image_Result imageResult = new MovieDB_Image_Result();
                    if (imageResult.Populate(img))
                    {
                        Images.Add(imageResult);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.ToString(), ex);
                return(false);
            }

            return(true);
        }
Exemple #3
0
        public bool Populate(Movie movie, ImagesWithId imgs)
        {
            try
            {
                Images = new List <MovieDB_Image_Result>();

                MovieID      = movie.Id;
                MovieName    = movie.Title;
                OriginalName = movie.Title;
                Overview     = movie.Overview;

                if (imgs != null && imgs.Backdrops != null)
                {
                    foreach (ImageData img in imgs.Backdrops)
                    {
                        MovieDB_Image_Result imageResult = new MovieDB_Image_Result();
                        if (imageResult.Populate(img, "backdrop"))
                        {
                            Images.Add(imageResult);
                        }
                    }
                }

                if (imgs != null && imgs.Posters != null)
                {
                    foreach (ImageData img in imgs.Posters)
                    {
                        MovieDB_Image_Result imageResult = new MovieDB_Image_Result();
                        if (imageResult.Populate(img, "poster"))
                        {
                            Images.Add(imageResult);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.ToString(), ex);
                return(false);
            }

            return(true);
        }
        public bool Populate(Movie movie, ImagesWithId imgs)
        {
            try
            {
                Images = new List<MovieDB_Image_Result>();

                MovieID = movie.Id;
                MovieName = movie.Title;
                OriginalName = movie.Title;
                Overview = movie.Overview;

                if (imgs != null && imgs.Backdrops != null)
                {
                    foreach (ImageData img in imgs.Backdrops)
                    {
                        MovieDB_Image_Result imageResult = new MovieDB_Image_Result();
                        if (imageResult.Populate(img, "backdrop"))
                            Images.Add(imageResult);
                    }
                }

                if (imgs != null && imgs.Posters != null)
                {
                    foreach (ImageData img in imgs.Posters)
                    {
                        MovieDB_Image_Result imageResult = new MovieDB_Image_Result();
                        if (imageResult.Populate(img, "poster"))
                            Images.Add(imageResult);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error( ex,ex.ToString());
                return false;
            }

            return true;
        }