예제 #1
0
        public void PopulateContractAllocations(
            string conRefNum,
            int deliverableCode,
            CancellationToken cancellationToken,
            int?ukPrn)
        {
            var contractAllocation =
                _fcsRepository.GetContractAllocation(conRefNum, deliverableCode, cancellationToken, ukPrn);

            if (contractAllocation != null &&
                !ContractAllocations.Any(ca =>
                                         ca.ContractAllocationNumber.CaseInsensitiveEquals(contractAllocation.ContractAllocationNumber) &&
                                         ca.DeliverableCode == contractAllocation.DeliverableCode &&
                                         ca.StartDate == contractAllocation.StartDate &&
                                         ca.EndDate == contractAllocation.EndDate))
            {
                ContractAllocations.Add(contractAllocation);
            }
        }
        public ContractAllocationCacheModel GetContractAllocation(
            string conRefNum,
            int deliverableCode,
            CancellationToken cancellationToken,
            long?ukPrn = null)
        {
            if (ukPrn != null && !ContractAllocations
                .Any(ca => ca.DeliverableCode == deliverableCode &&
                     ca.ContractAllocationNumber == conRefNum))
            {
                var contractAllocation =
                    _referenceDataRepository.GetContractAllocation(conRefNum, deliverableCode, cancellationToken, ukPrn);

                if (contractAllocation != null)
                {
                    ContractAllocations.Add(contractAllocation);
                }
            }

            return(ContractAllocations?.FirstOrDefault(ca => ca.DeliverableCode == deliverableCode &&
                                                       ca.ContractAllocationNumber == conRefNum));
        }