Mercurial > altnet-hispano
diff Agendas/trunk/src/Agendas.Domain/EventoCanceladoState.cs @ 140:3639803112c6
Refactoring de la relación entre Evento y Estado
author | nelopauselli |
---|---|
date | Fri, 29 Jul 2011 16:30:53 -0300 |
parents | 6f1041301797 |
children |
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Domain/EventoCanceladoState.cs Thu Jul 28 10:16:09 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Domain/EventoCanceladoState.cs Fri Jul 29 16:30:53 2011 -0300 @@ -1,51 +1,50 @@ -using AltNetHispano.Agendas.Domain.Exceptions; +using System; +using AltNetHispano.Agendas.Domain.Exceptions; namespace AltNetHispano.Agendas.Domain { - public class EventoCanceladoState : EventoState - { - private EventoCanceladoState() - { - } + public class EventoCanceladoState : EventoState + { + protected EventoCanceladoState() + { + } - private static readonly EventoState _instance = new EventoCanceladoState(); + private static readonly EventoState _instance = new EventoCanceladoState(); - public static EventoState GetInstance() - { - return _instance; - } - - private const string Descripcion = "Cancelado"; + public static EventoState GetInstance() + { + return _instance; + } - public override void Promover(Evento evento, Accion accion) - { - switch (accion) - { - case Accion.Descartar: - evento.SetEstado(EventoDescartadoState.GetInstance()); - evento.AddTrack(new Track(evento, Accion.Descartar)); - break; - case Accion.ReAgendar: - evento.SetEstado(EventoAgendadoState.GetInstance()); - evento.AddTrack(new Track(evento, Accion.ReAgendar)); - break; - case Accion.ReProponer: - evento.SetEstado(EventoPropuestoState.GetInstance()); - evento.AddTrack(new Track(evento, Accion.ReProponer)); - break; - default: - throw new AccionNoSoportadaException(this.GetType(), accion); - } - } + public override void Promover(Evento evento, Accion accion) + { + switch (accion) + { + case Accion.Descartar: + evento.Estado = EventoDescartadoState.GetInstance(); + evento.AddTrack(new Track(evento, Accion.Descartar)); + break; + case Accion.ReAgendar: + evento.Estado = EventoAgendadoState.GetInstance(); + evento.AddTrack(new Track(evento, Accion.ReAgendar)); + break; + case Accion.ReProponer: + evento.Estado = EventoPropuestoState.GetInstance(); + evento.AddTrack(new Track(evento, Accion.ReProponer)); + break; + default: + throw new AccionNoSoportadaException(this.GetType(), accion); + } + } - public override string GetDescripcion() - { - return Descripcion; - } + public override string Descripcion + { + get { return "Cancelado"; } + } - public override bool PuedePromover(Accion accion) - { - return accion == Accion.Descartar || accion == Accion.ReAgendar || accion == Accion.ReProponer; - } - } + public override bool PuedePromover(Accion accion) + { + return accion == Accion.Descartar || accion == Accion.ReAgendar || accion == Accion.ReProponer; + } + } } \ No newline at end of file