コード例 #1
0
ファイル: KitMicroService.cs プロジェクト: rgtodd/quiltsystem
        public async Task <MKit_Kit> GetKitDetailFromDesignAsync(string userId, Guid designId, int thumbnailSize)
        {
            using var log = BeginFunction(nameof(KitMicroService), nameof(GetKitDetailFromDesignAsync), userId, designId, thumbnailSize);
            try
            {
                await Assert(SecurityPolicy.IsAuthorized, userId).ConfigureAwait(false);

                var mDesign = await DesignMicroService.GetDesignAsync(designId).ConfigureAwait(false);

                if (mDesign == null)
                {
                    log.Result(null);
                    return(null);
                }

                var result = Create.MKit_Kit(mDesign, thumbnailSize, InventoryMicroService);

                log.Result(result);
                return(result);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
                throw;
            }
        }
コード例 #2
0
ファイル: KitMicroService.cs プロジェクト: rgtodd/quiltsystem
        public async Task <MKit_Kit> GetKitDetailPreviewFromDesignAsync(string userId, Guid designId, int thumbnailSize, MKit_KitSpecificationUpdate specificationUpdate)
        {
            using var log = BeginFunction(nameof(KitMicroService), nameof(GetKitDetailPreviewFromDesignAsync), userId, designId, thumbnailSize, specificationUpdate);
            try
            {
                await Assert(SecurityPolicy.IsAuthorized, userId).ConfigureAwait(false);

                var mDesign = await DesignMicroService.GetDesignAsync(designId).ConfigureAwait(false);

                if (mDesign == null)
                {
                    log.Result(null);
                    return(null);
                }

                var design = new Design.Core.Design(JToken.Parse(mDesign.DesignArtifactValue));

                var kit           = new Kit(design, new KitSpecification());
                var specification = kit.KitSpecification.Clone();
                var standardSizes = kit.Design.GetStandardSizes();

                var serviceErrorBuilder = new ServiceErrorBuilder();
                UpdateSpecification(specification, specificationUpdate, standardSizes, serviceErrorBuilder);

                kit.KitSpecification = specification;

                var result = Create.MKit_Kit(kit, "New", null, designId, thumbnailSize, InventoryMicroService);
                if (serviceErrorBuilder.ServiceError != null)
                {
                    serviceErrorBuilder.AddPageError("One or more input values are incorrect.");
                    result.ServiceError = serviceErrorBuilder.ServiceError;
                }

                log.Result(result);
                return(result);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
                throw;
            }
        }