private void AddStateOfImportIds(Draft.StateOfImport stateOfImport, TransportRouteIdContainer idContainer)
 {
     if (stateOfImport != null)
     {
         idContainer.AddCompetentAuthority(stateOfImport.CompetentAuthorityId);
         idContainer.AddEntryOrExitPoint(stateOfImport.EntryPointId);
     }
 }
 private void AddTransitStateIds(Draft.TransitStateCollection transitStateCollection,
     TransportRouteIdContainer idContainer)
 {
     if (transitStateCollection != null && transitStateCollection.TransitStates != null)
     {
         idContainer.AddCompetentAuthorities(transitStateCollection.TransitStates.Select(ts => ts.CompetentAuthorityId));
         idContainer.AddEntryOrExitPoints(transitStateCollection.TransitStates.Select(ts => ts.EntryPointId));
         idContainer.AddEntryOrExitPoints(transitStateCollection.TransitStates.Select(ts => ts.ExitPointId));
     }
 }
        public async Task<IEnumerable<Domain.NotificationApplication.WasteCode>> GetWasteCodesLookup(Draft.WasteType wasteType)
        {
            var wasteCodeIds = new List<Guid>();

            wasteCodeIds.AddRange(GetWasteCodeIdsToLookup(wasteType.SelectedEwcCodes));
            wasteCodeIds.AddRange(GetWasteCodeIdsToLookup(wasteType.SelectedHCodes));
            wasteCodeIds.AddRange(GetWasteCodeIdsToLookup(wasteType.SelectedUnClasses));
            wasteCodeIds.AddRange(GetWasteCodeIdsToLookup(wasteType.SelectedYCodes));

            if (wasteType.SelectedBaselCode.HasValue)
            {
                wasteCodeIds.Add(wasteType.SelectedBaselCode.Value);
            }

            return await wasteCodeRepository.GetWasteCodesByIds(wasteCodeIds);
        }
        private StateOfExport GenerateStateOfExport(Draft.StateOfExport stateOfExport,
            TransportRouteLookups lookups)
        {
            var returnValue = new StateOfExport();

            if (stateOfExport.CompetentAuthorityId.HasValue)
            {
                var competentAuthority = lookups.GetCompetentAuthority(stateOfExport.CompetentAuthorityId);

                returnValue.CompetentAuthorityName = competentAuthority.Name;
                returnValue.CompetentAuthorityCode = competentAuthority.Code;
            }

            if (stateOfExport.CountryId.HasValue)
            {
                returnValue.CountryName = lookups.GetCountry(stateOfExport.CountryId).Name;
            }

            if (stateOfExport.ExitPointId.HasValue)
            {
                returnValue.ExitPointName = lookups.GetEntryOrExitPoint(stateOfExport.ExitPointId).Name;
            }

            return returnValue;
        }
        private TransitState GenerateTransitState(Draft.TransitState transitState, TransportRouteLookups lookups)
        {
            var returnValue = new TransitState();

            if (transitState.CompetentAuthorityId.HasValue)
            {
                var competentAuthority = lookups.GetCompetentAuthority(transitState.CompetentAuthorityId);

                returnValue.CompetentAuthorityCode = competentAuthority.Code;
                returnValue.CompetentAuthorityName = competentAuthority.Name;
            }

            if (transitState.CountryId.HasValue)
            {
                returnValue.CountryName = lookups.GetCountry(transitState.CountryId).Name;
            }

            if (transitState.EntryPointId.HasValue)
            {
                returnValue.EntryPointName = lookups.GetEntryOrExitPoint(transitState.EntryPointId).Name;
            }

            if (transitState.ExitPointId.HasValue)
            {
                returnValue.ExitPointName = lookups.GetEntryOrExitPoint(transitState.ExitPointId).Name;
            }

            return returnValue;
        }
        private IList<TransitState> GenerateTransitStates(Draft.TransitStateCollection transitStates,
            TransportRouteLookups lookups)
        {
            if (transitStates == null || transitStates.TransitStates == null || transitStates.HasNoTransitStates)
            {
                return new TransitState[0];
            }

            return transitStates.TransitStates.Select(ts => GenerateTransitState(ts, lookups)).ToArray();
        }