Ejemplo n.º 1
0
        void IJob.Execute(IJobContext context, Operation operation)
        {
            if (context.Phase == JobPhase.OnOperationSurfaced)
            {
                if (operation.Einsatzort.HasGeoCoordinates)
                {
                    return;
                }

                GeocoderLocation geocoderLocation = _provider.Geocode(operation.Einsatzort);
                if (geocoderLocation != null)
                {
                    //The most of the widgets and so need the "english-format" (point instead of comma)!
                    operation.Einsatzort.GeoLongitude = geocoderLocation.Longitude;
                    operation.Einsatzort.GeoLatitude  = geocoderLocation.Latitude;
                }
                else
                {
                    Logger.Instance.LogFormat(LogType.Warning, this, Properties.Resources.NoCoordinatesFoundByGeocodingService);
                }
            }
        }
Ejemplo n.º 2
0
 void IJob.Execute(IJobContext context, Operation operation)
 {
     // This is a Pre-Job. Thus it only has to run right after the operation has surfaced and before being stored.
     if (context.Phase == JobPhase.OnOperationSurfaced)
     {
         //Don't overwrite exisiting coordinates
         if (operation.Einsatzort.HasGeoCoordinates)
         {
             return;
         }
         GeocoderLocation geocoderLocation = _provider.GeoCode(operation.Einsatzort);
         if (geocoderLocation != null)
         {
             //The most of the widgets and so need the "english-format" (point instead of comma)!
             operation.Einsatzort.GeoLongitude = geocoderLocation.Longitude.ToString().Replace(',', '.');
             operation.Einsatzort.GeoLatitude  = geocoderLocation.Latitude.ToString().Replace(',', '.');
         }
         else
         {
             Logger.Instance.LogFormat(LogType.Error, this, "No coordinats found by geocoding service.");
         }
     }
 }