Ejemplo n.º 1
0
        public Artist(int id, string name, IList <Country> countries, string officialUrl, DateTime lastUpdate, Reviewer reviewer, IEnumerable <string> similarArtists)
        {
            #region parameters validation

            if (id == 0)
            {
                throw new ArgumentException("Artist creation : 'Id' cannot be null");
            }
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Artist creation : 'name' cannot be null nor empty");
            }
            if (reviewer == null)
            {
                throw new ArgumentException("Artist creation : 'reviewer' cannot be null nor empty");
            }
            if (lastUpdate == DateTime.MinValue)
            {
                throw new ArgumentException("Artist creation : 'lastUpdate' must be a valid date");
            }

            #endregion

            Reviewer          = reviewer;
            Id                = id;
            RawSimilarArtists = similarArtists.Where(x => x.ToUpperInvariant() != name.ToUpperInvariant()).Distinct().ToList();
            Name              = name.ToUpperInvariant();
            Countries         = countries;
            OfficialUrl       = officialUrl;
            LastUpdate        = lastUpdate;
            CreationDate      = lastUpdate;
        }
Ejemplo n.º 2
0
 public Review(string body, int reviewHits, int reviewScore, Reviewer reviewer)
 {
     Id = ReviewIdGenerator.NewID();
     Body = body;
     Score = reviewScore;
     Hits = reviewHits;
     Reviewer = reviewer;
 }
Ejemplo n.º 3
0
 public Review(string body, int reviewHits, int reviewScore, Reviewer reviewer)
 {
     Id       = ReviewIdGenerator.NewID();
     Body     = body;
     Score    = reviewScore;
     Hits     = reviewHits;
     Reviewer = reviewer;
 }
Ejemplo n.º 4
0
        public void UpdateInfos(IList <Country> countries, string officialUrl, DateTime lastUpdate, Reviewer reviewer, IList <string> similarArtists)
        {
            #region parameters validation

            if (reviewer == null)
            {
                throw new ArgumentException("Artist update : 'reviewer' cannot be null nor empty");
            }
            if (lastUpdate == DateTime.MinValue)
            {
                throw new ArgumentException("Artist update : 'lastUpdate' must be a valid date");
            }

            #endregion

            //if older version than the current one, return without doing anything
            if (lastUpdate < LastUpdate)
            {
                return;
            }

            foreach (var country in countries)
            {
                if (!Countries.Contains(country))
                {
                    Countries.Add(country);
                }
            }

            LastUpdate = lastUpdate;
            Reviewer   = reviewer;

            if (!string.IsNullOrEmpty(officialUrl))
            {
                OfficialUrl = officialUrl;
            }

            //Add new similar artists, avoiding duplicates
            foreach (var similarArtist in similarArtists)
            {
                if (!RawSimilarArtists.Contains(similarArtist) && similarArtist != Name)
                {
                    RawSimilarArtists.Add(similarArtist);
                }
            }
        }
Ejemplo n.º 5
0
        public Album(int id, string title, DateTime releaseDate, int score, LabelVendor labelVendor, string coverName, DateTime creationDate, Artist artist, Reviewer reviewer, IEnumerable<string> albumSimilarAlbums, string albumType, string rawAlbumMusicGenre, StyleDefinition processedAlbumMusicGenre, Review chronique)
        {
            Review = chronique;
            Review.Product = this;

            Id = id;
            Title = title;
            ReleaseDate = releaseDate;
            Score = score;
            LabelVendor = labelVendor;
            CoverName = coverName;
            AlbumType = albumType;
            RawAlbumMusicGenre = rawAlbumMusicGenre;
            ProcessedAlbumMusicGenre = processedAlbumMusicGenre;
            Artist = artist;
            Reviewer = reviewer;
            var tmpSimilarAlbums = albumSimilarAlbums.Select(x => x.Replace("<i>", "").Replace("</i>", ""));
            RawSimilarAlbums = tmpSimilarAlbums.Where(x => x.ToUpperInvariant() != title.ToUpperInvariant()).Distinct().ToList();
            CreationDate = creationDate;
        }
Ejemplo n.º 6
0
        public Album(int id, string title, DateTime releaseDate, int score, LabelVendor labelVendor, string coverName, DateTime creationDate, Artist artist, Reviewer reviewer, IEnumerable <string> albumSimilarAlbums, string albumType, string rawAlbumMusicGenre, StyleDefinition processedAlbumMusicGenre, Review chronique)
        {
            Review         = chronique;
            Review.Product = this;

            Id                       = id;
            Title                    = title;
            ReleaseDate              = releaseDate;
            Score                    = score;
            LabelVendor              = labelVendor;
            CoverName                = coverName;
            AlbumType                = albumType;
            RawAlbumMusicGenre       = rawAlbumMusicGenre;
            ProcessedAlbumMusicGenre = processedAlbumMusicGenre;
            Artist                   = artist;
            Reviewer                 = reviewer;
            var tmpSimilarAlbums = albumSimilarAlbums.Select(x => x.Replace("<i>", "").Replace("</i>", ""));

            RawSimilarAlbums = tmpSimilarAlbums.Where(x => x.ToUpperInvariant() != title.ToUpperInvariant()).Distinct().ToList();
            CreationDate     = creationDate;
        }
Ejemplo n.º 7
0
        public Artist(int id, string name, IList<Country> countries, string officialUrl, DateTime lastUpdate, Reviewer reviewer, IEnumerable<string> similarArtists)
        {
            #region parameters validation

            if (id == 0)
            { throw new ArgumentException("Artist creation : 'Id' cannot be null"); }
            if (string.IsNullOrEmpty(name))
            { throw new ArgumentException("Artist creation : 'name' cannot be null nor empty"); }
            if (reviewer == null)
            { throw new ArgumentException("Artist creation : 'reviewer' cannot be null nor empty"); }
            if (lastUpdate == DateTime.MinValue)
            { throw new ArgumentException("Artist creation : 'lastUpdate' must be a valid date"); }

            #endregion

            Reviewer = reviewer;
            Id = id;
            RawSimilarArtists = similarArtists.Where(x => x.ToUpperInvariant() != name.ToUpperInvariant()).Distinct().ToList();
            Name = name.ToUpperInvariant();
            Countries = countries;
            OfficialUrl = officialUrl;
            LastUpdate = lastUpdate;
            CreationDate = lastUpdate;
        }
Ejemplo n.º 8
0
        public void UpdateInfos(IList<Country> countries, string officialUrl, DateTime lastUpdate, Reviewer reviewer, IList<string> similarArtists)
        {
            #region parameters validation

            if (reviewer == null)
            { throw new ArgumentException("Artist update : 'reviewer' cannot be null nor empty"); }
            if (lastUpdate == DateTime.MinValue)
            { throw new ArgumentException("Artist update : 'lastUpdate' must be a valid date"); }

            #endregion

            //if older version than the current one, return without doing anything
            if (lastUpdate < LastUpdate)
            {
                return;
            }

            foreach (var country in countries)
            {
                if(!Countries.Contains(country))
                    Countries.Add(country);
            }

            LastUpdate = lastUpdate;
            Reviewer = reviewer;

            if (!string.IsNullOrEmpty(officialUrl))
            {
                OfficialUrl = officialUrl;
            }

            //Add new similar artists, avoiding duplicates
            foreach (var similarArtist in similarArtists)
            {
                if (!RawSimilarArtists.Contains(similarArtist) && similarArtist != Name)
                {
                    RawSimilarArtists.Add(similarArtist);
                }
            }
        }