/// <summary> /// Returns a string with the county (län) name. /// If parish is included in data from data provider this value is used. /// Oterwise county is matched from the coordinates. /// May return an empty string if observation is located outside Swedish territorial border. /// </summary> /// <param name="dictionaryWebData">The dictionary web data.</param> /// <param name="context"> The context. </param> /// <param name="mapping">Mapping where the method is used.</param> /// <returns>County (län) name.</returns> protected virtual string GetCounty(Dictionary <string, WebDataField> dictionaryWebData, WebServiceContext context, HarvestMapping mapping) { String coordinateX, coordinateY, county; county = String.Empty; if (mapping.Name.IsNotEmpty() && dictionaryWebData.ContainsKey(mapping.Name.ToLower()) && dictionaryWebData[mapping.Name.ToLower()].Value.IsNotEmpty()) { // Get county from data provider. county = ReplaceInvalidCharacters(dictionaryWebData[mapping.Name.ToLower()].Value); } else { // Get county from coordinates. coordinateX = GetCoordinateX(dictionaryWebData); coordinateY = GetCoordinateY(dictionaryWebData); if (coordinateX.IsDouble() && coordinateY.IsDouble()) { county = context.GetSpeciesObservationDatabase().GetCountyFromCoordinates(coordinateX.WebParseDouble(), coordinateY.WebParseDouble()); } } return(county); }
/// <summary> /// The implementation is provided by an overriding method. /// </summary> /// <param name="methodName">Name of the method.</param> /// <param name="dictionaryWebData">The dictionary web data.</param> /// <param name="context">The WebServiceContext.</param> /// <param name="mapping">Mapping where the method is used.</param> /// <returns>The ReturnValue of the method.</returns> protected abstract String MethodWrapper(String methodName, Dictionary <string, WebDataField> dictionaryWebData, WebServiceContext context, HarvestMapping mapping);