Mercurial > altnet-hispano
annotate Agendas/trunk/src/Agendas.Domain/EventoNullState.cs @ 129:a6d20ea228a5
Se agrega Calendario al enum TrackLogPropietario, para ser utilizado en la publicación de Google Calendar.
author | alabra |
---|---|
date | Sun, 10 Jul 2011 18:08:00 -0400 |
parents | 53bcd338542b |
children | 3639803112c6 |
rev | line source |
---|---|
116
53bcd338542b
acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents:
104
diff
changeset
|
1 using System; |
53bcd338542b
acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents:
104
diff
changeset
|
2 using AltNetHispano.Agendas.Domain.Exceptions; |
101
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
3 |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
4 namespace AltNetHispano.Agendas.Domain |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
5 { |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
6 public class EventoNullState : EventoState |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
7 { |
104 | 8 private EventoNullState() |
9 { | |
10 } | |
11 | |
12 private static readonly EventoState _instance = new EventoNullState(); | |
13 public static EventoState GetInstance() | |
14 { | |
15 return _instance; | |
16 } | |
17 | |
18 private const string Descripcion = "NullState"; | |
19 | |
103 | 20 public override void Promover(Evento evento, Accion accion) |
101
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
21 { |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
22 switch (accion) |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
23 { |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
24 case Accion.Proponer: |
104 | 25 evento.SetEstado(EventoPropuestoState.GetInstance()); |
103 | 26 evento.AddTrack(new Track(evento, Accion.Proponer)); |
101
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
27 break; |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
28 case Accion.Agendar: |
104 | 29 evento.SetEstado(EventoAgendadoState.GetInstance()); |
103 | 30 evento.AddTrack(new Track(evento, Accion.Agendar)); |
101
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
31 break; |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
32 default: |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
33 throw new AccionNoSoportadaException(this.GetType(), accion); |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
34 } |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
35 } |
103 | 36 |
37 public override string GetDescripcion() | |
38 { | |
104 | 39 return Descripcion; |
103 | 40 } |
116
53bcd338542b
acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents:
104
diff
changeset
|
41 |
53bcd338542b
acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents:
104
diff
changeset
|
42 public override bool PuedePromover(Accion accion) |
53bcd338542b
acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents:
104
diff
changeset
|
43 { |
53bcd338542b
acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents:
104
diff
changeset
|
44 return accion == Accion.Proponer || accion == Accion.Agendar; |
53bcd338542b
acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents:
104
diff
changeset
|
45 } |
101
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
46 } |
9bfdd5bf3ad2
Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff
changeset
|
47 } |