Mercurial > altnet-hispano
annotate Agendas/trunk/src/Agendas.Blog/Impl/BlogPublicador.cs @ 128:1e47bf408073
Asignacion de los publicadores configurados en web.config al factory de agenda
(mediante CompositePublicador)
author | jorge.rowies |
---|---|
date | Mon, 04 Jul 2011 20:00:51 -0300 |
parents | c3573defd18f |
children |
rev | line source |
---|---|
120
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
1 using System; |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
2 using System.Collections.Generic; |
128
1e47bf408073
Asignacion de los publicadores configurados en web.config al factory de agenda
jorge.rowies
parents:
120
diff
changeset
|
3 using System.Configuration; |
120
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
4 using System.Linq; |
87
26d0513a8410
A los publicadores les llega la lista de tracks producidos en la acción realizada
nelopauselli
parents:
65
diff
changeset
|
5 using AltNetHispano.Agendas.Domain; |
65
ebce59b45b50
Agregado de version inicial del publicador para el blog
ROWIES@ardejorxp.inworx.corp
parents:
diff
changeset
|
6 |
ebce59b45b50
Agregado de version inicial del publicador para el blog
ROWIES@ardejorxp.inworx.corp
parents:
diff
changeset
|
7 namespace Agendas.Blog.Impl |
ebce59b45b50
Agregado de version inicial del publicador para el blog
ROWIES@ardejorxp.inworx.corp
parents:
diff
changeset
|
8 { |
120
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
9 public class BlogPublicador : IPublicador |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
10 { |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
11 private readonly IPostWriterFactory _postWriterFactory; |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
12 |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
13 public BlogPublicador(IPostWriterFactory postWriterFactory) |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
14 { |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
15 _postWriterFactory = postWriterFactory; |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
16 } |
65
ebce59b45b50
Agregado de version inicial del publicador para el blog
ROWIES@ardejorxp.inworx.corp
parents:
diff
changeset
|
17 |
120
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
18 public void Publicar(IEnumerable<Track> tracks) |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
19 { |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
20 foreach (var track in tracks) |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
21 { |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
22 if (track.Logs.Any(l => l.Propietario == TrackLogPropietario.Blog && l.Successful)) continue; |
65
ebce59b45b50
Agregado de version inicial del publicador para el blog
ROWIES@ardejorxp.inworx.corp
parents:
diff
changeset
|
23 |
120
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
24 try |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
25 { |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
26 _postWriterFactory.GetPostWriter(track.Accion).WritePost(track); |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
27 track.LogAdd(new TrackLog(TrackLogPropietario.Blog, string.Empty, track.Usuario, true)); |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
28 } |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
29 catch (Exception ex) |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
30 { |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
31 track.LogAdd(new TrackLog(TrackLogPropietario.Blog, ex.Message, track.Usuario, false)); |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
32 } |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
33 } |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
34 } |
c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Jorge@Jorge-PC
parents:
105
diff
changeset
|
35 } |
65
ebce59b45b50
Agregado de version inicial del publicador para el blog
ROWIES@ardejorxp.inworx.corp
parents:
diff
changeset
|
36 } |