view Agendas/trunk/src/Agendas.Google/DetailsEvents/VanGEventDetail.cs @ 231:e5959f3405e0

Eventos sin ponentes
author nelopauselli
date Wed, 28 Sep 2011 20:02:44 -0300
parents 33976aea7546
children a6037c6c88d8
line wrap: on
line source

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using AltNetHispano.Agendas.Domain;

namespace AltNetHispano.Agendas.Google.DetailsEvents
{
    public class VanGEventDetail : IGEventDetail
    {
        private const string TextoVan =
           "La comunidad ALT.NET Hispano (http://altnethispano.org) realizará [EVENTO_TIPO] sobre [NOMBRE][NOMBRE_EXPOSITOR]." +
           "\n\rFecha: [FECHA] a las 18:00 hrs. Hora Internacional (GMT/UTC), con una duración aproximada de 2 horas." +
           "\n\rPueden plantear sus comentarios e inquietudes sobre el tema de la reunión en: [URL_DISCUCION]" +
           "\n\rPara mayor información sobre cómo atender la reunión consulten: http://tinyurl.com/van-hispano" +
           "\n\rPueden vincular el Google Calendar al suyo (http://screenr.com/nr7)";


        public string Title { get; private set; }
        public string Location { get; private set; }
        public string Summary { get; private set; }
        public DateTime StartEvent { get; private set; }
        public DateTime EndEvent { get; private set; }

        public void Generate(Evento evento)
        {
            Title = "VAN sobre " + evento.Titulo;
            Location = "http://snipr.com/virtualaltnet";
            StartEvent = evento.FechaInicio.Value;
            EndEvent = evento.FechaTermino.Value;
            var cultureInfo = new CultureInfo( "es-ES", false ).DateTimeFormat;

            Summary = TextoVan.Replace("[EVENTO_TIPO]", GetEventoTipo(evento.Tipo)).
				Replace("[NOMBRE]", evento.Titulo).
				Replace("[NOMBRE_EXPOSITOR]", GetPonentes(evento)).
                Replace("[FECHA]", StartEvent.ToString("D", cultureInfo)).
                Replace("[URL_DISCUCION]", evento.UrlInvitacion);
        }

    	private static string GetPonentes(Evento evento)
    	{
    		var ponentes = evento.GetPonentesAsString(p => p.Nombre);
    		return !string.IsNullOrWhiteSpace(ponentes) ? string.Format(", con {0}", ponentes) : string.Empty;
    	}

    	private static string GetEventoTipo(TipoEvento tipo)
    	{
			switch (tipo)
			{
				case TipoEvento.Van:
					return "una VAN";
				case TipoEvento.Cafe:
					return "un Café";
				case TipoEvento.GrupoEstudio:
					return "un Grupo de estudio";
				default:
					return string.Empty;
			}
		}
    }
}