当前位置: 首页>>代码示例>>C#>>正文


C# IGalleryObject.Save方法代码示例

本文整理汇总了C#中IGalleryObject.Save方法的典型用法代码示例。如果您正苦于以下问题:C# IGalleryObject.Save方法的具体用法?C# IGalleryObject.Save怎么用?C# IGalleryObject.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IGalleryObject的用法示例。


在下文中一共展示了IGalleryObject.Save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SaveGalleryObject

		/// <summary>
		/// Persist the gallery object to the data store. This method updates the audit fields before saving. All gallery objects should be
		/// saved through this method rather than directly invoking the gallery object's Save method, unless you want to
		/// manually update the audit fields yourself.
		/// </summary>
		/// <param name="galleryObject">The gallery object to persist to the data store.</param>
		/// <param name="userName">The user name to be associated with the modifications. This name is stored in the internal
		/// audit fields associated with this gallery object.</param>
		public static void SaveGalleryObject(IGalleryObject galleryObject, string userName)
		{
			DateTime currentTimestamp = DateTime.Now;

			if (galleryObject.IsNew)
			{
				galleryObject.CreatedByUserName = userName;
				galleryObject.DateAdded = currentTimestamp;
			}

			if (galleryObject.HasChanges)
			{
				galleryObject.LastModifiedByUserName = userName;
				galleryObject.DateLastModified = currentTimestamp;
			}

			// Verify that any role needed for album ownership exists and is properly configured.
			RoleController.ValidateRoleExistsForAlbumOwner(galleryObject as IAlbum);

			// Persist to data store.
			galleryObject.Save();
		}
开发者ID:haimon74,项目名称:KanNaim,代码行数:30,代码来源:GalleryObjectController.cs

示例2: UpdateExistingMediaObject

        private void UpdateExistingMediaObject(IAlbum album, IGalleryObject mediaObject)
        {
            if (mediaObject.Parent.Id != album.Id)
            {
                mediaObject.Parent = album;
            }

            // If the generated hash key is the same as the one already assigned, then do nothing. Otherwise,
            // generate a guaranteed unique hash key with the GetHashKeyUnique function.
            if (mediaObject.Hashkey != HelperFunctions.GetHashKey(mediaObject.Original.FileInfo))
            {
                mediaObject.Hashkey = HelperFunctions.GetHashKeyUnique(mediaObject.Original.FileInfo);
            }

            // Check for existence of thumbnail.
            if (!File.Exists(mediaObject.Thumbnail.FileNamePhysicalPath))
            {
                mediaObject.RegenerateThumbnailOnSave = true;
            }

            Image image = mediaObject as Image;
            if (image != null)
            {
                EvaluateOriginalImage(image);

                EvaluateOptimizedImage(image);
            }
            else
            {
                UpdateNonImageWidthAndHeight(mediaObject);
            }

            HelperFunctions.UpdateAuditFields(mediaObject, this._userName);
            mediaObject.Save();
            mediaObject.IsSynchronized = true;
        }
开发者ID:xusun,项目名称:GalleryServerPro,代码行数:36,代码来源:SynchronizationManager.cs

示例3: SaveGalleryObject

		/// <summary>
		/// Persist the gallery object to the data store. This method updates the audit fields before saving. All gallery objects should be
		/// saved through this method rather than directly invoking the gallery object's Save method, unless you want to 
		/// manually update the audit fields yourself.
		/// </summary>
		/// <param name="galleryObject">The gallery object to persist to the data store.</param>
		public static void SaveGalleryObject(IGalleryObject galleryObject)
		{
			string currentUser = HttpContext.Current.User.Identity.Name;
			DateTime currentTimestamp = DateTime.Now;

			if (galleryObject.IsNew)
			{
				galleryObject.CreatedByUserName = currentUser;
				galleryObject.DateAdded = currentTimestamp;
			}

			if (galleryObject.HasChanges)
			{
				galleryObject.LastModifiedByUserName = currentUser;
				galleryObject.DateLastModified = currentTimestamp;
			}

			galleryObject.Save();
		}
开发者ID:haimon74,项目名称:KanNaim,代码行数:25,代码来源:WebController.cs

示例4: UpdateExistingMediaObject

        private void UpdateExistingMediaObject(IGalleryObject mediaObject)
        {
            mediaObject.RegenerateThumbnailOnSave = RebuildThumbnail;
            mediaObject.RegenerateOptimizedOnSave = RebuildOptimized;

            // Check for existence of thumbnail.
            if (!File.Exists(mediaObject.Thumbnail.FileNamePhysicalPath))
            {
                mediaObject.RegenerateThumbnailOnSave = true;
            }

            switch (mediaObject.GalleryObjectType)
            {
                case GalleryObjectType.Image:
                    EvaluateOriginalImage((Image)mediaObject);
                    EvaluateOptimizedImage((Image)mediaObject);
                    break;

                case GalleryObjectType.Video:
                case GalleryObjectType.Audio:
                    EvaluateOptimizedVideoAudio(mediaObject);
                    break;

                default:
                    UpdateNonImageWidthAndHeight(mediaObject);
                    break;
            }

            UpdateMetadataFilename(mediaObject);

            HelperFunctions.UpdateAuditFields(mediaObject, UserName);
            mediaObject.Save();
            mediaObject.IsSynchronized = true;
        }
开发者ID:Jiyuu,项目名称:galleryserverpro,代码行数:34,代码来源:SynchronizationManager.cs


注:本文中的IGalleryObject.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。