Esempio n. 1
0
        public async Task <string> CreateReportAsync(
            ServiceParityResult parityResult,
            CostEstimationResult costEstimationResult)
        {
            var targetRegion = costEstimationResult.TargetRegion;

            var regionInfo = await GetRegionInfoAsync(targetRegion);

            // Create a MigraDoc document and initialize the page setting
            var documentInfo = new DocumentInfo();

            // Introduction Section
            var introSection = documentInfo.CreateIntroSection();

            // Migration Summary Section
            CreateMigrationSummarySection(
                ref documentInfo,
                regionInfo,
                costEstimationResult,
                parityResult);

            // Service Parity Result
            CreateAppendixServiceParityResultSection(
                ref documentInfo,
                parityResult,
                costEstimationResult);

            // TODO: extract common parameters for creating section
            var needCostEstimation = !costEstimationResult.Details.All(d => d.EstimatedCost == null) || costEstimationResult.HasError;

            if (needCostEstimation)
            {
                // Cost Estimation Section
                CreateCostEstimationSection(
                    ref documentInfo,
                    regionInfo,
                    costEstimationResult);
            }

            // Appendix Full Resource List
            CreateAppendixResouceListSection(
                ref documentInfo,
                regionInfo,
                costEstimationResult);

            // Conclusion Section
            documentInfo.CreateConclusionSection();

            // Making TOC
            AppendTOCToIntroductionSection(
                ref introSection,
                costEstimationResult.SubscriptionName,
                needCostEstimation);

            return(documentInfo.MakePDF());
        }