view Agendas/trunk/src/Agendas.Domain/EventoNullState.cs @ 257:730b80afa70d

Ticket #191: Perfil de Usuarios
author juanjose.montesdeocaarbos
date Wed, 19 Oct 2011 09:19:20 -0300
parents 3639803112c6
children
line wrap: on
line source

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

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

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

		public override void Promover(Evento evento, Accion accion)
		{
			switch (accion)
			{
				case Accion.Proponer:
					evento.Estado = EventoPropuestoState.GetInstance();
					evento.AddTrack(new Track(evento, Accion.Proponer));
					break;
				case Accion.Agendar:
					evento.Estado = EventoAgendadoState.GetInstance();
					evento.AddTrack(new Track(evento, Accion.Agendar));
					break;
				default:
					throw new AccionNoSoportadaException(this.GetType(), accion);
			}
		}

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

		public override bool PuedePromover(Accion accion)
		{
			return accion == Accion.Proponer || accion == Accion.Agendar;
		}
	}
}