view Agendas/trunk/src/Agendas.Blog/Impl/PublicarReunionPostWriter.cs @ 257:730b80afa70d

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

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

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

    protected override string GetTitle(Track track)
    {
      string resourceName = getTitleResourceName(track);

      return string.Format(CultureInfo.InvariantCulture, resourceName,
                           track.Evento.NumeroOrden, //# de VAN en el historial
                           track.Evento.Titulo //Titulo del evento

        );
    }

    private string getTitleResourceName(Track track)
    {
      string resourceName;
      if (track.Evento.Tipo == TipoEvento.Van)
        resourceName = Resources.VAN_Publicar_Title;
      else if (track.Evento.Tipo == TipoEvento.Cafe)
        resourceName = Resources.Cafe_Publicar_Title;
      else
        throw new TipoEventoNoSoportadoException(track.Evento.Tipo.ToString());

      return resourceName;
    }

    protected override string GetBody(Track track)
    {
      string resourceName = getBodyResourceName(track);

      return string.Format(CultureInfo.InvariantCulture, resourceName,
													 track.Evento.UrlWiki, //Url al video publicado en la wiki
                           GetNombreUsuario(track) //Usuario que postea en el blog
        );
    }

    private string getBodyResourceName(Track track)
    {
      string resourceName;
      if (track.Evento.Tipo == TipoEvento.Van)
        resourceName = Resources.VAN_Publicar_Body;
      else if (track.Evento.Tipo == TipoEvento.Cafe)
        resourceName = Resources.Cafe_Publicar_Body;
      else
        throw new TipoEventoNoSoportadoException(track.Evento.Tipo.ToString());

      return resourceName;
    }
  }
}