annotate Agendas/trunk/src/Agendas.Domain/Evento.cs @ 61:cb3f7b47c1f0

Relación de Ponente a Eventos de los que es el ponente.
author nelopauselli
date Tue, 17 May 2011 01:27:03 -0300
parents 3d9e6d56d903
children 963b71ea6028
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));
61
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 57
diff changeset
15
57
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; }
61
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 57
diff changeset
36
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 57
diff changeset
37 private Ponente _ponente;
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 57
diff changeset
38 public Ponente Ponente
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 57
diff changeset
39 {
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 57
diff changeset
40 get { return _ponente; }
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 57
diff changeset
41 private set
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 57
diff changeset
42 {
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 57
diff changeset
43 if (value == null && _ponente != null || value != _ponente && _ponente != null)
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 57
diff changeset
44 _ponente.RemoveEvento(this);
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 57
diff changeset
45 if (value != null)
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 57
diff changeset
46 value.AddEvento(this);
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 57
diff changeset
47 _ponente = value;
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 57
diff changeset
48 }
cb3f7b47c1f0 Relación de Ponente a Eventos de los que es el ponente.
nelopauselli
parents: 57
diff changeset
49 }
39
e548379cc314 track de cambios en evento
nelo@MTEySS.neluz.int
parents: 38
diff changeset
50
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
51 public IEnumerable<string> Enlaces
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
52 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
53 get { return _enlaces; }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
54 }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
55
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
56 public IEnumerable<Track> Tracks
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
57 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
58 get { return _tracks; }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
59 }
38
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
60
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
61 public void Actualizar(Ponente ponente, DateTime? fecha)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
62 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
63 Ponente = ponente;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
64 Fecha = fecha;
39
e548379cc314 track de cambios en evento
nelo@MTEySS.neluz.int
parents: 38
diff changeset
65
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
66 AddTracks(new Track(Accion.Modificar));
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
67 }
41
07c47ea2ac00 movimos el AddTrack a cada acción dentro de Evento
nelopauselli
parents: 39
diff changeset
68
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
69 public void CambiarTitulo(string titulo)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
70 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
71 Titulo = titulo;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
72 AddTracks(new Track(Accion.CambiarTitulo));
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
73 }
38
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
74
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
75 public void Publicar(Ponente ponente, DateTime? fecha)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
76 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
77 Ponente = ponente;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
78 Fecha = fecha;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
79 AddTracks(new Track(Accion.Publicar));
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
80 }
39
e548379cc314 track de cambios en evento
nelo@MTEySS.neluz.int
parents: 38
diff changeset
81
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
82 public void Realizado(DateTime fecha, string sintesis, IList<string> enlaces)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
83 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
84 Fecha = fecha;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
85 Sintesis = sintesis;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
86 _enlaces = enlaces;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
87 }
39
e548379cc314 track de cambios en evento
nelo@MTEySS.neluz.int
parents: 38
diff changeset
88
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
89 public void Realizado(string sintesis)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
90 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
91 Sintesis = sintesis;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
92 AddTracks(new Track(Accion.Realizar));
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
93 }
41
07c47ea2ac00 movimos el AddTrack a cada acción dentro de Evento
nelopauselli
parents: 39
diff changeset
94
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
95 private void AddTracks(Track track)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
96 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
97 _tracks.Add(track);
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
98 }
38
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
99 }
0
3f7dbb633b71 Test sobre la publicación de Eventos al registrarlos en la Agenda
nelopauselli
parents:
diff changeset
100 }