/// <summary>
            /// Gets the state provinces.
            /// </summary>
            /// <param name="request">The request.</param>
            /// <returns>The response.</returns>
            private static GetStateProvincesServiceResponse GetStateProvinces(GetStateProvincesServiceRequest request)
            {
                ValidateGetAddressInfoRequests(request);

                string countryRegionId = request.Filters[AddressServiceConstants.CountryRegionId].ToString();

                var stateProvinceRequest = new GetStateProvincesDataRequest(countryRegionId, request.QueryResultSettings);
                var stateProvinceDataSet = request.RequestContext.Runtime.Execute <EntityDataServiceResponse <StateProvinceInfo> >(stateProvinceRequest, request.RequestContext);

                return(new GetStateProvincesServiceResponse(stateProvinceDataSet.PagedEntityCollection));
            }
Exemple #2
0
            private EntityDataServiceResponse <StateProvinceInfo> GetStateProvinces(GetStateProvincesDataRequest request)
            {
                ThrowIf.Null(request.QueryResultSettings, "settings");
                ThrowIf.Null(request.CountryRegionCode, "countryRegionCode");

                ParameterSet filters = new ParameterSet();

                filters[AddressServiceConstants.CountryRegionId] = request.CountryRegionCode;

                PagedResult <StateProvinceInfo> stateProvinces;

                using (SqlServerDatabaseContext sqlServerDatabaseContext = new SqlServerDatabaseContext(request))
                {
                    stateProvinces = sqlServerDatabaseContext.ExecuteStoredProcedure <StateProvinceInfo>(GetStateProvincesInfoSprocName, filters);
                }

                return(new EntityDataServiceResponse <StateProvinceInfo>(stateProvinces));
            }