Пример #1
0
        public Dictionary <string, Location> GetCompanyLocations(int subscriberId, bool filteredByZip = true)
        {
            var locationsByCustomerNumber = new Dictionary <string, Location>();

            foreach (var manifestLegs in _dictionary.Values)
            {
                var legs = manifestLegs.AllLegs;
                foreach (var l in legs)
                {
                    if (filteredByZip && !ValidValues.IsValidZipCode(l.CompanyZipInt))
                    {
                        continue;
                    }

                    if (!locationsByCustomerNumber.ContainsKey(l.CustomerNumber))
                    {
                        var loc = new Location()
                        {
                            SubscriberId  = subscriberId,
                            DisplayName   = l.CompanyName,
                            LegacyId      = l.CustomerNumber,
                            StreetAddress = l.CompanyAddress1,
                            City          = l.CompanyCity,
                            State         = l.CompanyState,
                            Zip           = l.CompanyZip
                        };

                        locationsByCustomerNumber.Add(l.CustomerNumber, loc);
                    }
                }
            }

            return(locationsByCustomerNumber);
        }