示例#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);
            }
        }
示例#2
0
        public ContractAllocationCacheModel GetContractAllocation(
            string conRefNum,
            int deliverableCode,
            CancellationToken cancellationToken,
            int?ukPrn = null)
        {
            if (ukPrn == null ||
                ContractAllocations.Any(ca => ca.DeliverableCode == deliverableCode &&
                                        ca.ContractAllocationNumber.CaseInsensitiveEquals(conRefNum)))
            {
                return(ContractAllocations?.FirstOrDefault(ca => ca.DeliverableCode == deliverableCode &&
                                                           ca.ContractAllocationNumber.CaseInsensitiveEquals(conRefNum)));
            }

            PopulateContractAllocations(conRefNum, deliverableCode, cancellationToken, ukPrn);

            return(ContractAllocations?.FirstOrDefault(ca => ca.DeliverableCode == deliverableCode &&
                                                       ca.ContractAllocationNumber.CaseInsensitiveEquals(conRefNum)));
        }
        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));
        }