Mercurial > altnet-hispano
comparison Agendas/trunk/src/Agendas.Domain/EventoCanceladoState.cs @ 133:6f1041301797
Se agregan los estados Cancelado y Descartado con las acciones Cancelar, Reagendar, Descartar, Reproponer, según ticket 146.
Falta solucionar problema con flujo, ver más información en el ticket de assembla.
http://www.assembla.com/spaces/altnet-hispano/tickets/146-implementar-estado-descartar-y-cancelar-de-eventos
author | alabra |
---|---|
date | Sun, 10 Jul 2011 23:59:19 -0400 |
parents | |
children | 3639803112c6 |
comparison
equal
deleted
inserted
replaced
132:45be716763c3 | 133:6f1041301797 |
---|---|
1 using AltNetHispano.Agendas.Domain.Exceptions; | |
2 | |
3 namespace AltNetHispano.Agendas.Domain | |
4 { | |
5 public class EventoCanceladoState : EventoState | |
6 { | |
7 private EventoCanceladoState() | |
8 { | |
9 } | |
10 | |
11 private static readonly EventoState _instance = new EventoCanceladoState(); | |
12 | |
13 public static EventoState GetInstance() | |
14 { | |
15 return _instance; | |
16 } | |
17 | |
18 private const string Descripcion = "Cancelado"; | |
19 | |
20 public override void Promover(Evento evento, Accion accion) | |
21 { | |
22 switch (accion) | |
23 { | |
24 case Accion.Descartar: | |
25 evento.SetEstado(EventoDescartadoState.GetInstance()); | |
26 evento.AddTrack(new Track(evento, Accion.Descartar)); | |
27 break; | |
28 case Accion.ReAgendar: | |
29 evento.SetEstado(EventoAgendadoState.GetInstance()); | |
30 evento.AddTrack(new Track(evento, Accion.ReAgendar)); | |
31 break; | |
32 case Accion.ReProponer: | |
33 evento.SetEstado(EventoPropuestoState.GetInstance()); | |
34 evento.AddTrack(new Track(evento, Accion.ReProponer)); | |
35 break; | |
36 default: | |
37 throw new AccionNoSoportadaException(this.GetType(), accion); | |
38 } | |
39 } | |
40 | |
41 public override string GetDescripcion() | |
42 { | |
43 return Descripcion; | |
44 } | |
45 | |
46 public override bool PuedePromover(Accion accion) | |
47 { | |
48 return accion == Accion.Descartar || accion == Accion.ReAgendar || accion == Accion.ReProponer; | |
49 } | |
50 } | |
51 } |