diff Agendas/trunk/src/Agendas.Google/GooglePublicador.cs @ 184:2a336a6a76b5

Agregando log al track cuando fallan los publicadores
author nelopauselli
date Mon, 08 Aug 2011 22:32:12 -0300
parents 734d3f0853bf
children 2d02adb79322
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Google/GooglePublicador.cs	Mon Aug 08 22:27:00 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Google/GooglePublicador.cs	Mon Aug 08 22:32:12 2011 -0300
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using AltNetHispano.Agendas.Configurations;
 using AltNetHispano.Agendas.Domain;
 using AltNetHispano.Agendas.Google.DetailsEvents;
@@ -31,34 +32,43 @@
 
 		    foreach (var track in tracks)
 		    {
-                switch (track.Accion)
-                {
-                    case Accion.Agendar:
-                        PublicarAccionAgendar(track);
-                        break;
-                    case Accion.Cancelar:
-                        PublicarAccionCancelar(track);
-                        break;
-                }
+		    	try
+		    	{
+		    		switch (track.Accion)
+		    		{
+		    			case Accion.Agendar:
+		    				PublicarAccionAgendar(track);
+		    				break;
+		    			case Accion.Cancelar:
+		    				PublicarAccionCancelar(track);
+		    				break;
+		    		}
+		    	}
+		    	catch (Exception ex)
+		    	{
+		    		track.LogAdd(new TrackLog(TrackLogPropietario.Calendario, track.Usuario, ex));
+		    	}
 		    }
 		}
 
 	    private void PublicarAccionCancelar(Track track)
 	    {
-            string message;
-	        var result= _adapter.DeleteEvent(track.Evento.Fecha.Value, track.Evento.Fecha.Value.AddHours(2), out message);
-            track.LogAdd(new TrackLog(TrackLogPropietario.Calendario, message, track.Usuario, result));
+	    		string message;
+	    		var result = _adapter.DeleteEvent(track.Evento.Fecha.Value, track.Evento.Fecha.Value.AddHours(2), out message);
+	    		track.LogAdd(new TrackLog(TrackLogPropietario.Calendario, message, track.Usuario, result));
+	    	
+
 	    }
 
-	    private void PublicarAccionAgendar(Track track)
-        {
-            string message;
-            _gEventDetails[track.Evento.Tipo].Generate(track.Evento);
-            var result = _adapter.CreateEvent(_gEventDetails[track.Evento.Tipo], out message);
-            track.LogAdd(new TrackLog(TrackLogPropietario.Calendario, message, track.Usuario, result));
-        }
+		private void PublicarAccionAgendar(Track track)
+		{
+			_gEventDetails[track.Evento.Tipo].Generate(track.Evento);
+			string message;
+			var result = _adapter.CreateEvent(_gEventDetails[track.Evento.Tipo], out message);
+			track.LogAdd(new TrackLog(TrackLogPropietario.Calendario, message, track.Usuario, result));
+		}
 
-        public GooglePublicador()
+		public GooglePublicador()
             : this(new GCalendarAdapter("VAN", GetUserName, GetPassword, GetCalendarId))
         {
         }