本文整理汇总了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();
}
示例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;
}
示例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();
}
示例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;
}