view Agendas/trunk/src/Agendas.Blog/Impl/AgendarReunionPostWriter.cs @ 105:1d820f17fc75

ajustes y correcciones en el publicador de blogs agregado de numeroOrden y urlWiki en metodo Publicar de Agenda y Evento (con test)
author jorge.rowies
date Mon, 06 Jun 2011 09:12:52 -0300
parents cc91817a4206
children 80c22175c9b5
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(Track track)
		{
			return string.Format(CultureInfo.InvariantCulture, Resources.VAN_Realizacion_Title,
													 track.Evento.Ponente.Nombre, //Nombre y apellido del ponente
													 track.Evento.Titulo //Tema a tratar en la reunion
				);
		}

    protected override string GetBody(Track track)
		{
			var fecha = getFechaFormateada(track.Evento.Fecha);
			return string.Format(CultureInfo.InvariantCulture, Resources.VAN_Realizacion_Body,
													 fecha, //Fecha y hora en GMT+0
													 track.Evento.Ponente.Nombre, //Nombre y apellido del ponente
													 track.Evento.Titulo, //Tema a tratar en la reunion
													 getUrlInvitacion(track.Evento), //Url a la invitacion realizada por el ponente (por lo general es el thread en la lista de correo)
													 GetNombreUsuario(track) //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;
		}
	}
}