# HG changeset patch # User nelopauselli # Date 1306275680 10800 # Node ID c76661cff260b57f170ea238483fc4ef5ba7efdf # Parent c2d98fd6593f94b182f12496391af9bf88e38c55 Workflow de acciones sobre un evento (camino feliz) diff -r c2d98fd6593f -r c76661cff260 Agendas/trunk/src/Agendas.Domain/Agenda.cs --- a/Agendas/trunk/src/Agendas.Domain/Agenda.cs Tue May 24 18:25:57 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Domain/Agenda.cs Tue May 24 19:21:20 2011 -0300 @@ -21,9 +21,12 @@ _recordador = recordador; } - public Evento GetEvento(Guid id) + public Evento GetEvento(Guid eventoId) { - return _eventosRepository.Get(id); + Evento evento =_eventosRepository.Get(eventoId); + if (evento == null) + throw new EventoNotFoundException(eventoId); + return evento; } public IList GetEventosPropuestos() @@ -38,9 +41,7 @@ public Resultado ModificarEvento(Guid id, string titulo, string ponenteNombre, DateTime? fecha, string urlInvitacion) { - Evento evento = _eventosRepository.Get(id); - if (evento == null) - throw new EventoNotFoundException(id); + Evento evento = GetEvento(id); Ponente ponente = null; if (!string.IsNullOrWhiteSpace(ponenteNombre)) @@ -54,8 +55,7 @@ else if (evento.Fecha != fecha || evento.Ponente != ponente || evento.UrlInvitacion != urlInvitacion) evento.Actualizar(ponente, fecha, urlInvitacion); - if (_publicador != null) - _publicador.Publicar(evento); + Notify(evento); return new Resultado(true); } @@ -73,6 +73,8 @@ if (string.IsNullOrWhiteSpace(evento.Titulo)) return new Resultado(false); + Notify(evento); + _eventosRepository.Save(evento); _ponenteRepository.Save(ponente); @@ -94,8 +96,7 @@ else evento.Agendar(ponente, fecha, urlInvitacion); - if (_publicador != null) - _publicador.Publicar(evento); + Notify(evento); _eventosRepository.Save(evento); _ponenteRepository.Save(ponente); @@ -103,6 +104,32 @@ return new Resultado(true); } + public Resultado Confirmar(Guid eventoId) + { + Evento evento = GetEvento(eventoId); + + evento.Confirmar(); + + Notify(evento); + + _eventosRepository.Save(evento); + + return new Resultado(true); + } + + public Resultado Publicar(Guid eventoId) + { + Evento evento = GetEvento(eventoId); + + evento.Publicar(); + + Notify(evento); + + _eventosRepository.Save(evento); + + return new Resultado(true); + } + public void Recordar(Guid eventoId) { Evento evento = _eventosRepository.Get(eventoId); @@ -110,6 +137,12 @@ _recordador.Recordar(evento); } + private void Notify(Evento evento) + { + if (_publicador != null) + _publicador.Publicar(evento); + } + public void RegistrarPonente(string nombre, string mail, string twitter, string blog) { var ponente = new Ponente(nombre, mail, twitter, blog); diff -r c2d98fd6593f -r c76661cff260 Agendas/trunk/src/Agendas.Domain/Evento.cs --- a/Agendas/trunk/src/Agendas.Domain/Evento.cs Tue May 24 18:25:57 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Domain/Evento.cs Tue May 24 19:21:20 2011 -0300 @@ -127,11 +127,22 @@ AddTracks(new Track(this, Accion.CambiarTitulo)); } + public virtual void Confirmar() + { + AddTracks(new Track(this, Accion.Confirmar)); + } + + public virtual void Publicar() + { + AddTracks(new Track(this, Accion.Publicar)); + } + #endregion private void AddTracks(Track track) { _tracks.Add(track); } + } } \ No newline at end of file diff -r c2d98fd6593f -r c76661cff260 Agendas/trunk/src/Agendas.Domain/Track.cs --- a/Agendas/trunk/src/Agendas.Domain/Track.cs Tue May 24 18:25:57 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Domain/Track.cs Tue May 24 19:21:20 2011 -0300 @@ -25,7 +25,8 @@ Agendar = 2, Modificar = 3, CambiarTitulo = 4, - Publicar = 5 + Publicar = 5, + Confirmar = 6 } } \ No newline at end of file diff -r c2d98fd6593f -r c76661cff260 Agendas/trunk/src/Agendas.Tests/Agendas.Tests.csproj --- a/Agendas/trunk/src/Agendas.Tests/Agendas.Tests.csproj Tue May 24 18:25:57 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Tests/Agendas.Tests.csproj Tue May 24 19:21:20 2011 -0300 @@ -80,6 +80,8 @@ + + @@ -112,6 +114,7 @@ Always +