view Agendas/trunk/src/Agendas.Blog/Impl/AgendarReunionPostWriter.cs @ 100:cc91817a4206

Merge
author jorge.rowies
date Sat, 04 Jun 2011 22:46:06 -0300
parents 3027c64344bd 2434c2323f3d
children 1d820f17fc75
line wrap: on
line source

using System;
using System.Globalization;
using Agendas.Blog.Properties;
using AltNetHispano.Agendas.Domain;
using System.Linq;

namespace Agendas.Blog.Impl
{
	public class AgendarReunionPostWriter : PostWriter
	{
	  public AgendarReunionPostWriter(IPostWriterWebService postWriterWebService) : base(postWriterWebService)
	  {
	  }

	  protected override string GetTitle(Evento evento)
		{
			return string.Format(CultureInfo.InvariantCulture, Resources.VAN_Realizacion_Title,
													 evento.Ponente.Nombre, //Nombre y apellido del ponente
													 evento.Titulo //Tema a tratar en la reunion
				);
		}

		protected override string GetBody(Evento evento)
		{
			var fecha = getFechaFormateada(evento.Fecha);
			return string.Format(CultureInfo.InvariantCulture, Resources.VAN_Realizacion_Body,
													 fecha, //Fecha y hora en GMT+0
													 evento.Ponente.Nombre, //Nombre y apellido del ponente
													 evento.Titulo, //Tema a tratar en la reunion
													 getUrlInvitacion(evento), //Url a la invitacion realizada por el ponente (por lo general es el thread en la lista de correo)
													 GetNombreUsuario(evento) //Usuario que postea en el blog
				);
		}

		private string getFechaFormateada(DateTime? fecha)
		{
			if (fecha == null)
				throw new ArgumentNullException("fecha");

			var fechaCast = (DateTime)fecha;
			var culture = CultureInfo.CreateSpecificCulture("es-ES");
			var result = fechaCast.ToString("D", culture) + " a las " +
										 fechaCast.ToString("t", culture) + " UTC/GMT";

			return result;
		}

		private string getUrlInvitacion(Evento evento)
		{
			if (!string.IsNullOrEmpty(evento.UrlInvitacion))
			{
				return string.Format(CultureInfo.InvariantCulture, Resources.VAN_Realizacion_Body_UrlListaCorreo,
														 evento.UrlInvitacion); 
			}

			return string.Empty;
		}
	}
}