comparison Agendas/trunk/src/Agendas.Twitter/Writers/TwitterHelper.cs @ 228:9f61e8555114

Nombrando a todos los ponentes en los twitter y partiendo los mensajes que superan el máximo permitido
author nelopauselli
date Wed, 28 Sep 2011 18:51:53 -0300
parents 35498fb9b59b
children 33976aea7546
comparison
equal deleted inserted replaced
227:11545cc95491 228:9f61e8555114
1 using AltNetHispano.Agendas.Domain; 1 using System.Collections.Generic;
2 using System.Linq;
3 using AltNetHispano.Agendas.Domain;
2 4
3 namespace AltNetHispano.Agendas.Twitter.Writers 5 namespace AltNetHispano.Agendas.Twitter.Writers
4 { 6 {
5 public static class TwitterHelper 7 public static class TwitterHelper
6 { 8 {
7 public static string GetPonente(Persona ponente) 9 public static string GetPonentes(IEnumerable<Persona> ponentes)
10 {
11 var nombres = ponentes.Select(GetPonente).ToArray();
12 string texto = string.Empty;
13 for (int i = 0; i < nombres.Length; i++)
14 {
15 var nombre = nombres[i];
16 if (i == nombre.Length-1)
17 texto += " y ";
18 else if (i != 0)
19 texto += ", ";
20 texto += nombre;
21 }
22 return texto;
23 }
24
25 private static string GetPonente(Persona ponente)
8 { 26 {
9 if (!string.IsNullOrWhiteSpace(ponente.Twitter)) 27 if (!string.IsNullOrWhiteSpace(ponente.Twitter))
10 return "@" + ponente.Twitter; 28 return "@" + ponente.Twitter;
11 return ponente.Nombre; 29 return ponente.Nombre;
12 } 30 }