Пример #1
0
        /// <summary>
        /// Populate the <see cref="AllAlbumIds"/> and <see cref="Galleries"/> properties based on the contents of
        /// <see cref="RootAlbumIds"/> and the flattened list of album IDs in <paramref name="galleries"/>.
        /// </summary>
        /// <param name="galleries">A list of all galleries in the current application. The <see cref="IGallery.FlattenedAlbums"/>
        /// property is used as a source for populating the <see cref="AllAlbumIds"/> and <see cref="Galleries"/> properties
        /// of the current instance.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="galleries" /> is null.</exception>
        public void Inflate(IGalleryCollection galleries)
        {
            if (galleries == null)
            {
                throw new ArgumentNullException("galleries");
            }

            // For each root album, get the list of flattened album IDs from the gallery (we don't know which gallery, so
            // iterate through them until you find the right one).
            foreach (int albumId in this.RootAlbumIds)
            {
                foreach (IGallery gallery in galleries)
                {
                    List <int> albumIds;
                    if (gallery.FlattenedAlbums.TryGetValue(albumId, out albumIds))
                    {
                        this.AddToAllAlbumIds(albumIds);

                        // If we haven't yet added this gallery, do so now.
                        if (!this.Galleries.Contains(gallery))
                        {
                            this.Galleries.Add(gallery);
                        }

                        break;
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Fill the <paramref name="emptyCollection"/> with all the galleries in the current application. The return value is the same reference
        /// as the parameter. The template gallery is not included (that is, the one where the gallery ID = <see cref="Int32.MinValue" />.
        /// </summary>
        /// <param name="emptyCollection">An empty <see cref="IGalleryCollection"/> object to populate with the list of galleries in the current
        /// application. This parameter is required because the library that implements this interface does not have
        /// the ability to directly instantiate any object that implements <see cref="IGalleryCollection"/>.</param>
        /// <returns>
        /// Returns an <see cref="IGalleryCollection" /> representing the galleries in the current application. The returned object is the
        /// same object in memory as the <paramref name="emptyCollection"/> parameter.
        /// </returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="emptyCollection" /> is null.</exception>
        internal static IGalleryCollection GetGalleries(IGalleryCollection emptyCollection)
        {
            if (emptyCollection == null)
            {
                throw new ArgumentNullException("emptyCollection");
            }

            if (emptyCollection.Count > 0)
            {
                emptyCollection.Clear();
            }

            using (IDataReader dr = GetDataReaderGalleries())
            {
                // SQL:
                //SELECT
                //	GalleryId, Description, DateAdded
                //FROM [gs_Gallery];
                while (dr.Read())
                {
                    IGallery g = emptyCollection.CreateEmptyGalleryInstance();
                    g.GalleryId    = Convert.ToInt32(dr["GalleryId"].ToString().Trim(), CultureInfo.InvariantCulture);
                    g.Description  = Convert.ToString(dr["Description"].ToString().Trim(), CultureInfo.InvariantCulture);
                    g.CreationDate = Convert.ToDateTime(dr["DateAdded"].ToString(), CultureInfo.CurrentCulture);
                    g.Albums       = FlattenGallery(g.GalleryId);

                    emptyCollection.Add(g);
                }
            }

            return(emptyCollection);
        }
Пример #3
0
        private void RemoveItemsCurrentUserDoesNotHavePermissionToSee(List <MediaQueueDto> queueItems)
        {
            if (UserCanAdministerSite)
            {
                return;
            }
            else if (!UserCanAdministerSite && UserCanAdministerGallery)
            {
                // Trim the list of queue items to only those that belong to galleries the current
                // user is an administrator for.
                List <MediaQueueDto> itemsToRemove = new List <MediaQueueDto>();
                IGalleryCollection   galleries     = UserController.GetGalleriesCurrentUserCanAdminister();

                foreach (MediaQueueDto item in queueItems)
                {
                    if (galleries.FindById(Factory.LoadMediaObjectInstance(item.FKMediaObjectId).GalleryId) == null)
                    {
                        itemsToRemove.Add(item);
                    }
                }

                foreach (MediaQueueDto item in itemsToRemove)
                {
                    queueItems.Remove(item);
                }
            }
            else
            {
                queueItems.Clear();                 // Not a site or gallery admin; they shouldn't see anything
            }
        }
Пример #4
0
        /// <summary>
        /// Verifies the currently logged-on user has permission to specify the <paramref name="mediaObjectPath"/> in this gallery. The
        /// path must not be used by any other galleries unless the user is a gallery admin for each of those galleries or a site
        /// admin. Returns <c>true</c> if the user has permission; otherwise returns <c>false</c>.
        /// </summary>
        /// <param name="item">The binding item representing the control being tested.</param>
        /// <param name="mediaObjectPath">The relative or full file path the user wishes to use to store media objects, whether they are
        /// the original media object files, thumbnails, or optimized image files. Relative paths should be relative
        /// to the root of the running application so that, when it is combined with physicalAppPath parameter, it creates a valid path.
        /// Examples: "C:\inetpub\wwwroot\galleryserverpro\myimages\", "C:/inetpub/wwwroot/galleryserverpro/myimages",
        /// "\myimages\", "\myimages", "myimages\", "myimages",	"/myimages/", "/myimages"</param>
        /// <returns>
        /// Returns <c>true</c> if the user has permission; otherwise returns <c>false</c>.
        /// </returns>
        private bool ValidateUserHasPermissionToSpecifyPath(GalleryServerPro.WebControls.wwDataBindingItem item, string mediaObjectPath)
        {
            if (UserCanAdministerSite)
            {
                return(true);                // Site admins always have permission.
            }
            if (!UserCanAdministerGallery)
            {
                return(false);                // Must be at least a gallery admin. Kind of a redundant test but we include it for extra safety.
            }
            string fullMediaObjectPath = HelperFunctions.CalculateFullPath(AppSetting.Instance.PhysicalApplicationPath, mediaObjectPath);

            bool isValid = true;

            // Get a list of galleries the current user is a gallery admin for.
            IGalleryCollection adminGalleries = UserController.GetGalleriesCurrentUserCanAdminister();

            // Iterate through each gallery and check to see if the path is used in it.
            foreach (IGallery gallery in Factory.LoadGalleries())
            {
                if (gallery.GalleryId == GalleryId)
                {
                    continue;                     // No need to evaluate the current gallery
                }
                IGallerySettings gallerySettings = Factory.LoadGallerySetting(gallery.GalleryId);

                if ((fullMediaObjectPath.Equals(gallerySettings.FullMediaObjectPath, StringComparison.OrdinalIgnoreCase)) ||
                    (fullMediaObjectPath.Equals(gallerySettings.FullThumbnailPath, StringComparison.OrdinalIgnoreCase)) ||
                    (fullMediaObjectPath.Equals(gallerySettings.FullOptimizedPath, StringComparison.OrdinalIgnoreCase)))
                {
                    // We found another gallery that is using this path. This is not valid unless the user is a gallery admin for it.
                    if (!adminGalleries.Contains(gallery))
                    {
                        isValid = false;
                        item.BindingErrorMessage = String.Format(CultureInfo.CurrentCulture, Resources.GalleryServerPro.Admin_MediaObjects_MO_Path_Used_By_Another_Gallery, mediaObjectPath);
                    }
                }
            }

            return(isValid);
        }
        /// <summary>
        /// Create a GalleryServerRole instance corresponding to the specified parameters. Throws an exception if a role with the
        /// specified name already exists in the data store.
        /// </summary>
        /// <param name="roleName">A string that uniquely identifies the role.</param>
        /// <param name="allowViewAlbumOrMediaObject">A value indicating whether the user assigned to this role has permission to view albums
        /// and media objects.</param>
        /// <param name="allowViewOriginalImage">A value indicating whether the user assigned to this role has permission to view the original,
        /// high resolution version of an image. This setting applies only to images. It has no effect if there are no
        /// high resolution images in the album or albums to which this role applies.</param>
        /// <param name="allowAddMediaObject">A value indicating whether the user assigned to this role has permission to add media objects to an album.</param>
        /// <param name="allowAddChildAlbum">A value indicating whether the user assigned to this role has permission to create child albums.</param>
        /// <param name="allowEditMediaObject">A value indicating whether the user assigned to this role has permission to edit a media object.</param>
        /// <param name="allowEditAlbum">A value indicating whether the user assigned to this role has permission to edit an album.</param>
        /// <param name="allowDeleteMediaObject">A value indicating whether the user assigned to this role has permission to delete media objects within an album.</param>
        /// <param name="allowDeleteChildAlbum">A value indicating whether the user assigned to this role has permission to delete child albums.</param>
        /// <param name="allowSynchronize">A value indicating whether the user assigned to this role has permission to synchronize an album.</param>
        /// <param name="allowAdministerSite">A value indicating whether the user has administrative permission for all albums. This permission
        /// automatically applies to all albums across all galleries; it cannot be selectively applied.</param>
        /// <param name="allowAdministerGallery">A value indicating whether the user has administrative permission for all albums. This permission
        /// automatically applies to all albums in a particular gallery; it cannot be selectively applied.</param>
        /// <param name="hideWatermark">A value indicating whether the user assigned to this role has a watermark applied to images.
        /// This setting has no effect if watermarks are not used. A true value means the user does not see the watermark;
        /// a false value means the watermark is applied.</param>
        /// <returns>Returns a GalleryServerRole instance corresponding to the specified parameters.</returns>
        internal GalleryServerRole(string roleName, bool allowViewAlbumOrMediaObject, bool allowViewOriginalImage, bool allowAddMediaObject, bool allowAddChildAlbum, bool allowEditMediaObject, bool allowEditAlbum, bool allowDeleteMediaObject, bool allowDeleteChildAlbum, bool allowSynchronize, bool allowAdministerSite, bool allowAdministerGallery, bool hideWatermark)
        {
            this._roleName = roleName;
            this._allowViewAlbumOrMediaObject = allowViewAlbumOrMediaObject;
            this._allowViewOriginalImage = allowViewOriginalImage;
            this._allowAddMediaObject = allowAddMediaObject;
            this._allowAddChildAlbum = allowAddChildAlbum;
            this._allowEditMediaObject = allowEditMediaObject;
            this._allowEditAlbum = allowEditAlbum;
            this._allowDeleteMediaObject = allowDeleteMediaObject;
            this._allowDeleteChildAlbum = allowDeleteChildAlbum;
            this._allowSynchronize = allowSynchronize;
            this._allowAdministerSite = allowAdministerSite;
            this._allowAdministerGallery = allowAdministerGallery;
            this._hideWatermark = hideWatermark;

            this._galleries = new GalleryCollection();

            this._rootAlbumIds = new IntegerCollection();
            this._rootAlbumIds.Cleared += new EventHandler(_rootAlbumIds_Cleared);

            this._allAlbumIds = new IntegerCollection();
        }
Пример #6
0
        }                               // Hide default constructor

        /// <summary>
        /// Create a GalleryServerRole instance corresponding to the specified parameters. Throws an exception if a role with the
        /// specified name already exists in the data store.
        /// </summary>
        /// <param name="roleName">A string that uniquely identifies the role.</param>
        /// <param name="allowViewAlbumOrMediaObject">A value indicating whether the user assigned to this role has permission to view albums
        /// and media objects.</param>
        /// <param name="allowViewOriginalImage">A value indicating whether the user assigned to this role has permission to view the original,
        /// high resolution version of an image. This setting applies only to images. It has no effect if there are no
        /// high resolution images in the album or albums to which this role applies.</param>
        /// <param name="allowAddMediaObject">A value indicating whether the user assigned to this role has permission to add media objects to an album.</param>
        /// <param name="allowAddChildAlbum">A value indicating whether the user assigned to this role has permission to create child albums.</param>
        /// <param name="allowEditMediaObject">A value indicating whether the user assigned to this role has permission to edit a media object.</param>
        /// <param name="allowEditAlbum">A value indicating whether the user assigned to this role has permission to edit an album.</param>
        /// <param name="allowDeleteMediaObject">A value indicating whether the user assigned to this role has permission to delete media objects within an album.</param>
        /// <param name="allowDeleteChildAlbum">A value indicating whether the user assigned to this role has permission to delete child albums.</param>
        /// <param name="allowSynchronize">A value indicating whether the user assigned to this role has permission to synchronize an album.</param>
        /// <param name="allowAdministerSite">A value indicating whether the user has administrative permission for all albums. This permission
        /// automatically applies to all albums across all galleries; it cannot be selectively applied.</param>
        /// <param name="allowAdministerGallery">A value indicating whether the user has administrative permission for all albums. This permission
        /// automatically applies to all albums in a particular gallery; it cannot be selectively applied.</param>
        /// <param name="hideWatermark">A value indicating whether the user assigned to this role has a watermark applied to images.
        /// This setting has no effect if watermarks are not used. A true value means the user does not see the watermark;
        /// a false value means the watermark is applied.</param>
        /// <returns>Returns a GalleryServerRole instance corresponding to the specified parameters.</returns>
        internal GalleryServerRole(string roleName, bool allowViewAlbumOrMediaObject, bool allowViewOriginalImage, bool allowAddMediaObject, bool allowAddChildAlbum, bool allowEditMediaObject, bool allowEditAlbum, bool allowDeleteMediaObject, bool allowDeleteChildAlbum, bool allowSynchronize, bool allowAdministerSite, bool allowAdministerGallery, bool hideWatermark)
        {
            this._roleName = roleName;
            this._allowViewAlbumOrMediaObject = allowViewAlbumOrMediaObject;
            this._allowViewOriginalImage      = allowViewOriginalImage;
            this._allowAddMediaObject         = allowAddMediaObject;
            this._allowAddChildAlbum          = allowAddChildAlbum;
            this._allowEditMediaObject        = allowEditMediaObject;
            this._allowEditAlbum         = allowEditAlbum;
            this._allowDeleteMediaObject = allowDeleteMediaObject;
            this._allowDeleteChildAlbum  = allowDeleteChildAlbum;
            this._allowSynchronize       = allowSynchronize;
            this._allowAdministerSite    = allowAdministerSite;
            this._allowAdministerGallery = allowAdministerGallery;
            this._hideWatermark          = hideWatermark;

            this._galleries = new GalleryCollection();

            this._rootAlbumIds          = new IntegerCollection();
            this._rootAlbumIds.Cleared += _rootAlbumIds_Cleared;

            this._allAlbumIds = new IntegerCollection();
        }
Пример #7
0
 /// <summary>
 /// Fill the <paramref name="emptyCollection"/> with all the galleries in the current application. The return value is the same reference
 /// as the parameter. The template gallery is not included (that is, the one where the gallery ID = <see cref="Int32.MinValue"/>.
 /// </summary>
 /// <param name="emptyCollection">An empty <see cref="IGalleryCollection"/> object to populate with the list of galleries in the current
 /// application. This parameter is required because the library that implements this interface does not have
 /// the ability to directly instantiate any object that implements <see cref="IGalleryCollection"/>.</param>
 /// <returns>
 /// Returns an <see cref="IGalleryCollection"/> representing the galleries in the current application. The returned object is the
 /// same object in memory as the <paramref name="emptyCollection"/> parameter.
 /// </returns>
 public override IGalleryCollection Gallery_GetGalleries(IGalleryCollection emptyCollection)
 {
     return GalleryData.GetGalleries(emptyCollection);
 }
        /// <summary>
        /// Fill the <paramref name="emptyCollection"/> with all the galleries in the current application. The return value is the same reference
        /// as the parameter. The template gallery is not included (that is, the one where the gallery ID = <see cref="Int32.MinValue"/>.
        /// </summary>
        /// <param name="emptyCollection">An empty <see cref="IGalleryCollection"/> object to populate with the list of galleries in the current
        /// application. This parameter is required because the library that implements this interface does not have
        /// the ability to directly instantiate any object that implements <see cref="IGalleryCollection"/>.</param>
        /// <returns>
        /// Returns an <see cref="IGalleryCollection"/> representing the galleries in the current application. The returned object is the
        /// same object in memory as the <paramref name="emptyCollection"/> parameter.
        /// </returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="emptyCollection" /> is null.</exception>		/// 
        public override IGalleryCollection Gallery_GetGalleries(IGalleryCollection emptyCollection)
        {
            if (emptyCollection == null)
                throw new ArgumentNullException("emptyCollection");

            if (emptyCollection.Count > 0)
            {
                emptyCollection.Clear();
            }

            using (GspContext ctx = new GspContext())
            {
                var galleries = from i in ctx.Galleries where i.GalleryId > int.MinValue select i;

                foreach (GalleryDto gallery in galleries)
                {
                    IGallery g = emptyCollection.CreateEmptyGalleryInstance();

                    g.GalleryId = gallery.GalleryId;
                    g.Description = gallery.Description;
                    g.CreationDate = gallery.DateAdded;
                    g.Albums = FlattenGallery(gallery.GalleryId);

                    emptyCollection.Add(g);
                }
            }

            return emptyCollection;
        }
Пример #9
0
 public abstract IGalleryCollection Gallery_GetGalleries(IGalleryCollection emptyCollection);
Пример #10
0
        /// <summary>
        /// Extract information from the query string and assign to our class level variables. Return false if something goes wrong
        /// and the variables cannot be set. This will happen when the query string is in an unexpected format.
        /// </summary>
        /// <param name="queryString">The query string for the current request. Can be populated with HttpContext.Request.Url.Query.</param>
        /// <returns>Returns true if all relevant variables were assigned from the query string; returns false if there was a problem.</returns>
        private bool ExtractQueryStringParms(string queryString)
        {
            if (String.IsNullOrEmpty(queryString))
            {
                return(false);
            }

            if (queryString.StartsWith("?", StringComparison.Ordinal))
            {
                queryString = queryString.Remove(0, 1);
            }

            // id=0&gid=all&secaction=6&sc=false&navurl=&levels=2&includealbum=true&idtoselect%5B%5D=220&idtoselect%5B%5D=99
            foreach (string nameValuePair in queryString.Split(new char[] { '&' }))
            {
                string[] nameOrValue = nameValuePair.Split(new char[] { '=' });

                if (nameOrValue.Length < 2)
                {
                    return(false);
                }

                switch (Utils.UrlDecode(nameOrValue[0]))
                {
                case "id":
                {
                    int aid;
                    if (Int32.TryParse(nameOrValue[1], out aid))
                    {
                        _albumId = aid;
                    }
                    else
                    {
                        return(false);
                    }
                    break;
                }

                case "gid":
                {
                    int gid;
                    if (Int32.TryParse(nameOrValue[1], out gid))
                    {
                        _galleries = new GalleryCollection()
                        {
                            Factory.LoadGallery(gid)
                        };
                    }
                    else if (Utils.UrlDecode(nameOrValue[1]).Trim() == "all")
                    {
                        _galleries = UserController.GetGalleriesCurrentUserCanAdminister();
                    }
                    else
                    {
                        return(false);
                    }
                    break;
                }

                case "secaction":
                {
                    int secActionInt;
                    if (Int32.TryParse(nameOrValue[1], out secActionInt))
                    {
                        if (SecurityActionEnumHelper.IsValidSecurityAction((SecurityActions)secActionInt))
                        {
                            _securityAction = (SecurityActions)secActionInt; break;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }

                case "sc":
                {
                    bool showCheckbox;
                    if (Boolean.TryParse(nameOrValue[1], out showCheckbox))
                    {
                        _showCheckbox = showCheckbox;
                    }
                    else
                    {
                        return(false);
                    }
                    break;
                }

                case "navurl":
                {
                    _navigateUrl = Utils.UrlDecode(nameOrValue[1]).Trim();
                    break;
                }

                case "levels":
                {
                    int numLevels;
                    if (Int32.TryParse(nameOrValue[1], out numLevels))
                    {
                        _numberOfLevels = numLevels;
                    }
                    else
                    {
                        return(false);
                    }
                    break;
                }

                case "includealbum":
                {
                    bool includeAlbum;
                    if (Boolean.TryParse(nameOrValue[1], out includeAlbum))
                    {
                        _includeAlbum = includeAlbum;
                    }
                    else
                    {
                        return(false);
                    }
                    break;
                }

                case "idtoselect":
                case "idtoselect[]":
                {
                    int idToSelect;
                    if (Int32.TryParse(nameOrValue[1], out idToSelect))
                    {
                        _albumIdsToSelect.Add(idToSelect);
                    }
                    else
                    {
                        return(false);
                    }
                    break;
                }

                default: return(false); // Unexpected query string parm. Return false so execution is aborted.
                }
            }

            return(true);
        }
        /// <summary>
        /// Populate the <see cref="AllAlbumIds"/> and <see cref="Galleries"/> properties based on the contents of
        /// <see cref="RootAlbumIds"/> and the flattened list of album IDs in <paramref name="galleries"/>.
        /// </summary>
        /// <param name="galleries">A list of all galleries in the current application. The <see cref="IGallery.Albums"/>
        /// property is used as a source for populating the <see cref="AllAlbumIds"/> and <see cref="Galleries"/> properties
        /// of the current instance.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="galleries" /> is null.</exception>
        public void Inflate(IGalleryCollection galleries)
        {
            if (galleries == null)
                throw new ArgumentNullException("galleries");

            // For each root album, get the list of flattened album IDs from the gallery (we don't know which gallery, so
            // iterate through them until you find the right one).
            foreach (int albumId in this.RootAlbumIds)
            {
                foreach (IGallery gallery in galleries)
                {
                    List<int> albumIds;
                    if (gallery.Albums.TryGetValue(albumId, out albumIds))
                    {
                        this.AddToAllAlbumIds(albumIds);

                        // If we haven't yet added this gallery, do so now.
                        if (!this.Galleries.Contains(gallery))
                        {
                            this.Galleries.Add(gallery);
                        }

                        break;
                    }
                }
            }
        }
Пример #12
0
        /// <summary>
        /// Fill the <paramref name="emptyCollection"/> with all the galleries in the current application. The return value is the same reference
        /// as the parameter. The template gallery is not included (that is, the one where the gallery ID = <see cref="Int32.MinValue" />.
        /// </summary>
        /// <param name="emptyCollection">An empty <see cref="IGalleryCollection"/> object to populate with the list of galleries in the current 
        /// application. This parameter is required because the library that implements this interface does not have
        /// the ability to directly instantiate any object that implements <see cref="IGalleryCollection"/>.</param>
        /// <returns>
        /// Returns an <see cref="IGalleryCollection" /> representing the galleries in the current application. The returned object is the
        /// same object in memory as the <paramref name="emptyCollection"/> parameter.
        /// </returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="emptyCollection" /> is null.</exception>
        internal static IGalleryCollection GetGalleries(IGalleryCollection emptyCollection)
        {
            if (emptyCollection == null)
                throw new ArgumentNullException("emptyCollection");

            if (emptyCollection.Count > 0)
            {
                emptyCollection.Clear();
            }

            using (IDataReader dr = GetDataReaderGalleries())
            {
                // SQL:
                //SELECT
                //	GalleryId, Description, DateAdded
                //FROM [gs_Gallery];
                while (dr.Read())
                {
                    IGallery g = emptyCollection.CreateEmptyGalleryInstance();
                    g.GalleryId = Convert.ToInt32(dr["GalleryId"].ToString().Trim(), CultureInfo.InvariantCulture);
                    g.Description = Convert.ToString(dr["Description"].ToString().Trim(), CultureInfo.InvariantCulture);
                    g.CreationDate = Convert.ToDateTime(dr["DateAdded"].ToString(), CultureInfo.CurrentCulture);
                    g.Albums = FlattenGallery(g.GalleryId);

                    emptyCollection.Add(g);
                }
            }

            return emptyCollection;
        }
Пример #13
0
		/// <summary>
		/// Fill the <paramref name="emptyCollection"/> with all the galleries in the current application. The return value is the same reference
		/// as the parameter. The template gallery is not included (that is, the one where <see cref="GalleryDto.IsTemplate" /> = <c>true</c>).
		/// </summary>
		/// <param name="emptyCollection">An empty <see cref="IGalleryCollection"/> object to populate with the list of galleries in the current
		/// application. This parameter is required because the library that implements this interface does not have
		/// the ability to directly instantiate any object that implements <see cref="IGalleryCollection"/>.</param>
		/// <returns>
		/// Returns an <see cref="IGalleryCollection"/> representing the galleries in the current application. The returned object is the
		/// same object in memory as the <paramref name="emptyCollection"/> parameter.
		/// </returns>
		/// <exception cref="ArgumentNullException">Thrown when <paramref name="emptyCollection" /> is null.</exception>		/// 
		private static IGalleryCollection LoadGalleries(IGalleryCollection emptyCollection)
		{
			if (emptyCollection == null)
				throw new ArgumentNullException("emptyCollection");

			if (emptyCollection.Count > 0)
			{
				emptyCollection.Clear();
			}

			using (var repo = new GalleryRepository())
			{
				//var galleries = from i in ctx.Galleries where i.GalleryId > int.MinValue select i;
				var galleries = repo.Where(g => !g.IsTemplate);

				foreach (GalleryDto gallery in galleries)
				{
					IGallery g = emptyCollection.CreateEmptyGalleryInstance();

					g.GalleryId = gallery.GalleryId;
					g.Description = gallery.Description;
					g.CreationDate = gallery.DateAdded;
					g.Albums = FlattenGallery(gallery.GalleryId);

					emptyCollection.Add(g);
				}
			}

			return emptyCollection;
		}
Пример #14
0
 public abstract IGalleryCollection Gallery_GetGalleries(IGalleryCollection emptyCollection);