annotate Agendas/trunk/src/Agendas.Domain/Evento.cs @ 56:65bbcdd5d357

Pasando la responsabilidad de generar el Id al repositorio
author nelopauselli
date Mon, 16 May 2011 20:15:05 -0300
parents 3059a5f8930f
children 3d9e6d56d903
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
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
11 public Evento(string titulo)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
12 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
13 Titulo = titulo;
38
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
14
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
15 _enlaces = new List<string>();
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
16 _tracks = new List<Track>();
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
17 }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
18
38
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
19 public string Titulo { get; private set; }
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
20 public DateTime? Fecha { get; private set; }
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
21 public string Sintesis { get; private set; }
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
22 public Ponente Ponente { get; private set; }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
23 protected string Usuario { get; private set; }
39
e548379cc314 track de cambios en evento
nelo@MTEySS.neluz.int
parents: 38
diff changeset
24
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
25 public IEnumerable<string> Enlaces
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
26 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
27 get { return _enlaces; }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
28 }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
29
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
30 public IEnumerable<Track> Tracks
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
31 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
32 get { return _tracks; }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
33 }
38
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
34
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
35 public void Actualizar(Ponente ponente, DateTime? fecha)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
36 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
37 Usuario = IdentityContext.GetUserName();
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
38 Ponente = ponente;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
39 Fecha = fecha;
39
e548379cc314 track de cambios en evento
nelo@MTEySS.neluz.int
parents: 38
diff changeset
40
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
41 AddTracks(new Track(Accion.Modificar));
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
42 }
41
07c47ea2ac00 movimos el AddTrack a cada acción dentro de Evento
nelopauselli
parents: 39
diff changeset
43
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
44 public void Actualizar(Ponente ponente)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
45 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
46 Usuario = IdentityContext.GetUserName();
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
47 Ponente = ponente;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
48 }
38
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
49
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
50 public void CambiarTitulo(string titulo)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
51 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
52 Usuario = IdentityContext.GetUserName();
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
53 Titulo = titulo;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
54 AddTracks(new Track(Accion.CambiarTitulo));
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
55 }
38
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
56
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
57 public void Publicar(Ponente ponente, DateTime? fecha)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
58 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
59 Usuario = IdentityContext.GetUserName();
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
60 Ponente = ponente;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
61 Fecha = fecha;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
62 AddTracks(new Track(Accion.Publicar));
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
63 }
39
e548379cc314 track de cambios en evento
nelo@MTEySS.neluz.int
parents: 38
diff changeset
64
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
65 public void Realizado(DateTime fecha, string sintesis, IList<string> enlaces)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
66 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
67 Usuario = IdentityContext.GetUserName();
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
68 Fecha = fecha;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
69 Sintesis = sintesis;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
70 _enlaces = enlaces;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
71 }
39
e548379cc314 track de cambios en evento
nelo@MTEySS.neluz.int
parents: 38
diff changeset
72
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
73 public void Realizado(string sintesis)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
74 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
75 Usuario = IdentityContext.GetUserName();
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
76 Sintesis = sintesis;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
77 AddTracks(new Track(Accion.Realizar));
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
78 }
41
07c47ea2ac00 movimos el AddTrack a cada acción dentro de Evento
nelopauselli
parents: 39
diff changeset
79
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
80 private void AddTracks(Track track)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
81 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
82 _tracks.Add(track);
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
83 }
38
3c5657d99727 Cambio de setters de las propiedades a private
nelo@MTEySS.neluz.int
parents: 24
diff changeset
84 }
39
e548379cc314 track de cambios en evento
nelo@MTEySS.neluz.int
parents: 38
diff changeset
85
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
86 public class Track
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
87 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
88 public Track(string accion)
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
89 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
90 Accion = accion;
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
91 }
39
e548379cc314 track de cambios en evento
nelo@MTEySS.neluz.int
parents: 38
diff changeset
92
54
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
93 public string Accion { get; private set; }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
94 }
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
95
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
96 public class Accion
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
97 {
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
98 public const string Publicar = "Publicar";
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
99 public const string Modificar = "Modificar";
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
100 public const string CambiarTitulo = "CambiarTitulo";
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
101 public const string Realizar = "Realizar";
3059a5f8930f Code cleanup
nelopauselli
parents: 50
diff changeset
102 }
0
3f7dbb633b71 Test sobre la publicación de Eventos al registrarlos en la Agenda
nelopauselli
parents:
diff changeset
103 }