annotate Agendas/trunk/src/Agendas.Domain/EventoAgendadoState.cs @ 128:1e47bf408073

Asignacion de los publicadores configurados en web.config al factory de agenda (mediante CompositePublicador)
author jorge.rowies
date Mon, 04 Jul 2011 20:00:51 -0300
parents 53bcd338542b
children 6f1041301797
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 EventoAgendadoState : EventoState
9bfdd5bf3ad2 Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff changeset
7 {
104
c5034884c7d7 refactor para que los estados sean singletons
jorge.rowies
parents: 103
diff changeset
8 private EventoAgendadoState()
c5034884c7d7 refactor para que los estados sean singletons
jorge.rowies
parents: 103
diff changeset
9 {
c5034884c7d7 refactor para que los estados sean singletons
jorge.rowies
parents: 103
diff changeset
10 }
c5034884c7d7 refactor para que los estados sean singletons
jorge.rowies
parents: 103
diff changeset
11
c5034884c7d7 refactor para que los estados sean singletons
jorge.rowies
parents: 103
diff changeset
12 private static readonly EventoState _instance = new EventoAgendadoState();
c5034884c7d7 refactor para que los estados sean singletons
jorge.rowies
parents: 103
diff changeset
13 public static EventoState GetInstance()
c5034884c7d7 refactor para que los estados sean singletons
jorge.rowies
parents: 103
diff changeset
14 {
c5034884c7d7 refactor para que los estados sean singletons
jorge.rowies
parents: 103
diff changeset
15 return _instance;
c5034884c7d7 refactor para que los estados sean singletons
jorge.rowies
parents: 103
diff changeset
16 }
c5034884c7d7 refactor para que los estados sean singletons
jorge.rowies
parents: 103
diff changeset
17
c5034884c7d7 refactor para que los estados sean singletons
jorge.rowies
parents: 103
diff changeset
18 private const string Descripcion = "Agendado";
101
9bfdd5bf3ad2 Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff changeset
19
103
23325dddddcc Persistencia del estado de los eventos
jorge.rowies
parents: 101
diff changeset
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.Confirmar:
104
c5034884c7d7 refactor para que los estados sean singletons
jorge.rowies
parents: 103
diff changeset
25 evento.SetEstado(EventoConfirmadoState.GetInstance());
103
23325dddddcc Persistencia del estado de los eventos
jorge.rowies
parents: 101
diff changeset
26 evento.AddTrack(new Track(evento, Accion.Confirmar));
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 default:
9bfdd5bf3ad2 Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff changeset
29 throw new AccionNoSoportadaException(this.GetType(), accion);
9bfdd5bf3ad2 Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff changeset
30 }
9bfdd5bf3ad2 Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff changeset
31 }
103
23325dddddcc Persistencia del estado de los eventos
jorge.rowies
parents: 101
diff changeset
32
23325dddddcc Persistencia del estado de los eventos
jorge.rowies
parents: 101
diff changeset
33 public override string GetDescripcion()
23325dddddcc Persistencia del estado de los eventos
jorge.rowies
parents: 101
diff changeset
34 {
23325dddddcc Persistencia del estado de los eventos
jorge.rowies
parents: 101
diff changeset
35 return Descripcion;
23325dddddcc Persistencia del estado de los eventos
jorge.rowies
parents: 101
diff changeset
36 }
116
53bcd338542b acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents: 104
diff changeset
37
53bcd338542b acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents: 104
diff changeset
38 public override bool PuedePromover(Accion accion)
53bcd338542b acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents: 104
diff changeset
39 {
53bcd338542b acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents: 104
diff changeset
40 return accion == Accion.Confirmar;
53bcd338542b acciones de confirmar y publicar desde la UI
Nelo@Kenia.neluz.int
parents: 104
diff changeset
41 }
101
9bfdd5bf3ad2 Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff changeset
42 }
9bfdd5bf3ad2 Manejo de estados de los Eventos mediante state pattern (primer version)
jorge.rowies
parents:
diff changeset
43 }