view Agendas/trunk/src/Agendas.Domain/EventoAgendadoState.cs @ 244:31fb96912d37

Ticket 162: Publicaciones con Nro Orden repetido.
author juanjose.montesdeocaarbos
date Thu, 06 Oct 2011 09:09:37 -0300
parents 3ca9fb66d397
children
line wrap: on
line source

using AltNetHispano.Agendas.Domain.Exceptions;

namespace AltNetHispano.Agendas.Domain
{
	public class EventoAgendadoState : EventoState
	{
		protected EventoAgendadoState()
		{
		}

		private static readonly EventoState _instance = new EventoAgendadoState();
		public static EventoState GetInstance()
		{
			return _instance;
		}

		public override void Promover(Evento evento, Accion accion)
		{
			switch (accion)
			{
				case Accion.Confirmar:
					evento.Estado=EventoConfirmadoState.GetInstance();
					evento.AddTrack(new Track(evento, Accion.Confirmar));
					break;
				case Accion.Cancelar:
					evento.Estado = EventoCanceladoState.GetInstance();
					evento.AddTrack(new Track(evento, Accion.Cancelar));
					break;
				default:
					throw new AccionNoSoportadaException(this.GetType(), accion);
			}
		}

		public override string Descripcion
		{
			get { return "Agendado"; }
		}

		public override bool PuedePromover(Accion accion)
		{
			return accion == Accion.Confirmar || accion == Accion.Cancelar || accion==Accion.Modificar;
		}
	}
}