public IEnumerable<ZipCodeData> GetZips(int range)
        {
            List<ZipCodeData> lstZipCodeData = null;
            if (!String.IsNullOrWhiteSpace(this.zip))
            {
                IZipCodeRepository zipCodeRepository = new ZipCodeRepository();
                IEnumerable<ZipCode> zipCodeList = zipCodeRepository.GetZipsForRange(new ZipCode
                {
                    Zip = this.zip
                }, range);

                if (zipCodeList != null)
                {
                    lstZipCodeData = new List<ZipCodeData>();
                    foreach (ZipCode zipCode in zipCodeList)
                    {
                        lstZipCodeData.Add(new ZipCodeData
                        {
                            ZipCode = zipCode.Zip,
                            City = zipCode.City,
                            State = zipCode.State.Abbreviation
                        });
                    }
                }
            }
            return lstZipCodeData;
        }
        public IEnumerable<ZipCodeData> GetZips(int range)
        {
            List<ZipCodeData> zipCodeData = new List<ZipCodeData>();

            if (_ZipCodeEntity != null)

            {
                IZipCodeRepository zipCodeRepository = new ZipCodeRepository();

                IEnumerable<ZipCode> zips = zipCodeRepository.GetZipsForRange(_ZipCodeEntity, range);


                if (zips != null)
                {
                    foreach (var zipCode in zips)
                    {
                        zipCodeData.Add(new ZipCodeData()
                        {
                            ZipCode = zipCode.Zip,
                            City = zipCode.City,
                            State = zipCode.State.Abbreviation
                        });
                    }
                }
            }
            return zipCodeData;
        
    }
        public IEnumerable<ZipCodeData> GetZips(int range)
        {
            List<ZipCodeData> zipCodeData = new List<ZipCodeData>();

            if (this.zipCodeEntity != null)
            {
                IZipCodeRepository zipCodeRepository = new ZipCodeRepository();

                IEnumerable<ZipCode> zips = zipCodeRepository.GetZipsForRange(this.zipCodeEntity, range);

                if (zips != null)
                {
                    foreach (var zipCode in zips)
                    {
                        zipCodeData.Add(new ZipCodeData()
                        {
                            City = zipCode.City,
                            State = zipCode.State.Abbreviation,
                            ZipCode = zipCode.Zip
                        });
                    }
                }
            }
            //            else
            //            {
            //                throw new ApplicationException("Uh oh");
            //            }

            return zipCodeData;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Spatial Linq query.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <returns>The ZipCodeEntry instances that are within 2km from the point of reference</returns>
        public async Task <IList <ZipCodeEntry> > ZipSearch(ZipEntrySearchInput input)
        {
            // Use New York as point of reference if not provided.
            var samplePoint = NewYorkPoint;

            if (input.Latitude.HasValue && input.Longitude.HasValue)
            {
                samplePoint = new Point(input.Longitude.Value, input.Latitude.Value);
            }

            var zipRepo    = new ZipCodeRepository();
            var zipsWithin = await zipRepo.GetItemsAsync(ze => ze.Location.Distance(samplePoint) < 2000, enableScanInQuery : true);

            return(zipsWithin.ToList());
        }
        public ZipCodeData GetZipInfo()
        {
            ZipCodeData zipCodeData = null;
            if (!String.IsNullOrWhiteSpace(this.zip))
            {
                IZipCodeRepository zipCodeRepository = new ZipCodeRepository();

                ZipCode zipCode = zipCodeRepository.GetByZip(this.zip);
                if (zipCode != null)
                {
                    zipCodeData.City = zipCode.City;
                    zipCodeData.ZipCode = zipCode.Zip;
                    zipCodeData.State = zipCode.State.Abbreviation;
                }
            }

            return zipCodeData;
        }
Ejemplo n.º 6
0
        public IEnumerable<ZipCodeData> GetZips(int range)
        {
            List<ZipCodeData> stateFulzipCodeData = new List<ZipCodeData>();

            if (this._StateFulZipCodeEntity != null)
            {
                IZipCodeRepository stateFulzipCodeRepo = new ZipCodeRepository();
                IEnumerable<ZipCode> stateFulZips = stateFulzipCodeRepo.GetZipsForRange(this._StateFulZipCodeEntity, range);
                foreach (ZipCode zipCopde in stateFulZips)
                {
                    stateFulzipCodeData.Add(new ZipCodeData()
                    {
                        City = zipCopde.City,
                        State = zipCopde.State.Abbreviation,
                        ZipCode = zipCopde.Zip
                    }
                    );
                }
            }
            return stateFulzipCodeData;
        }
Ejemplo n.º 7
0
 public void PushZip(string zip)
 {
     IZipCodeRepository stateFulZipCodeRepo = new ZipCodeRepository();
     this._StateFulZipCodeEntity = stateFulZipCodeRepo.GetByZip(zip);
 }
        public void PushZip(string zip)
        {
            IZipCodeRepository zipCodeRepository = new ZipCodeRepository();

            _ZipCodeEntity = zipCodeRepository.GetByZip(zip);
        }