Ejemplo n.º 1
0
        /// <summary>
        /// Builds up the LocationLookupResult based on the location components passed in.
        /// City, state, country can be null.
        /// </summary>
        /// <param name="lookupType">The location lookup type</param>
        /// <param name="isValid">Whether or not the location was valid.</param>
        /// <param name="message">Error message if not valid.</param>
        /// <param name="country">Optional - The country to be used for setting the id and name of the country.</param>
        /// <param name="state">Optional - The state to be used for setting the id and name of the state.</param>
        /// <param name="city">Optional - The city to be used for setting the id and name of the city</param>
        /// <returns></returns>
        private static LocationLookUpResult Build(LocationLookUpType lookupType, bool isValid, string message, Country country, State state, City city)
        {
            LocationLookUpResult result = new LocationLookUpResult(lookupType, isValid, message);

            Build(country, state, city, result);
            return(result);
        }
Ejemplo n.º 2
0
        private static LocationLookUpResult ParseStateById(LocationLookUpType lookupType, bool isValid, string message,
                                                           StateLookUp stateLookUp, CountryLookUp countryLookUp, int stateId, int countryId)
        {
            State state = stateLookUp[stateId];

            Country country = null;

            if (state != null)
            {
                country = countryLookUp[state.CountryId];
            }
            else
            {
                country = countryLookUp[countryId];
            }

            return(Build(lookupType, isValid, message, country, state, null));
        }
Ejemplo n.º 3
0
 private static void Build(LocationLookUpResult result, LocationLookUpType lookupType, bool isValid, string message, Country country, State state, City city)
 {
     result.Init(lookupType, isValid, message);
     Build(country, state, city, result);
 }
 internal void Init(LocationLookUpType lookupType, bool isValid, string error)
 {
     _lookupType = lookupType;
     _isValid    = isValid;
     _error      = error;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="lookupType"></param>
 /// <param name="isValid"></param>
 /// <param name="error"></param>
 public LocationLookUpResult(LocationLookUpType lookupType, bool isValid, string error)
 {
     _lookupType = lookupType;
     _isValid    = isValid;
     _error      = error;
 }