protected virtual bool HasNoProfilingChanges(PublishedProviderVersion priorState,
                                                     PublishedProviderVersion refreshState,
                                                     ProviderVariationContext providerVariationContext)
        {
            IDictionary <string, FundingLine> latestFundingLines =
                refreshState.FundingLines.Where(_ => _.Type == FundingLineType.Payment)
                .ToDictionary(_ => _.FundingLineCode);

            bool hasNoProfilingChanges = true;

            foreach (FundingLine previousFundingLine in priorState.FundingLines.Where(_ => _.Type == FundingLineType.Payment &&
                                                                                      _.Value.HasValue &&
                                                                                      ExtraFundingLinePredicate(refreshState, _)))
            {
                string fundingLineCode = previousFundingLine.FundingLineCode;

                if (!latestFundingLines.TryGetValue(fundingLineCode, out FundingLine latestFundingLine))
                {
                    continue;
                }

                ProfilePeriod[] priorProfiling  = new YearMonthOrderedProfilePeriods(previousFundingLine).ToArray();
                ProfilePeriod[] latestProfiling = new YearMonthOrderedProfilePeriods(latestFundingLine).ToArray();

                if (!priorProfiling.Select(AsLiteral)
                    .SequenceEqual(latestProfiling.Select(AsLiteral)))
                {
                    providerVariationContext.AddAffectedFundingLineCode(fundingLineCode);

                    hasNoProfilingChanges = false;
                }
            }

            return(hasNoProfilingChanges);
        }
Beispiel #2
0
        private bool HasNoCarryOverChanges(PublishedProviderVersion priorState,
                                           PublishedProviderVersion refreshState,
                                           ProviderVariationContext providerVariationContext)
        {
            bool hasNoCarryOverChanges = true;

            foreach (ProfilingCarryOver carryOver in priorState.CarryOvers ?? ArraySegment <ProfilingCarryOver> .Empty)
            {
                ProfilingCarryOver latestCustomProfile = refreshState.CarryOvers?.SingleOrDefault(_ => _.FundingLineCode == carryOver.FundingLineCode);

                if ((latestCustomProfile?.Amount).GetValueOrDefault() != carryOver.Amount)
                {
                    providerVariationContext.AddAffectedFundingLineCode(carryOver.FundingLineCode);

                    hasNoCarryOverChanges = false;
                }
            }

            return(hasNoCarryOverChanges);
        }