Exemplo n.º 1
0
 private static void SetConstraints(SearchLocationsRequest request)
 {
     request.Constraints = new SearchLocationConstraints();
     request.Constraints.RadiusDistance                = new Distance();
     request.Constraints.RadiusDistance.Value          = new Decimal(25.0);
     request.Constraints.RadiusDistance.ValueSpecified = true;
     request.Constraints.RadiusDistance.Units          = DistanceUnits.MI;
     request.Constraints.RadiusDistance.UnitsSpecified = true;
     //
     request.Constraints.ResultsFilters    = new LocationSearchFilterType[1];
     request.Constraints.ResultsFilters[0] = LocationSearchFilterType.EXCLUDE_LOCATIONS_OUTSIDE_STATE_OR_PROVINCE;
     //
     // These is [AND] logic, include GROUND will reduce the results a lot.
     request.Constraints.RequiredLocationAttributes    = new LocationAttributesType[3];
     request.Constraints.RequiredLocationAttributes[0] = LocationAttributesType.SATURDAY_EXPRESS_HOLD_AT_LOCATION;
     request.Constraints.RequiredLocationAttributes[1] = LocationAttributesType.WEEKDAY_EXPRESS_HOLD_AT_LOCATION;
     //request.Constraints.RequiredLocationAttributes[2] = LocationAttributesType.WEEKDAY_GROUND_HOLD_AT_LOCATION;
     //
     request.Constraints.ResultsRequested = "10";
     //
     request.Constraints.LocationContentOptions = new LocationContentOptionType[1];
     //request.Constraints.LocationContentOptions[0] = LocationContentOptionType.HOLIDAYS;
     //
     // This is [OR] logic.
     request.Constraints.LocationTypesToInclude    = new FedExLocationType[3];
     request.Constraints.LocationTypesToInclude[0] = FedExLocationType.FEDEX_AUTHORIZED_SHIP_CENTER;
     request.Constraints.LocationTypesToInclude[1] = FedExLocationType.FEDEX_EXPRESS_STATION;
     request.Constraints.LocationTypesToInclude[2] = FedExLocationType.FEDEX_OFFICE; // This includes most of the first two types.
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            SearchLocationsRequest request = CreateSearchLocationsRequest();
            //
            LocationsService service = new LocationsService();

            if (usePropertyFile())
            {
                service.Url = getProperty("endpoint");
            }
            //
            try
            {
                // Call the Locations web service passing in a SearchLocationsRequest and returning a SearchLocationsReply
                SearchLocationsReply reply = service.searchLocations(request);
                if (reply.HighestSeverity == NotificationSeverityType.SUCCESS || reply.HighestSeverity == NotificationSeverityType.NOTE || reply.HighestSeverity == NotificationSeverityType.WARNING)
                {
                    ShowSearchLocationsReply(reply);
                }
                ShowNotifications(reply);
            }
            catch (SoapException e)
            {
                Console.WriteLine(e.Detail.InnerText);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            Console.WriteLine("Press any key to quit!");
            Console.ReadKey();
        }
Exemplo n.º 3
0
        private static SearchLocationsRequest CreateSearchLocationsRequest()
        {
            // Build the SearchLocationRequest
            SearchLocationsRequest request = new SearchLocationsRequest();

            //
            request.WebAuthenticationDetail = new WebAuthenticationDetail();
            request.WebAuthenticationDetail.UserCredential            = new WebAuthenticationCredential();
            request.WebAuthenticationDetail.UserCredential.Key        = "Nvu0MsZ4wgWPTA84";          // Replace "XXX" with the Key
            request.WebAuthenticationDetail.UserCredential.Password   = "******"; // Replace "XXX" with the Password
            request.WebAuthenticationDetail.ParentCredential          = new WebAuthenticationCredential();
            request.WebAuthenticationDetail.ParentCredential.Key      = "Nvu0MsZ4wgWPTA84";          // Replace "XXX" with the Key
            request.WebAuthenticationDetail.ParentCredential.Password = "******"; // Replace "XXX"
            if (usePropertyFile())                                                                   //Set values from a file for testing purposes
            {
                request.WebAuthenticationDetail.UserCredential.Key        = getProperty("key");
                request.WebAuthenticationDetail.UserCredential.Password   = getProperty("password");
                request.WebAuthenticationDetail.ParentCredential.Key      = getProperty("parentkey");
                request.WebAuthenticationDetail.ParentCredential.Password = getProperty("parentpassword");
            }
            //
            request.ClientDetail = new ClientDetail();
            request.ClientDetail.AccountNumber = "510087208"; // Replace "XXX" with the client's account number
            request.ClientDetail.MeterNumber   = "100298364"; // Replace "XXX" with the client's meter number
            if (usePropertyFile())                            //Set values from a file for testing purposes
            {
                request.ClientDetail.AccountNumber = getProperty("accountnumber");
                request.ClientDetail.MeterNumber   = getProperty("meternumber");
            }
            //
            request.TransactionDetail = new TransactionDetail();
            request.TransactionDetail.CustomerTransactionId = "***SearchLocation v2 Request using VC#***"; // This is a reference field for the customer.  Any value can be used and will be provided in the response.
            //
            request.Version = new VersionId();
            //
            request.EffectiveDate                     = DateTime.Now;
            request.EffectiveDateSpecified            = true;
            request.LocationsSearchCriterionSpecified = true;
            //
            bool bUsePhoneNumber = false;

            if (bUsePhoneNumber)
            {
                request.LocationsSearchCriterion = LocationsSearchCriteriaType.PHONE_NUMBER;
                //request.PhoneNumber = "9015551234"; // Search locations based on a phone number
                request.PhoneNumber = "6262719700";
            }
            else
            {
                request.LocationsSearchCriterion = LocationsSearchCriteriaType.ADDRESS;
            }
            SetAddress(request);
            //
            request.MultipleMatchesAction          = MultipleMatchesActionType.RETURN_ALL;
            request.MultipleMatchesActionSpecified = true;
            SetSortDetail(request);
            SetConstraints(request);
            return(request);
        }
Exemplo n.º 4
0
 private static void SetSortDetail(SearchLocationsRequest request)
 {
     request.SortDetail                    = new LocationSortDetail();
     request.SortDetail.Criterion          = LocationSortCriteriaType.DISTANCE;
     request.SortDetail.CriterionSpecified = true;
     request.SortDetail.Order              = LocationSortOrderType.LOWEST_TO_HIGHEST;
     request.SortDetail.OrderSpecified     = true;
 }
Exemplo n.º 5
0
 private static void SetAddress(SearchLocationsRequest request)
 {
     request.Address             = new Address();
     request.Address.StreetLines = new string[1] {
         "17560 Rowland St"
     };
     request.Address.City = "City of Industry";
     request.Address.StateOrProvinceCode = "CA";
     request.Address.PostalCode          = "91748";
     request.Address.CountryCode         = "US";
     //request.Address = new Address();
     //request.Address.StreetLines = new string[1] { "Address Line 1" };
     //request.Address.City = "Collierville";
     //request.Address.StateOrProvinceCode = "TN";
     //request.Address.PostalCode = "38017";
     //request.Address.CountryCode = "US";
 }
Exemplo n.º 6
0
        public object Post(SearchLocationsRequest request)
        {
            if (request == null || string.IsNullOrEmpty(request.Name))
            {
                throw new HttpError(HttpStatusCode.BadRequest, ErrorCode.Search_Locations_NameRequired.ToString());
            }

            var language = CultureInfo.CurrentUICulture.Name;

            if (this.GetSession() != null &&
                this.GetSession().UserAuthId != null)
            {
                var account = _accountDao.FindById(new Guid(this.GetSession().UserAuthId));
                if (account != null && account.Language.HasValue())
                {
                    language = account.Language;
                }
            }

            return(_client.Search(request.Name, request.Lat.GetValueOrDefault(), request.Lng.GetValueOrDefault(), language, request.GeoResult));
        }