view Agendas/trunk/src/Agendas.Domain/EventoCanceladoState.cs @ 282:bc8dfbde0523

#123: Patrocinadores de las vans: Se verifica que para publicar una Van, debe tener al menos un Patrocinador.
author juanjose.montesdeocaarbos
date Mon, 26 Dec 2011 14:21:44 -0300
parents 3639803112c6
children
line wrap: on
line source

using System;
using AltNetHispano.Agendas.Domain.Exceptions;

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

		private static readonly EventoState _instance = new EventoCanceladoState();

		public static EventoState GetInstance()
		{
			return _instance;
		}

		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 Descripcion
		{
			get { return "Cancelado"; }
		}

		public override bool PuedePromover(Accion accion)
		{
			return accion == Accion.Descartar || accion == Accion.ReAgendar || accion == Accion.ReProponer;
		}
	}
}