annotate Agendas/trunk/src/Agendas.Twitter/Recordatorios.cs @ 234:cc71f96ac134

Combinar
author juanjose.montesdeocaarbos
date Tue, 04 Oct 2011 20:36:27 -0300
parents e5959f3405e0
children
rev   line source
217
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
1 using System;
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
2 using System.Collections.Generic;
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
3 using AltNetHispano.Agendas.Domain;
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
4
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
5 namespace AltNetHispano.Agendas.Twitter
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
6 {
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
7 public class Recordatorios
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
8 {
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
9 public Recordatorios(Evento evento)
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
10 {
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
11 if (!evento.FechaInicio.HasValue) throw new ArgumentNullException("evento");
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
12
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
13 Items = new List<RecordatorioItem>();
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
14
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
15 var fechaInicio = evento.FechaInicio.Value;
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
16
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
17 Cabecera = "Recuerde agendar el evento en twuffer u otro servicio similar.";
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
18 CabeceraLink = "http://twuffer.com/";
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
19
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
20 for (int hora = 3; hora > 0; hora--)
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
21 {
231
e5959f3405e0 Eventos sin ponentes
nelopauselli
parents: 217
diff changeset
22 var mensaje = TwitterStringHelper.TipoEvento(evento.Tipo) + " sobre " + evento.Titulo +
e5959f3405e0 Eventos sin ponentes
nelopauselli
parents: 217
diff changeset
23 TwitterStringHelper.Ponentes(evento) + " inicia en [" + hora + "] hora" +
217
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
24 (hora > 1 ? "s" : string.Empty) + " " +
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
25 TwitterStringHelper.Hora(fechaInicio) + " http://snipr.com/virtualaltnet";
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
26
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
27 var fechaRecordatorio = fechaInicio.AddHours(hora * -1);
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
28 Items.Add(new RecordatorioItem(fechaRecordatorio, mensaje));
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
29 }
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
30
231
e5959f3405e0 Eventos sin ponentes
nelopauselli
parents: 217
diff changeset
31 var mensaje15 = TwitterStringHelper.TipoEvento(evento.Tipo) + " sobre " + evento.Titulo +
e5959f3405e0 Eventos sin ponentes
nelopauselli
parents: 217
diff changeset
32 TwitterStringHelper.Ponentes(evento) + " inicia en [15] minutos " +
217
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
33 TwitterStringHelper.Hora(fechaInicio) + " http://snipr.com/virtualaltnet";
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
34
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
35 var fechaRecordatorio15 = fechaInicio.AddMinutes(-15);
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
36 Items.Add(new RecordatorioItem(fechaRecordatorio15, mensaje15));
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
37 }
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
38
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
39 public string CabeceraLink { get; set; }
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
40
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
41 public IList<RecordatorioItem> Items { get; set; }
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
42
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
43 public string Cabecera { get; set; }
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
44 }
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
45
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
46 public class RecordatorioItem
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
47 {
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
48 public RecordatorioItem(DateTime momento, string mensaje)
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
49 {
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
50 Fecha = momento.ToString("dd/MM/yyyy");
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
51 Hora = momento.ToString("HH:mm");
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
52 Mensaje = mensaje;
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
53 }
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
54
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
55 public string Mensaje { get; set; }
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
56 public string Hora { get; set; }
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
57 public string Fecha { get; set; }
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
58 }
c4c60e034103 sugerencia de recordatorios
nelopauselli
parents:
diff changeset
59 }