private string GetTopAlbumTitle(IAlbum rootAlbum)
        {
            IGallery gallery         = Factory.LoadGallery(rootAlbum.GalleryId);
            string   rootAlbumPrefix = Options.RootNodesPrefix.Replace("{GalleryId}", gallery.GalleryId.ToString(CultureInfo.InvariantCulture)).Replace("{GalleryDescription}", gallery.Description);

            return(_htmlController.RemoveHtmlTags(String.Concat(rootAlbumPrefix, rootAlbum.Title)));
        }
Beispiel #2
0
        public async Task <ScriptGalleryDetailModel> Detail(IGallery gallery)
        {
            const string functionName = "detail";

            return(await InvokeAsync <ScriptGalleryDetailModel>(functionName,
                                                                Json(gallery)));
        }
Beispiel #3
0
 internal MailChimp(
     IAutomations automations, 
     ICampaigns campaigns, 
     IConversations conversations, 
     IEcomm ecomm, 
     IFolders folders, 
     IGallery gallery, 
     IGoal goal, 
     IHelper helper, 
     ILists lists, 
     IReports reports, 
     ITemplates templates, 
     IUsers users, 
     IVip vip)
 {
     Automations = automations;
     Campaigns = campaigns;
     Conversations = conversations;
     Ecomm = ecomm;
     Folders = folders;
     Gallery = gallery;
     Goal = goal;
     Helper = helper;
     Lists = lists;
     Reports = reports;
     Templates = templates;
     Users = users;
     Vip = vip;
 }
        private string GetRootAlbumTitle(IAlbum rootAlbum)
        {
            IGallery gallery         = Factory.LoadGallery(rootAlbum.GalleryId);
            string   rootAlbumPrefix = RootAlbumPrefix.Replace("{GalleryId}", gallery.GalleryId.ToString()).Replace("{GalleryDescription}", gallery.Description);

            return(Util.RemoveHtmlTags(String.Concat(rootAlbumPrefix, rootAlbum.Title)));
        }
Beispiel #5
0
        private void DataBindDeleteButtonInGalleriesGridRow(GridViewRowEventArgs e)
        {
            // reference the Delete LinkButton
            LinkButton lbDeleteGallery = (LinkButton)e.Row.FindControl("lbDeleteGallery");

            if (lbDeleteGallery == null)
            {
                throw new WebException("Cannot find a LinkButton with ID='lbDeleteGallery' in the current row of the GridView 'gvGalleries'.");
            }

            // Get information about the product bound to the row
            IGallery gallery = (IGallery)e.Row.DataItem;

            if (gallery.GalleryId == GalleryId)
            {
                string msg = String.Format(CultureInfo.InvariantCulture, Resources.GalleryServerPro.Admin_Gallery_Settings_Cannot_Delete_Current_Gallery_Text, gallery.Description.Replace("'", @"\'"));
                lbDeleteGallery.OnClientClick = String.Format(CultureInfo.InvariantCulture, "alert('{0}'); return false;", msg);
            }
            else
            {
                string msg = String.Format(CultureInfo.InvariantCulture, Resources.GalleryServerPro.Admin_Gallery_Settings_Delete_Gallery_Confirm_Text, gallery.Description.Replace("'", @"\'"));
                lbDeleteGallery.OnClientClick = String.Format(CultureInfo.InvariantCulture, "return confirm('{0}');", msg);
            }

            if (AppSetting.Instance.License.IsInReducedFunctionalityMode)
            {
                lbDeleteGallery.Visible = false;
            }
        }
Beispiel #6
0
        private bool TryAddEvents(IGallery localGallery, IGallery azureGallery, GalleryYear localYear)
        {
            bool result = false;

            Action <GalleryEvent> uploadEvent = (galleryEvent) => {
                Console.WriteLine("Uploading new gallery event: " + galleryEvent.Name);
                _azureService.UploadEvent(galleryEvent);
            };

            var foundAzureYear = azureGallery.Years.FirstOrDefault(x => x.Year == localYear.Year);

            if (foundAzureYear != null)
            {
                // Year already exists in Azure - add new local events if any
                foreach (var galleryEvent in localYear.GalleryEvents)
                {
                    var foundAzureEvent = foundAzureYear.GalleryEvents.FirstOrDefault(x => x.Name == galleryEvent.Name);
                    if (foundAzureEvent == null)
                    {
                        foundAzureYear.GalleryEvents.Add(galleryEvent);
                        uploadEvent(galleryEvent);
                        result = true;
                    }
                }
            }
            else
            {
                // Add new year with events and upload event photos to azure
                azureGallery.Years.Add(localYear);
                localYear.GalleryEvents.ForEach(x => uploadEvent(x));
                result = true;
            }
            return(result);
        }
        public static async Task<IList<Package>> ResolveDependencies(IGallery gallery, List<string> installed)
        {
            PNode pnode = await MetadataTree.GetTree(installed.ToArray(), gallery, "net40-Client");

            List<PNode> independentTrees = TreeSplitter.FindIndependentTrees(pnode);

            List<Package> solution = new List<Package>();

            foreach (PNode tree in independentTrees)
            {
                List<Package>[] lineup = Participants.Collect(tree);

                foreach (List<Package> registration in lineup)
                {
                    registration.Reverse();
                }

                IList<Package> partial = Runner.FindFirst(tree, lineup);

                if (partial == null)
                {
                    Console.Write("unable to find solution between: ");
                    Utils.PrintDistinctRegistrations(lineup);
                    Console.WriteLine();
                }
                else
                {
                    foreach (var item in partial)
                    {
                        solution.Add(item);
                    }
                }
            }
            return solution;
        }
Beispiel #8
0
        /// <summary>
        /// Handles the RowCommand event of the gvGalleries control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewCommandEventArgs"/> instance containing the event data.</param>
        protected void gvGalleries_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Insert":
            {
                TextBox txtInsert = gvGalleries.FooterRow.FindControl("txtDescriptionInsert") as TextBox;

                if (txtInsert == null)
                {
                    throw new WebException("Could not find a TextBox named 'txtDescriptionInsert' in the GridView's row.");
                }

                if (String.IsNullOrEmpty(txtInsert.Text))
                {
                    HandleGalleryEditFailure(Resources.GalleryServerPro.Admin_Gallery_Settings_Gallery_Description_Required);
                }
                else
                {
                    IGallery newGallery = CreateGallery(txtInsert.Text);

                    SetMediaObjectPathForNewGallery(newGallery);

                    VerifyUserHasGalleryAdminPermission(newGallery);

                    HandleGalleryEditSuccess(Resources.GalleryServerPro.Admin_Gallery_Settings_Gallery_Created_Success_Text);
                }

                break;
            }
            }

            gvGalleries.DataBind();
        }
Beispiel #9
0
        public void UpdateGallery(IGallery gallery)
        {
            Gallery gal = new Gallery(gallery);

            _db.Update(gal);
            _db.SaveChanges();
        }
Beispiel #10
0
        public void RemoveGallery(IGallery gallery)
        {
            Gallery gal = new Gallery(gallery);

            _db.Delete(gal);
            _db.SaveChanges();
        }
Beispiel #11
0
        public void AddGallery(IGallery gallery)
        {
            Gallery gal = new Gallery(gallery);

            _db.Add(gal);
            _db.SaveChanges();
        }
Beispiel #12
0
 public void Update(IGallery data)
 {
     this.Title           = data.Title;
     this.CreatedDate     = data.CreatedDate;
     this.CreatedByUserId = data.CreatedByUserId;
     this.CategoryId      = data.CategoryId;
 }
        /// <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);
        }
 public GalleryModel(IGallery gallery)
 {
     GalleryId          = gallery.GalleryId;
     GalleryName        = gallery.GalleryName;
     GalleryDiscription = gallery.GalleryDiscription;
     GalleryPhoto       = gallery.GalleryPhoto;
     GalleryPhotos      = gallery.GalleryPhotos;
 }
Beispiel #15
0
 public HotelController(IPlace place, IAddress address, IDetail detail, IGallery gallery, ICategory category)
 {
     _gallery  = gallery;
     _address  = address;
     _place    = place;
     _detail   = detail;
     _category = category;
 }
 public GalleryModel(IGallery gallery)
 {
     GalleryId = gallery.GalleryId;
     GalleryName = gallery.GalleryName;
     GalleryDiscription = gallery.GalleryDiscription;
     GalleryPhoto = gallery.GalleryPhoto;
     GalleryPhotos = gallery.GalleryPhotos;
 }
Beispiel #17
0
 public AirPlainController(IAirPlane airPlane, IBrand brand, IDetail detail, IAirPort airPort, IGallery gallery)
 {
     _brand    = brand;
     _detail   = detail;
     _airport  = airPort;
     _gallery  = gallery;
     _airplane = airPlane;
 }
        /// <summary>
        /// Adds the specified <paramref name="gallery" /> to the current collection.
        /// </summary>
        /// <param name="gallery">The gallery to add.</param>
        public void Add(IGallery gallery)
        {
            if (gallery == null)
            {
                throw new ArgumentNullException(nameof(gallery), "Cannot add null to an existing GalleryCollection.");
            }

            _galleries.TryAdd(gallery.GalleryId, gallery);
        }
        /// <summary>
        /// Determines whether the <paramref name="gallery"/> is already a member of the collection. An object is considered a member
        /// of the collection if they both have the same <see cref="IGallery.GalleryId" />.
        /// </summary>
        /// <param name="gallery">An <see cref="IGallery"/> to determine whether it is a member of the current collection.</param>
        /// <returns>Returns <c>true</c> if <paramref name="gallery"/> is a member of the current collection;
        /// otherwise returns <c>false</c>.</returns>
        public bool Contains(IGallery gallery)
        {
            if (gallery == null)
            {
                return(false);
            }

            return(_galleries.ContainsKey(gallery.GalleryId));
        }
Beispiel #20
0
 /// Saves gallery json to filesystem
 public void SaveGallery(IGallery gallery)
 {
     using (StreamWriter file = File.CreateText(_galleryJsonFullName))
     {
         var serializer = new JsonSerializer();
         serializer.Serialize(file, gallery);
     }
     Console.WriteLine("Gallery json file saved: " + _galleryJsonFullName);
 }
Beispiel #21
0
 public InstituteController(IPlace place, IAddress address, IDetail detail, ILinks links, IGallery gallery, ICategory category)
 {
     _place    = place;
     _address  = address;
     _detail   = detail;
     _links    = links;
     _gallery  = gallery;
     _category = category;
 }
Beispiel #22
0
        /// <summary>
        /// Sets the media object path for the new gallery to the path of the current gallery. The change is persisted to the data store.
        /// </summary>
        /// <param name="gallery">The gallery.</param>
        private void SetMediaObjectPathForNewGallery(IGallery gallery)
        {
            IGallerySettings gallerySettings = Factory.LoadGallerySetting(gallery.GalleryId, true);

            gallerySettings.MediaObjectPath = GallerySettings.MediaObjectPath;
            gallerySettings.ThumbnailPath   = GallerySettings.ThumbnailPath;
            gallerySettings.OptimizedPath   = GallerySettings.OptimizedPath;

            gallerySettings.Save();
        }
Beispiel #23
0
        private static IGallery CreateGallery(string description)
        {
            IGallery gallery = Factory.CreateGalleryInstance();

            gallery.CreationDate = DateTime.Now;
            gallery.Description  = description;
            gallery.Save();

            return(gallery);
        }
    /// <summary>
    /// 初始化
    /// </summary>
    public void Init()
    {
        gallerySDKCallBack = new GameObject("GallerySDKCallBack").AddComponent <GallerySDKCallBack>();
#if UNITY_ANDROID
        gallerySdk = new AndroidGallery();
#elif UNITY_IPHONE
        gallerySdk = new IOSGallery();
#endif
        gallerySdk.Init();
    }
        public void CanCreateUpdateListGetDeleteGallery()
        {
            using (var context = FluentMockContext.Start(GetType().FullName))
            {
                Region region = Region.USWestCentral;
                string rgName = TestUtilities.GenerateName("vmexttest");

                var azure = TestHelper.CreateRollupClient();

                try
                {
                    // Create a gallery
                    //
                    IGallery gallery = azure.Galleries.Define("jvaImageGallery")
                                       .WithRegion(region)
                                       .WithNewResourceGroup(rgName)
                                       .WithDescription("jv image gallery")
                                       .Create();

                    Assert.NotNull(gallery.UniqueName);
                    Assert.Equal("jvaImageGallery", gallery.Name);
                    Assert.Equal("jv image gallery", gallery.Description);
                    Assert.NotNull(gallery.ProvisioningState);
                    //
                    // Update the gallery
                    //
                    gallery.Update()
                    .WithDescription("updated java's image gallery")
                    .WithTag("jdk", "openjdk")
                    .Apply();

                    Assert.Equal("updated java's image gallery", gallery.Description);
                    Assert.NotNull(gallery.Tags);
                    Assert.Equal(1, gallery.Tags.Count);
                    //
                    // List galleries
                    //
                    IEnumerable <IGallery> galleries = azure.Galleries.ListByResourceGroup(rgName);
                    Assert.Single(galleries);
                    galleries = azure.Galleries.List();
                    Assert.True(galleries.Count() > 0);
                    //
                    azure.Galleries.DeleteByResourceGroup(gallery.ResourceGroupName, gallery.Name);
                }
                finally
                {
                    try
                    {
                        azure.ResourceGroups.DeleteByName(rgName);
                    }
                    catch { }
                }
            }
        }
Beispiel #26
0
 /// <summary>
 /// Permanently delete the specified gallery from the data store, including all related records. This action cannot
 /// be undone.
 /// </summary>
 /// <param name="gallery">The <see cref="IGallery" /> to delete from the data store.</param>
 internal static void DeleteGallery(IGallery gallery)
 {
     using (SqlConnection cn = SqlDataProvider.GetDbConnection())
     {
         using (SqlCommand cmd = GetCommandGalleryDelete(gallery.GalleryId, cn))
         {
             cn.Open();
             cmd.ExecuteNonQuery();
         }
     }
 }
 /// <summary>
 /// Permanently delete the specified gallery from the data store, including all related records. This action cannot
 /// be undone.
 /// </summary>
 /// <param name="gallery">The <see cref="IGallery" /> to delete from the data store.</param>
 internal static void DeleteGallery(IGallery gallery)
 {
     using (SqlConnection cn = SqlDataProvider.GetDbConnection())
     {
         using (SqlCommand cmd = GetCommandGalleryDelete(gallery.GalleryId, cn))
         {
             cn.Open();
             cmd.ExecuteNonQuery();
         }
     }
 }
Beispiel #28
0
        /// Returns gallery json from file system
        public IGallery ReadGalleryJson()
        {
            IGallery gallery = null;

            using (StreamReader file = File.OpenText(_galleryJsonFullName))
            {
                var serializer = new JsonSerializer();
                gallery = (Gallery)serializer.Deserialize(file, typeof(Gallery));
            }
            return(gallery);
        }
Beispiel #29
0
 public static Gallery CreateGallery(IGallery data)
 {
     return(new Gallery
     {
         GalleryId = data.GalleryId,
         GalleryUid = data.GalleryUid,
         Title = data.Title,
         CreatedDate = data.CreatedDate,
         CreatedByUserId = data.CreatedByUserId,
         CategoryId = data.CategoryId
     });
 }
Beispiel #30
0
        public IGallery InsertGallery(IGallery data)
        {
            var db = new TooksCmsDAL();

            var g = Gallery.CreateGallery(data);

            db.Galleries.Add(g);

            db.SaveChanges();

            return(g);
        }
Beispiel #31
0
        private static IGallery CreateGallery(string description)
        {
            IGallery gallery = Factory.CreateGalleryInstance();

            gallery.Description = description;
            gallery.Save();


            // Sueetie Modified - Create Sueetie Media Gallery record stub
            SueetieMedia.CreateMediaGallery(gallery.GalleryId);

            return(gallery);
        }
Beispiel #32
0
        public GalleryModel(IGallery data)
        {
            this.Id     = data.GalleryId;
            this.Uid    = data.GalleryUid;
            this.Title  = data.Title;
            this.UserId = data.CreatedByUserId;
            var user = new User(DependencyResolver.Current.GetService <IAccountRepository>().FetchUser(this.UserId));

            this.UsersName   = user.ContactInfo.FirstName + " " + user.ContactInfo.LastName;
            this.CreatedDate = data.CreatedDate;
            this.CategoryId  = data.CategoryId;
            this.Images      = DependencyResolver.Current.GetService <IGalleryRepository>().FetchGalleryImages(data.GalleryId).Select(gi_ => new GalleryImageModel(gi_)).ToList();
        }
Beispiel #33
0
        private void DataBindMediaPathInGalleriesGridRow(GridViewRowEventArgs e)
        {
            Label lblMediaPath = (Label)e.Row.FindControl("lblMediaPath");

            if (lblMediaPath == null)
            {
                throw new WebException("Cannot find a Label with ID='lblMediaPath' in the current row of the GridView 'gvGalleries'.");
            }

            IGallery         gallery         = (IGallery)e.Row.DataItem;
            IGallerySettings gallerySettings = Factory.LoadGallerySetting(gallery.GalleryId);

            lblMediaPath.Text = gallerySettings.MediaObjectPath;
        }
Beispiel #34
0
        /// <summary>
        /// Gets an <see cref="IGallery" /> representing the current gallery. The return value is the same reference
        /// as the parameter.
        /// </summary>
        /// <param name="gallery">An <see cref="IGallery"/> object to populate with the information about the
        /// current gallery. This parameter is required because the library that implements this interface does not have
        /// the ability to instantiate any object that implements <see cref="IGallery"/>.
        /// information from the data store.</param>
        /// <returns>Returns an <see cref="IGallery" /> representing the current gallery. The returned object is the
        /// same object in memory as the <paramref name="gallery"/> parameter.</returns>
        public override IGallery Gallery_GetCurrentGallery(IGallery gallery)
        {
            using (System.Data.IDataReader dr = GetDataReaderGallerySelect())
            {
                while (dr.Read())
                {
                    gallery.Id           = Convert.ToInt32(dr["GalleryId"]);
                    gallery.Description  = dr["Description"].ToString();
                    gallery.CreationDate = Convert.ToDateTime(dr["DateAdded"]);
                    break;
                }
            }

            return(gallery);
        }
Beispiel #35
0
 public AdmnController(IUser userService,
     IDomain domainService,
     IWebContent webContentService,
     IWebPages webPagesService,
     IECommerce ecommerceService,
     IPOI poiService,
     ITemplate templateService,
     IPortfolio portfolioService,
     IGallery galleryService)
     : base(domainService)
 {
     this.UserService = userService;
     this.DomainService = domainService;
     this.WebContentService = webContentService;
     this.WebPagesService = webPagesService;
     this.ECommerceService = ecommerceService;
     this.POIService = poiService;
     this.TemplateService = templateService;
     this.PortfolioService = portfolioService;
     this.GalleryService = galleryService;
 }
Beispiel #36
0
 public abstract int Gallery_Save(IGallery gallery);
		/// <summary>
		/// Gets an <see cref="IGallery" /> representing the current gallery. The return value is the same reference 
		/// as the parameter.
		/// </summary>
		/// <param name="gallery">An <see cref="IGallery"/> object to populate with the information about the
		/// current gallery. This parameter is required because the library that implements this interface does not have
		/// the ability to instantiate any object that implements <see cref="IGallery"/>.
		/// information from the data store.</param>
		/// <returns>Returns an <see cref="IGallery" /> representing the current gallery. The returned object is the
		/// same object in memory as the <paramref name="gallery"/> parameter.</returns>
		public override IGallery Gallery_GetCurrentGallery(IGallery gallery)
		{
			SQLiteConnection cn = GetDBConnectionForGallery();
			try
			{
				using (SQLiteCommand cmd = cn.CreateCommand())
				{
					const string sql = @"
SELECT GalleryId, Description, DateAdded
FROM [gs_Gallery]
WHERE GalleryId = @GalleryId";
					cmd.CommandText = sql;
					cmd.Parameters.AddWithValue("@GalleryId", ConfigManager.GetGalleryServerProConfigSection().Core.GalleryId);
					if (cn.State == ConnectionState.Closed)
						cn.Open();

					using (IDataReader dr = cmd.ExecuteReader())
					{
						while (dr.Read())
						{
							gallery.Id = Convert.ToInt32(dr["GalleryId"]);
							gallery.Description = dr["Description"].ToString();
							gallery.CreationDate = Convert.ToDateTime(dr["DateAdded"]);
							break;
						}
					}
				}
			}
			finally
			{
				if (!IsTransactionInProgress())
					cn.Dispose();
			}

			return gallery;
		}
 /// <summary>
 /// Permanently delete the specified gallery from the data store, including all related records. This action cannot
 /// be undone.
 /// </summary>
 /// <param name="gallery">The <see cref="IGallery"/> to delete from the data store.</param>
 public override void Gallery_Delete(IGallery gallery)
 {
     GalleryData.DeleteGallery(gallery);
 }
Beispiel #39
0
		/// <summary>
		/// Gets an <see cref="IGallery" /> representing the current gallery. The return value is the same reference 
		/// as the parameter.
		/// </summary>
		/// <param name="gallery">An <see cref="IGallery"/> object to populate with the information about the
		/// current gallery. This parameter is required because the library that implements this interface does not have
		/// the ability to instantiate any object that implements <see cref="IGallery"/>.
		/// information from the data store.</param>
		/// <returns>Returns an <see cref="IGallery" /> representing the current gallery. The returned object is the
		/// same object in memory as the <paramref name="gallery"/> parameter.</returns>
		public override IGallery Gallery_GetCurrentGallery(IGallery gallery)
		{
			using (System.Data.IDataReader dr = GetDataReaderGallerySelect())
			{
				while (dr.Read())
				{
					gallery.Id = Convert.ToInt32(dr["GalleryId"]);
					gallery.Description = dr["Description"].ToString();
					gallery.CreationDate = Convert.ToDateTime(dr["DateAdded"]);
					break;
				}
			}

			return gallery;
		}
        /// <summary>
        /// Persist the specified gallery to the data store. Return the ID of the gallery.
        /// </summary>
        /// <param name="gallery">An instance of <see cref="IGallery"/> to persist to the data store.</param>
        /// <returns>
        /// Return the ID of the gallery. If this is a new gallery and a new ID has been
        /// assigned, then this value has also been assigned to the <see cref="IGallery.GalleryId"/> property.
        /// </returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="gallery" /> is null.</exception>		/// 
        public override int Gallery_Save(IGallery gallery)
        {
            if (gallery == null)
                throw new ArgumentNullException("gallery");

            using (GspContext ctx = new GspContext())
            {
                if (gallery.IsNew)
                {
                    GalleryDto galleryDto = new GalleryDto { Description = gallery.Description, DateAdded = gallery.CreationDate };

                    ctx.Galleries.Add(galleryDto);
                    ctx.SaveChanges();

                    // Assign newly created gallery ID.
                    gallery.GalleryId = galleryDto.GalleryId;
                }
                else
                {
                    var galleryDto = ctx.Galleries.Find(gallery.GalleryId);

                    if (galleryDto != null)
                    {
                        galleryDto.Description = gallery.Description;
                        ctx.SaveChanges();
                    }
                    else
                    {
                        throw new DataException(String.Format(CultureInfo.CurrentCulture, "Cannot save gallery: No existing gallery with Gallery ID {0} was found in the database.", gallery.GalleryId));
                    }
                }
            }

            return gallery.GalleryId;
        }
Beispiel #41
0
 public Gallery(IGallery gallery)
 {
     GalleryName = gallery.GalleryName;
     GalleryDiscription = gallery.GalleryDiscription;
     GalleryPhoto = gallery.GalleryPhoto;
 }
 public void PlaySlideshow(IGallery gallery, Func<int> calculateDisplaySeconds)
 {
     PlaySlideshow(gallery.Pictures, calculateDisplaySeconds());
 }
 public void UpdateGallery(IGallery gal)
 {
     _gm.UpdateGallery(gal);
 }
        /// <summary>
        /// Permanently delete the specified gallery from the data store, including all related records. This action cannot
        /// be undone.
        /// </summary>
        /// <param name="gallery">The <see cref="IGallery"/> to delete from the data store.</param>
        public override void Gallery_Delete(IGallery gallery)
        {
            using (GspContext ctx = new GspContext())
            {
                // Delete gallery. Cascade delete rules in DB will delete related records.
                GalleryDto galleryDto = (from g in ctx.Galleries where g.GalleryId == gallery.GalleryId select g).FirstOrDefault();

                if (galleryDto != null)
                {
                    ctx.Galleries.Remove(galleryDto);
                    ctx.SaveChanges();
                }
            }
        }
        /// <summary>
        /// Sets the media object path for the new gallery to the path of the current gallery. The change is persisted to the data store.
        /// </summary>
        /// <param name="gallery">The gallery.</param>
        private void SetMediaObjectPathForNewGallery(IGallery gallery)
        {
            IGallerySettings gallerySettings = Factory.LoadGallerySetting(gallery.GalleryId, true);

            gallerySettings.MediaObjectPath = GallerySettings.MediaObjectPath;
            gallerySettings.ThumbnailPath = GallerySettings.ThumbnailPath;
            gallerySettings.OptimizedPath = GallerySettings.OptimizedPath;

            gallerySettings.Save();
        }
Beispiel #46
0
        /// <summary>
        /// Persist the specified gallery to the data store. Return the ID of the gallery.
        /// </summary>
        /// <param name="gallery">An instance of <see cref="IGallery"/> to persist to the data store.</param>
        /// <returns>
        /// Return the ID of the gallery. If this is a new gallery and a new ID has been
        /// assigned, then this value has also been assigned to the <see cref="IGallery.GalleryId"/> property.
        /// </returns>
        internal static int SaveGallery(IGallery gallery)
        {
            int galleryId = gallery.GalleryId;

            using (SqlConnection cn = SqlDataProvider.GetDbConnection())
            {
                if (gallery.IsNew)
                {
                    // Insert new record into Gallery table.
                    using (SqlCommand cmd = GetCommandGalleryInsert(cn))
                    {
                        cmd.Parameters["@Description"].Value = gallery.Description;
                        cmd.Parameters["@DateAdded"].Value = gallery.CreationDate;

                        cn.Open();
                        cmd.ExecuteNonQuery();

                        galleryId = Convert.ToInt32(cmd.Parameters["@Identity"].Value, NumberFormatInfo.InvariantInfo);
                        gallery.GalleryId = galleryId;
                    }
                }
                else
                {
                    using (SqlCommand cmd = GetCommandGalleryUpdate(cn))
                    {
                        cmd.Parameters["@GalleryId"].Value = gallery.GalleryId;
                        cmd.Parameters["@Description"].Value = gallery.Description;

                        cn.Open();
                        cmd.ExecuteNonQuery();
                    }
                }
            }

            return galleryId;
        }
        private void VerifyUserHasGalleryAdminPermission(IGallery newGallery)
        {
            // If the current user is only a gallery admin, she won't have access to the new gallery, so we need to add the
            // new gallery to the gallery admin role she is in.
            if (!UserCanAdministerSite && UserCanAdministerGallery)
            {
                foreach (IGalleryServerRole role in RoleController.GetGalleryServerRolesForUser())
                {
                    if (role.AllowAdministerGallery)
                    {
                        IAlbum rootAlbum = Factory.LoadRootAlbumInstance(newGallery.GalleryId);

                        if (!role.RootAlbumIds.Contains(rootAlbum.Id))
                        {
                            role.RootAlbumIds.Add(rootAlbum.Id);
                            role.Save();
                        }
                        break;
                    }
                }
            }
        }
Beispiel #48
0
		/// <summary>
		/// Gets an <see cref="IGallery" /> representing the current gallery. The return value is the same reference 
		/// as the parameter.
		/// </summary>
		/// <param name="gallery">An <see cref="IGallery"/> object to populate with the information about the
		/// current gallery. This parameter is required because the library that implements this interface does not have
		/// the ability to instantiate any object that implements <see cref="IGallery"/>.
		/// information from the data store.</param>
		/// <returns>Returns an <see cref="IGallery" /> representing the current gallery. The returned object is the
		/// same object in memory as the <paramref name="gallery"/> parameter.</returns>
		public abstract IGallery Gallery_GetCurrentGallery(IGallery gallery);
Beispiel #49
0
 /// <summary>
 /// Configure the specified <paramref name="gallery"/> by verifying that a default set of
 /// records exist in the supporting tables (gs_Album, gs_GallerySetting, gs_MimeTypeGallery, gs_Synchronize, gs_Role_Album).
 /// No changes are made to the file system as part of this operation. This method does not overwrite existing data, but it
 /// does insert missing data. This function can be used during application initialization to validate the data integrity for
 /// a gallery. For example, if the user has added a record to the MIME types or template gallery settings tables, this method
 /// will ensure that the new records are associated with the gallery identified in <paramref name="gallery"/>.
 /// </summary>
 /// <param name="gallery">The gallery to configure.</param>
 /// <exception cref="ArgumentNullException">Thrown when <paramref name="gallery" /> is null.</exception>
 public abstract void Gallery_Configure(IGallery gallery);
        /// <summary>
        /// Configure the specified <paramref name="gallery"/> by verifying that a default set of
        /// records exist in the supporting tables (gs_Album, gs_GallerySetting, gs_MimeTypeGallery, gs_Synchronize, gs_Role_Album).
        /// No changes are made to the file system as part of this operation. This method does not overwrite existing data, but it
        /// does insert missing data. This function can be used during application initialization to validate the data integrity for
        /// a gallery. For example, if the user has added a record to the MIME types or template gallery settings tables, this method
        /// will ensure that the new records are associated with the gallery identified in <paramref name="gallery"/>.
        /// </summary>
        /// <param name="gallery">The gallery to configure.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="gallery" /> is null.</exception>
        public override void Gallery_Configure(IGallery gallery)
        {
            if (gallery == null)
                throw new ArgumentNullException("gallery");

            GalleryData.ConfigureGallery(gallery.GalleryId);
        }
Beispiel #51
0
 /// <summary>
 /// Permanently delete the specified gallery from the data store, including all related records. This action cannot
 /// be undone.
 /// </summary>
 /// <param name="gallery">The <see cref="IGallery"/> to delete from the data store.</param>
 public abstract void Gallery_Delete(IGallery gallery);
 /// <summary>
 /// Persist the specified gallery to the data store. Return the ID of the gallery.
 /// </summary>
 /// <param name="gallery">An instance of <see cref="IGallery"/> to persist to the data store.</param>
 /// <returns>
 /// Return the ID of the gallery. If this is a new gallery and a new ID has been
 /// assigned, then this value has also been assigned to the <see cref="IGallery.GalleryId"/> property.
 /// </returns>
 public override int Gallery_Save(IGallery gallery)
 {
     return GalleryData.SaveGallery(gallery);
 }
        /// <summary>
        /// Gets all the gallery server roles that apply to the specified <paramref name="gallery" />.
        /// </summary>
        /// <param name="gallery">The gallery.</param>
        /// <returns>Returns an <see cref="IGalleryServerRoleCollection"/> representing the roles that apply to the specified 
        /// <paramref name="gallery" />.</returns>
        public static IGalleryServerRoleCollection GetGalleryServerRolesForGallery(IGallery gallery)
        {
            IGalleryServerRoleCollection roles = new GalleryServerRoleCollection();

            foreach (IGalleryServerRole role in GetGalleryServerRoles())
            {
                if (role.Galleries.Contains(gallery) && (!roles.Contains(role)))
                {
                    roles.Add(role);
                }
            }

            return roles;
        }
 public void AddGallery(IGallery gal)
 {
     _gm.AddGallery(gal);
 }
 public void PlaySlideshow(IGallery gallery, int displaySeconds)
 {
     PlaySlideshow(gallery.Pictures, () => displaySeconds);
 }
 public void Load(IGallery gallery)
 {
     Load(gallery.Pictures);
 }
 public void RemoveGallery(IGallery gal)
 {
     _gm.RemoveGallery(gal);
 }