示例#1
0
        public async Task CreateNewCompoundImage(Guid mapId, IList <Guid> imageIds)
        {
            var nextImageId = await _mapsAnalyser.SelectNextImageId(mapId, imageIds);

            if (await CompoundImageAlreadyExists(mapId, imageIds))
            {
                return;
            }
            if (nextImageId == Guid.Empty)
            {
                return;
            }

            imageIds.Add(nextImageId);

            var compoundImage = new CompoundImage {
                MapId = mapId
            };
            await _compoundImagesRepository.InsertCompoundImage(compoundImage);

            foreach (var imageId in imageIds)
            {
                await _compoundImageMappingsRepository.InsertCompoundImageMapping(imageId, compoundImage.Id);
            }

            var queueCompoundImage = new KeyedCompoundImage
            {
                CompoundImageId = compoundImage.Id,
                ImageKey        = await GetCompoundKeyFromImageIds(imageIds),
                MapId           = mapId,
                Images          = await GetCompoundImagePartsFromIds(imageIds)
            };

            await _queueAdapter.SendMessage(queueCompoundImage, "compound-image");
        }
示例#2
0
 public async Task InsertCompoundImage(CompoundImage compoundImage)
 => await _connection.ExecuteAsync("INSERT INTO [dbo].[CompoundImages] ([Id], [MapId], [UploadedDate]) VALUES (@Id, @MapId, @UploadedDate)", new { compoundImage.Id, compoundImage.MapId, compoundImage.UploadedDate });