Ejemplo n.º 1
0
        private static RegionToSubclass[] BuildRegionsToTypes(IEnumerable <AirportCoordinates> eanAirportsCoordinates,
                                                              IReadOnlyDictionary <long, int> expediaAirportIdsToIds,
                                                              int subClassAirportId,
                                                              int creatorId
                                                              )
        {
            var regionsToTypes = new Queue <RegionToSubclass>();

            foreach (var entity in eanAirportsCoordinates)
            {
                if (!expediaAirportIdsToIds.TryGetValue(entity.AirportID, out var id))
                {
                    continue;
                }

                var regionToType = new RegionToSubclass
                {
                    Id        = id,
                    ToId      = subClassAirportId,
                    CreatorId = creatorId
                };

                regionsToTypes.Enqueue(regionToType);
            }
            return(regionsToTypes.ToArray());
        }
Ejemplo n.º 2
0
        protected RegionToSubclass[] BuildRegionsToSubclasses(
            ICollection <long> regionsExpediaIds,
            IReadOnlyDictionary <long, int> expediaIdsToIds,
            int subClassId,
            int creatorId
            )
        {
            var regionsToSubclasses = new Queue <RegionToSubclass>();

            foreach (var regionExpediaId in regionsExpediaIds)
            {
                if (!expediaIdsToIds.TryGetValue(regionExpediaId, out var id))
                {
                    continue;
                }
                var regionToSubclass = new RegionToSubclass
                {
                    Id   = id,
                    ToId = subClassId,
                    //  SubclassId = subclassId,
                    CreatorId = creatorId
                };

                regionsToSubclasses.Enqueue(regionToSubclass);
            }

            return(regionsToSubclasses.ToArray());
        }
Ejemplo n.º 3
0
        protected RegionToSubclass[] BuildRegionsToSubclasses(IEnumerable <IHaveRegionId> expediaDataTransferObjects,
                                                              IReadOnlyDictionary <long, int> expediaIdsToIds,
                                                              int subClassId,
                                                              int creatorId
                                                              )
        {
            var regionsToTypes = new Queue <RegionToSubclass>();

            Parallel.ForEach(expediaDataTransferObjects, eanEntity =>
            {
                if (!expediaIdsToIds.TryGetValue(eanEntity.RegionID, out var id))
                {
                    return;
                }

                var regionToType = new RegionToSubclass
                {
                    Id        = id,
                    ToId      = subClassId,
                    CreatorId = creatorId
                };

                lock (LockMe)
                {
                    regionsToTypes.Enqueue(regionToType);
                }
            });

            return(regionsToTypes.ToArray());
        }