Пример #1
0
 /// <summary>
 /// Return an <see cref="System.Data.IDataReader"/> representing the hash keys for all media objects in the specified gallery.
 /// </summary>
 /// <param name="galleryId">The value that uniquely identifies the current gallery.</param>
 /// <returns>
 /// Returns an <see cref="System.Data.IDataReader"/> object with one field named "HashKey" containing the hash keys
 /// for all media objects in the current gallery.
 /// </returns>
 public override System.Data.IDataReader  MediaObject_GetAllHashKeys(int galleryId)
 {
     return(MediaObject.GetHashKeys(galleryId));
 }
Пример #2
0
 /// <summary>
 /// Permanently delete the specified media object from the data store. This action cannot
 /// be undone.
 /// </summary>
 /// <param name="mediaObject">The <see cref="IGalleryObject"/> to delete from the data store.</param>
 public override void MediaObject_Delete(IGalleryObject mediaObject)
 {
     MediaObject.Delete(mediaObject);
 }
Пример #3
0
 /// <summary>
 /// Persist the specified media object to the data store. Return the ID of the media object.
 /// </summary>
 /// <param name="mediaObject">An instance of <see cref="IGalleryObject"/> to persist to the data store.</param>
 /// <returns>
 /// Return the ID of the media object. If this is a new media object and a new ID has been
 /// assigned, then this value has also been assigned to the ID property of the object.
 /// </returns>
 public override int MediaObject_Save(IGalleryObject mediaObject)
 {
     return(MediaObject.Save(mediaObject));
 }
Пример #4
0
 /// <summary>
 /// Return an <see cref="System.Data.IDataReader"/> representing the metadata items for the specified mediaObjectId. If no matching object
 /// is found in the data store, an empty <see cref="System.Data.IDataReader"/> is returned.
 /// </summary>
 /// <param name="mediaObjectId">The ID that uniquely identifies the desired media object.</param>
 /// <returns>
 /// Returns an <see cref="System.Data.IDataReader"/> object with all metadata items.
 /// </returns>
 public override System.Data.IDataReader MediaObject_GetDataReaderMetadataItemsByMediaObjectId(int mediaObjectId)
 {
     return(MediaObject.GetDataReaderMetadataItemsByMediaObjectId(mediaObjectId));
 }
Пример #5
0
        /// <summary>
        /// Return a collection representing the child media objects contained within the album specified by
        /// <paramref name="albumId"/> parameter, optionally including the metadata for each item. If no matching
        /// objects are found in the data store, an empty collection is returned.
        /// </summary>
        /// <param name="albumId">The ID that uniquely identifies the desired album.</param>
        /// <param name="includeMetadata">When <c>true</c> include metadata items on the
        /// <see cref="MediaObjectDto.MediaObjectMetadata" /> property. When <c>false</c>, the property is null.</param>
        /// <returns>
        /// Returns a collection of all media objects directly within the album represented by <paramref name="albumId"/>.
        /// </returns>
        internal static IEnumerable <MediaObjectDto> GetChildGalleryObjectsById(int albumId, bool includeMetadata)
        {
            List <MediaObjectDto> mediaObjects = new List <MediaObjectDto>();

            using (SqlConnection cn = SqlDataProvider.GetDbConnection())
            {
                using (IDataReader dr = GetCommandChildMediaObjectsById(albumId, cn).ExecuteReader())
                {
                    while (dr.Read())
                    {
                        // SQL:
                        //SELECT
                        //  MediaObjectId, FKAlbumId, Title, HashKey, ThumbnailFilename, ThumbnailWidth, ThumbnailHeight,
                        //  ThumbnailSizeKB, OptimizedFilename, OptimizedWidth, OptimizedHeight, OptimizedSizeKB,
                        //  OriginalFilename, OriginalWidth, OriginalHeight, OriginalSizeKB, ExternalHtmlSource, ExternalType, Seq,
                        //  CreatedBy, DateAdded, LastModifiedBy, DateLastModified, IsPrivate
                        //FROM [gs_MediaObject]
                        //WHERE FKAlbumId = @AlbumId
                        mediaObjects.Add(new MediaObjectDto
                        {
                            MediaObjectId      = dr.GetInt32(0),
                            FKAlbumId          = dr.GetInt32(1),
                            Title              = dr.GetString(2),
                            HashKey            = dr.GetString(3),
                            ThumbnailFilename  = dr.GetString(4),
                            ThumbnailWidth     = dr.GetInt32(5),
                            ThumbnailHeight    = dr.GetInt32(6),
                            ThumbnailSizeKB    = dr.GetInt32(7),
                            OptimizedFilename  = dr.GetString(8),
                            OptimizedWidth     = dr.GetInt32(9),
                            OptimizedHeight    = dr.GetInt32(10),
                            OptimizedSizeKB    = dr.GetInt32(11),
                            OriginalFilename   = dr.GetString(12),
                            OriginalWidth      = dr.GetInt32(13),
                            OriginalHeight     = dr.GetInt32(14),
                            OriginalSizeKB     = dr.GetInt32(15),
                            ExternalHtmlSource = dr.GetString(16),
                            ExternalType       = dr.GetString(17),
                            Seq              = dr.GetInt32(18),
                            CreatedBy        = dr.GetString(19),
                            DateAdded        = dr.GetDateTime(20),
                            LastModifiedBy   = dr.GetString(21),
                            DateLastModified = dr.GetDateTime(22),
                            IsPrivate        = dr.GetBoolean(23)
                        });
                    }
                }

                if (includeMetadata)
                {
                    foreach (MediaObjectDto moDto in mediaObjects)
                    {
                        moDto.MediaObjectMetadata = new HashSet <MediaObjectMetadataDto>(MediaObject.GetMetadataItemsByMediaObjectId(moDto.MediaObjectId, cn));
                    }
                }
            }

            return(mediaObjects);
        }