Beispiel #1
0
		public Film(FicheFilmAllocine ficheFilmAllocine, Genre genre) {
            this.Titre = ficheFilmAllocine.Titre;
            this.Acteurs = ficheFilmAllocine.Casting.Acteurs;

            if (ficheFilmAllocine.InfosSortie.DateSortie == null || ficheFilmAllocine.InfosSortie.DateSortie.Year == 1900)
            {
                this.DateSortie = new DateTime(ficheFilmAllocine.AnneeProduction, 1, 1);
            }
            else
            {
                this.DateSortie = ficheFilmAllocine.InfosSortie.DateSortie;               
            }

            
            this.Duree = ficheFilmAllocine.Duree/60;
            this.Realisateur = ficheFilmAllocine.Casting.Realisateur;
            this.Synopsys = ficheFilmAllocine.LeSynopsis;
            this.LeGenre = genre;
            this.Photo = ficheFilmAllocine.NomPhoto;

            if (ficheFilmAllocine.UrlFiche != null)
            {
                this.UrlFiche = ficheFilmAllocine.UrlFiche.Url;
            }
            
		}
Beispiel #2
0
		public Film(FicheFilmAllocine ficheFilmAllocine, Genre genre) {
            this.Titre = ficheFilmAllocine.Titre;
            this.Acteurs = ficheFilmAllocine.Casting.Acteurs;
            this.DateSortie = ficheFilmAllocine.InfosSortie.DateSortie;
            this.Duree = ficheFilmAllocine.Duree/60;
            this.Realisateur = ficheFilmAllocine.Casting.Realisateur;
            this.Synopsys = ficheFilmAllocine.LeSynopsis;
            this.LeGenre = genre;
            this.Jaquette = ficheFilmAllocine.NomJaquette;

		}
        /// <summary>
        /// Fonction de comparaison de 2 fiches sur la date de sortie
        /// </summary>
        /// <param name="f1"></param>
        /// <param name="f2"></param>
        /// <returns></returns>
        private int ComparerFilms(FicheFilmAllocine f1, FicheFilmAllocine f2) {

            return f2.AnneeProduction.CompareTo(f1.AnneeProduction);

        }
        /// <summary>
        /// Téléchargement d'une jaquette
        /// </summary>
        /// <param name="pUrlFilm"></param>
        /// <param name="film"></param>
        private void DownloadPhoto(FicheFilmAllocine film) {

            try
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Début DownloadPhoto");

                string nomPhoto = film.Titre + ".jpg";

                nomPhoto = nomPhoto.Replace(":", "");
                nomPhoto = nomPhoto.Replace("?", "");
                nomPhoto = nomPhoto.Replace("/", "");

                string cheminFichier = Properties.Settings.Default.RepertoireTemp + nomPhoto;

                //Creation du répertoire temporaire s'il n'existe pas
                DirectoryInfo repTemp = new DirectoryInfo(Properties.Settings.Default.RepertoireTemp);

                if (!repTemp.Exists)
                {
                    repTemp.Create();
                }

                //Création du controle client
                WebClient webClient = new WebClient();

                if (film.LaPhoto != null)
                {
                    Uri adress = new Uri(film.LaPhoto.Url);

                    webClient.DownloadFile(adress, cheminFichier);
                    film.NomPhoto = nomPhoto;
                }
                else
                {
                    Log.MonitoringLogger().Info(KS_NOM_MODULE + "Pas de jaquette à télécharger");
                }
 
            }
            catch (Exception ex)
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Erreur", ex);
                throw ex;
            }
            finally
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Fin DownloadPhoto");
            }
            
        }
        /// <summary>
        /// Contrôle des données d'une fiche Film
        /// </summary>
        /// <param name="pFilm"></param>
        private void ControlerDonnees(FicheFilmAllocine pFilm)
        {
            if (pFilm.InfosSortie == null)
            {
                pFilm.InfosSortie = new FicheFilmAllocine.Release();
                pFilm.InfosSortie.DateSortie = new DateTime(1900, 1, 1);
            }

        }