annotate Agendas/trunk/src/Agendas.Domain/Evento.cs @ 57:3d9e6d56d903

Refactoring del track de cambios de un evento
author nelopauselli
date Mon, 16 May 2011 20:23:31 -0300
parents 65bbcdd5d357
children cb3f7b47c1f0
rev   line source
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents: 0
diff changeset
1 using System;
12
05996fa19e04 Unificamos Van y Cafe en Evento
nelo@MTEySS.neluz.int
parents: 4
diff changeset
2 using System.Collections.Generic;
1
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents: 0
diff changeset
3
6bb4ab4c0611 Tests de Crud para repositorio de Vans
nelopauselli
parents: 0
diff changeset
4 namespace AltNetHispano.Agendas.Domain
0
3f7dbb633b71 Test sobre la publicación de Eventos al registrarlos en la Agenda
nelopauselli
parents:
diff changeset
5 {
56
65bbcdd5d357 Pasando la responsabilidad de generar el Id al repositorio
nelopauselli
parents: 54
diff changeset
6 public class Evento : Identificable
0
3f7dbb633b71 Test sobre la publicación de Eventos al registrarlos en la Agenda
nelopauselli
parents:
diff changeset
7 {
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
8 private readonly IList<Track> _tracks;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
9 private IList<string> _enlaces;
42
d18d40f49439 Mi comentario
Daniel@DYD00
parents: 41
diff changeset
10
57
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
11 public static Evento Proponer(string titulo, Ponente ponente)
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
12 {
57
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
13 var evento = new Evento { Titulo = titulo, Ponente = ponente };
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
14 evento.AddTracks(new Track(Accion.Proponer));
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
15
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
16 return evento;
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
17 }
38
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
18
57
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
19 public static Evento Publicar(string titulo, Ponente ponente, DateTime fecha)
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
20 {
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
21 var evento = new Evento { Titulo = titulo };
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
22 evento.Publicar(ponente, fecha);
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
23
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
24 return evento;
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
25 }
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
26
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
27 private Evento()
3d9e6d56d903 Refactoring del track de cambios de un evento
nelopauselli
parents: 56
diff changeset
28 {
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
29 _enlaces = new List<string>();
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
30 _tracks = new List<Track>();
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
31 }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
32
38
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
33 public string Titulo { get; private set; }
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
34 public DateTime? Fecha { get; private set; }
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
35 public string Sintesis { get; private set; }
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
36 public Ponente Ponente { get; private set; }
39
e548379cc314 track de cambios en evento
nelo@MTEySS.neluz.int
parents: 38
diff changeset
37
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
38 public IEnumerable<string> Enlaces
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
39 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
40 get { return _enlaces; }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
41 }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
42
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
43 public IEnumerable<Track> Tracks
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
44 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
45 get { return _tracks; }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
46 }
38
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
47
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
48 public void Actualizar(Ponente ponente, DateTime? fecha)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
49 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
50 Ponente = ponente;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
51 Fecha = fecha;
39
e548379cc314 track de cambios en evento
nelo@MTEySS.neluz.int
parents: 38
diff changeset
52
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
53 AddTracks(new Track(Accion.Modificar));
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
54 }
41
07c47ea2ac00 movimos el AddTrack a cada acción dentro de Evento
nelopauselli
parents: 39
diff changeset
55
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
56 public void CambiarTitulo(string titulo)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
57 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
58 Titulo = titulo;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
59 AddTracks(new Track(Accion.CambiarTitulo));
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
60 }
38
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
61
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
62 public void Publicar(Ponente ponente, DateTime? fecha)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
63 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
64 Ponente = ponente;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
65 Fecha = fecha;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
66 AddTracks(new Track(Accion.Publicar));
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
67 }
39
e548379cc314 track de cambios en evento
nelo@MTEySS.neluz.int
parents: 38
diff changeset
68
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
69 public void Realizado(DateTime fecha, string sintesis, IList<string> enlaces)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
70 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
71 Fecha = fecha;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
72 Sintesis = sintesis;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
73 _enlaces = enlaces;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
74 }
39
e548379cc314 track de cambios en evento
nelo@MTEySS.neluz.int
parents: 38
diff changeset
75
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
76 public void Realizado(string sintesis)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
77 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
78 Sintesis = sintesis;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
79 AddTracks(new Track(Accion.Realizar));
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
80 }
41
07c47ea2ac00 movimos el AddTrack a cada acción dentro de Evento
nelopauselli
parents: 39
diff changeset
81
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
82 private void AddTracks(Track track)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
83 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
84 _tracks.Add(track);
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
85 }
38
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
86 }
0
3f7dbb633b71 Test sobre la publicación de Eventos al registrarlos en la Agenda
nelopauselli
parents:
diff changeset
87 }