public SongListWithArchivedVersionsContract(SongList songList, IUserPermissionContext permissionContext)
			: base(songList, permissionContext) {
			
			ArchivedVersions = songList.ArchivedVersionsManager.Versions.Select(
				a => new ArchivedSongListVersionContract(a)).ToArray();

		}
Esempio n. 2
0
        public int CreateSongListFromWVR(string url)
        {
            PermissionContext.VerifyPermission(PermissionToken.EditProfile);

            var parsed = new NNDWVRParser().GetSongs(url);

            return HandleTransaction(session => {

                var user = GetLoggedUser(session);
                var list = new SongList("Weekly Vocaloid ranking #" + parsed.WVRId, user) {
                    Description = parsed.Name,
                    FeaturedCategory = SongListFeaturedCategory.VocaloidRanking
                };
                session.Save(list);

                foreach (var entry in parsed.Songs) {

                    var song = session.Query<PVForSong>()
                        .Where(p => p.Service == PVService.NicoNicoDouga && p.PVId == entry.NicoId)
                        .First().Song;

                    session.Save(list.AddSong(song));

                }

                AuditLog(string.Format("created {0}", EntryLinkFactory.CreateEntryLink(list)), session, user);
                return list.Id;

            });
        }
        public SongListBaseContract(SongList songList)
            : this()
        {
            ParamIs.NotNull(() => songList);

            Id = songList.Id;
            Name = songList.Name;
        }
 public SongListForEditContract(SongList songList, IUserPermissionContext permissionContext, bool loadSongs = true)
     : base(songList, permissionContext)
 {
     if (loadSongs)
         SongLinks = songList.SongLinks
             .OrderBy(s => s.Order)
             .Select(s => new SongInListEditContract(s, permissionContext.LanguagePreference))
             .ToArray();
 }
Esempio n. 5
0
        public SongListContract(SongList list, IUserPermissionContext permissionContext)
            : base(list)
        {
            ParamIs.NotNull(() => list);

            Author = new UserContract(list.Author);
            CanEdit = EntryPermissionManager.CanEdit(permissionContext, list);
            Description = list.Description;
            FeaturedCategory = list.FeaturedCategory;
        }
Esempio n. 6
0
        public ArchivedSongListVersion(SongList songList, SongListDiff diff, AgentLoginData author,
                                       EntryStatus status,
                                       EntryEditEvent commonEditEvent, string notes)
            : base(null, author, songList.Version, status, notes)
        {
            ParamIs.NotNull(() => diff);

            SongList        = songList;
            Diff            = diff;
            CommonEditEvent = commonEditEvent;
        }
        public ArchivedSongListVersion(SongList songList, SongListDiff diff, AgentLoginData author,
                                       EntryEditEvent commonEditEvent)
            : base(null, author, 0, EntryStatus.Finished, string.Empty)
        {
            ParamIs.NotNull(() => diff);

            SongList        = songList;
            Diff            = diff;
            CommonEditEvent = commonEditEvent;

            Status = EntryStatus.Finished;
        }
Esempio n. 8
0
		public SongListContract(SongList list, IUserPermissionContext permissionContext)
			: base(list) {

			ParamIs.NotNull(() => list);

			Author = new UserWithEmailContract(list.Author);
			CanEdit = EntryPermissionManager.CanEdit(permissionContext, list);
			Description = list.Description;
			FeaturedCategory = list.FeaturedCategory;
			Thumb = (list.Thumb != null ? new EntryThumbContract(list.Thumb) : null);

		}
Esempio n. 9
0
        public virtual bool Equals(SongList another)
        {
            if (another == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, another))
            {
                return(true);
            }

            if (Id == 0)
            {
                return(false);
            }

            return(this.Id == another.Id);
        }
Esempio n. 10
0
        public virtual bool Equals(SongList another)
        {
            if (another == null)
                return false;

            if (ReferenceEquals(this, another))
                return true;

            if (Id == 0)
                return false;

            return this.Id == another.Id;
        }
 public SongListDetailsContract(SongList list, PartialFindResult<SongInListContract> songLinks, IUserPermissionContext permissionContext)
     : base(list, permissionContext)
 {
     SongLinks = songLinks;
     //SongLinks = list.SongLinks.Select(s => new SongInListContract(s, permissionContext.LanguagePreference)).ToArray();
 }