public bool Equals(LabelVendor obj)
 {
     if (ReferenceEquals(null, obj))
     {
         return(false);
     }
     if (ReferenceEquals(this, obj))
     {
         return(true);
     }
     return(Equals(obj.Label, Label) && Equals(obj.Vendor, Vendor) && Equals(obj._lastUpdate, _lastUpdate));
 }
        public bool TryParse(string label, string vendor, DateTime reviewDate, int reviewId, ref LabelVendor labelVendor)
        {
            try
            {
                if (string.IsNullOrEmpty(label))
                {
                    throw new ArgumentNullException("label");
                }

                labelVendor = AlbumLabelsRepository.CreateOrUpdate(label, vendor ?? string.Empty , reviewDate);
                return true;
            }
            catch (Exception e)
            {
                var message = string.Format("cannot parse label and vendor '{0}/{1}'\n : {2}", label, vendor, e.Message);
                Logging.Logging.Instance.LogError(string.Format("Une erreur est survenue lors de l'extraction du style de la review  {0} : {1}", reviewId, message), ErrorLevel.Info);
                return false;
            }
        }
Beispiel #3
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;
        }
Beispiel #4
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;
        }
        public static LabelVendor CreateOrUpdate(string label, string vendor, DateTime lastUpdate)
        {
            if (string.IsNullOrEmpty(label))
            {
                throw new ArgumentNullException("label");
            }

            var lb = label.Trim();
            var vd = vendor.Trim();

            var existingLb = LabelVendors.Where(x => x.Label.ToUpperInvariant() == lb.ToUpperInvariant()).SingleOrDefault();
            if (existingLb == null)
            {
                var labelVendor = new LabelVendor(AlbumLabelsIdGenerator.NewID(), lb, vd, lastUpdate);
                LabelVendors.Add(labelVendor);
                return labelVendor;
            }

            existingLb.UpdateVendor(vd, lastUpdate);
            return  existingLb;
        }
 public bool Equals(LabelVendor obj)
 {
     if (ReferenceEquals(null, obj)) return false;
     if (ReferenceEquals(this, obj)) return true;
     return Equals(obj.Label, Label) && Equals(obj.Vendor, Vendor) && Equals(obj._lastUpdate, _lastUpdate);
 }