public override PhotoResourceDto Persist(PhotoResourceDto photoResourceDto) { Gallery gallery = _galleryDao.FindSingle(new GalleryFilterDto() { OwnerId = photoResourceDto.UserDefinableOwnerId }); bool automaticCoverPhotoSet = false; if (gallery == null) { gallery = CreateAndPersistEmptyProfileGallery(photoResourceDto.UserDefinableOwnerId); automaticCoverPhotoSet = true; } photoResourceDto.UserDefinableId = gallery.Id; PhotoThumbnailInfo photoThumbnailInfo = PhotoThumbnailInfoProvider.GetDefault(photoResourceDto.OwnerType); photoResourceDto.Path = string.Format(photoThumbnailInfo.Path, photoResourceDto.UserDefinableOwnerId, photoResourceDto.UserDefinableId); photoResourceDto = base.Persist(photoResourceDto); if (automaticCoverPhotoSet) { gallery.CoverPhotoId = photoResourceDto.Id; _genericDao.Persist <Gallery>(gallery); } return(photoResourceDto); }
private void GeneratePaintingImage(Document document, Painting painting, Cell cell) { Gallery gallery = _galleryDao.FindSingle(new GalleryFilterDto() { OwnerId = painting.Id }); if (gallery == null) { return; } if (gallery.CoverPhotoId == null) { return; } Resource resource = gallery.CoverPhoto; string imagePath = PhotoResourceDto.GetAbsoluteThumbnailFilePath(resource.Path, resource.Name); InlineShape inlineShape = cell.Range.InlineShapes.AddPicture(imagePath); inlineShape.LockAspectRatio = MsoTriState.msoTrue; inlineShape.Width = 180f; }