Пример #1
0
        ///// <summary>
        ///// Determines whether the current user can view the specified <paramref name="album" />.
        ///// </summary>
        ///// <param name="album">The album.</param>
        ///// <returns><c>true</c> if the user can view the album; otherwise, <c>false</c>.</returns>
        //private bool CanUserViewAlbum(IAlbum album)
        //{
        //	return SecurityManager.IsUserAuthorized(SecurityActions.ViewAlbumOrMediaObject, SearchOptions.Roles, album.Id, SearchOptions.GalleryId, SearchOptions.IsUserAuthenticated, album.IsPrivate, SecurityActionsOption.RequireOne, album.IsVirtualAlbum);
        //}

        /// <summary>
        /// Gets a list of all tags in the gallery, regardless of a user's permission.
        /// </summary>
        /// <returns>IEnumerable{TagDto}.</returns>
        private IEnumerable <string> GetTags()
        {
            using (var repo = new MetadataTagRepository())
            {
                return(repo.Where(t => t.FKGalleryId == SearchOptions.GalleryId && t.Metadata.MetaName == TagName)
                       .Select(t => t.Tag.TagName).Distinct());
            }
        }
Пример #2
0
        /// <summary>
        /// Gets a list of all tags in the gallery, regardless of a user's permission.
        /// </summary>
        /// <returns>IEnumerable{TagDto}.</returns>
        private IEnumerable <Entity.Tag> GetTags()
        {
            using (var repo = new MetadataTagRepository())
            {
                var tags = repo.Where(t => t.FKGalleryId == SearchOptions.GalleryId && t.Metadata.MetaName == TagName)
                           .GroupBy(t => t.FKTagName)
                           .Select(t => new Entity.Tag {
                    Value = t.Key, Count = t.Count()
                });

                return(SortAndFilter(tags));
            }
        }
Пример #3
0
        /// <summary>
        /// Gets a list of tags from database for the gallery, sorted on the specified property.
        /// </summary>
        /// <returns><see cref="List{T}" /> where T is <see cref="Entity.TagCacheItem" />.</returns>
        private List <Entity.TagCacheItem> GetAllSortedTagsFromDb()
        {
            using (var repo = new MetadataTagRepository())
            {
                var query = repo.Where(t => t.FKGalleryId == SearchOptions.GalleryId && t.Metadata.MetaName == TagName)
                            .GroupBy(t => t.FKTagName)
                            .Select(t => new Entity.TagCacheItem
                {
                    Value        = t.Key,
                    CountAll     = t.Count(),
                    CountPrivate = t.Count(mt => mt.Metadata.MediaObject.Album.IsPrivate || mt.Metadata.Album.IsPrivate)
                });

                return(Sort(query).ToList());
            }
        }
Пример #4
0
        /// <summary>
        /// Gets a list of all tags in the gallery, regardless of a user's permission.
        /// </summary>
        /// <returns>IEnumerable{TagDto}.</returns>
        private IEnumerable<Entity.Tag> GetTags()
        {
            using (var repo = new MetadataTagRepository())
              {
            var tags = repo.Where(t => t.FKGalleryId == SearchOptions.GalleryId && t.Metadata.MetaName == TagName)
              .GroupBy(t => t.FKTagName)
              .Select(t => new Entity.Tag { Value = t.Key, Count = t.Count() });

            return SortAndFilter(tags);
              }
        }