# HG changeset patch # User ROWIES@ardejorxp.inworx.corp # Date 1305666296 10800 # Node ID ebce59b45b50795883808bce06933b148b0a4980 # Parent c40b97bbed01ab9ffb511bdf6339777115ab6c71 Agregado de version inicial del publicador para el blog diff -r c40b97bbed01 -r ebce59b45b50 Agendas/trunk/src/Agendas.Blog/Agendas.Blog.csproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Agendas.Blog.csproj Tue May 17 18:04:56 2011 -0300 @@ -0,0 +1,79 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {DDD605FF-EF42-428A-AEB6-F3496A46A82B} + Library + Properties + Agendas.Blog + Agendas.Blog + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + + + {A14907DF-02E4-4FA7-BE27-4292AF50AA22} + Agendas.Domain + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + + + \ No newline at end of file diff -r c40b97bbed01 -r ebce59b45b50 Agendas/trunk/src/Agendas.Blog/IPostWriter.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/IPostWriter.cs Tue May 17 18:04:56 2011 -0300 @@ -0,0 +1,9 @@ +using AltNetHispano.Agendas.Domain; + +namespace Agendas.Blog +{ + public interface IPostWriter + { + void WritePost(Evento evento); + } +} \ No newline at end of file diff -r c40b97bbed01 -r ebce59b45b50 Agendas/trunk/src/Agendas.Blog/IPostWriterFactory.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/IPostWriterFactory.cs Tue May 17 18:04:56 2011 -0300 @@ -0,0 +1,9 @@ +using AltNetHispano.Agendas.Domain; + +namespace Agendas.Blog +{ + public interface IPostWriterFactory + { + IPostWriter GetPostWriter(Accion accion); + } +} \ No newline at end of file diff -r c40b97bbed01 -r ebce59b45b50 Agendas/trunk/src/Agendas.Blog/Impl/BlogPublicador.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Impl/BlogPublicador.cs Tue May 17 18:04:56 2011 -0300 @@ -0,0 +1,20 @@ +using AltNetHispano.Agendas.Domain; + +namespace Agendas.Blog.Impl +{ + public class BlogPublicador : IPublicador + { + private readonly IPostWriterFactory _postWriterFactory; + + public BlogPublicador(IPostWriterFactory postWriterFactory) + { + _postWriterFactory = postWriterFactory; + } + + public void Publicar(Evento evento) + { + foreach (var track in evento.Tracks) + _postWriterFactory.GetPostWriter(track.Accion).WritePost(evento); + } + } +} diff -r c40b97bbed01 -r ebce59b45b50 Agendas/trunk/src/Agendas.Blog/Impl/NullObjectPostWriter.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Impl/NullObjectPostWriter.cs Tue May 17 18:04:56 2011 -0300 @@ -0,0 +1,22 @@ +using AltNetHispano.Agendas.Domain; + +namespace Agendas.Blog.Impl +{ + public class NullObjectPostWriter : PostWriter + { + public override void WritePost(Evento evento) + { + //no-op + } + + protected override string GetBody(Evento evento) + { + throw new System.NotImplementedException(); + } + + protected override string GetTitle(Evento evento) + { + throw new System.NotImplementedException(); + } + } +} \ No newline at end of file diff -r c40b97bbed01 -r ebce59b45b50 Agendas/trunk/src/Agendas.Blog/Impl/PostWriter.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Impl/PostWriter.cs Tue May 17 18:04:56 2011 -0300 @@ -0,0 +1,31 @@ +using System; +using AltNetHispano.Agendas.Domain; + +namespace Agendas.Blog.Impl +{ + public abstract class PostWriter : IPostWriter + { + public virtual void WritePost(Evento evento) + { + var title = GetTitle(evento); + var body = GetBody(evento); + this.ExecuteService(title, body); + } + + protected abstract string GetBody(Evento evento); + + protected abstract string GetTitle(Evento evento); + + protected string GetNombreUsuario(Evento evento) + { + return string.Empty; + //return evento.Tracks.Single(t => t.Accion == Accion.Realizar).Usuario; TODO (property Usuario debe ser publica) + } + + protected void ExecuteService(string title, string body) + { + //TODO: invocar al web service + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff -r c40b97bbed01 -r ebce59b45b50 Agendas/trunk/src/Agendas.Blog/Impl/PostWriterFactory.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Impl/PostWriterFactory.cs Tue May 17 18:04:56 2011 -0300 @@ -0,0 +1,20 @@ +using AltNetHispano.Agendas.Domain; + +namespace Agendas.Blog.Impl +{ + public class PostWriterFactory : IPostWriterFactory + { + public IPostWriter GetPostWriter(Accion accion) + { + switch (accion) + { + case Accion.Realizar: + return new RealizarReunionPostWriter(); + case Accion.Publicar: + return new PublicarReunionPostWriter(); + default: + return new NullObjectPostWriter(); + } + } + } +} diff -r c40b97bbed01 -r ebce59b45b50 Agendas/trunk/src/Agendas.Blog/Impl/PublicarReunionPostWriter.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Impl/PublicarReunionPostWriter.cs Tue May 17 18:04:56 2011 -0300 @@ -0,0 +1,33 @@ +using System; +using System.Globalization; +using Agendas.Blog.Properties; +using AltNetHispano.Agendas.Domain; + +namespace Agendas.Blog.Impl +{ + public class PublicarReunionPostWriter : PostWriter + { + protected override string GetTitle(Evento evento) + { + return string.Format(CultureInfo.InvariantCulture, Resources.VAN_Publicacion_Title, + string.Empty, //# de VAN en el historial TODO + evento.Ponente.Nombre //Nombre y apellido del ponente + + ); + } + + protected override string GetBody(Evento evento) + { + return string.Format(CultureInfo.InvariantCulture, Resources.VAN_Realizacion_Body, + getUrlPublicacionEnWiki(evento), //Url al video publicado en la wiki + GetNombreUsuario(evento) //Usuario que postea en el blog + ); + } + + private string getUrlPublicacionEnWiki(Evento evento) + { + //TODO + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff -r c40b97bbed01 -r ebce59b45b50 Agendas/trunk/src/Agendas.Blog/Impl/RealizarReunionPostWriter.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Impl/RealizarReunionPostWriter.cs Tue May 17 18:04:56 2011 -0300 @@ -0,0 +1,50 @@ +using System; +using System.Globalization; +using Agendas.Blog.Properties; +using AltNetHispano.Agendas.Domain; +using System.Linq; + +namespace Agendas.Blog.Impl +{ + public class RealizarReunionPostWriter : PostWriter + { + 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 + getUrlThreadListaCorreo(evento), //Url al 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 getUrlThreadListaCorreo(Evento evento) + { + return string.Format(CultureInfo.InvariantCulture, Resources.VAN_Realizacion_Body_UrlListaCorreo, + string.Empty /*evento.UrlListaCorreo*/);//TODO + } + } +} \ No newline at end of file diff -r c40b97bbed01 -r ebce59b45b50 Agendas/trunk/src/Agendas.Blog/Properties/AssemblyInfo.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Properties/AssemblyInfo.cs Tue May 17 18:04:56 2011 -0300 @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Agendas.Blog")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Inworx IT Solutions")] +[assembly: AssemblyProduct("Agendas.Blog")] +[assembly: AssemblyCopyright("Copyright © Inworx IT Solutions 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("07426378-5e93-4122-b92f-a0c300d5cd7a")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff -r c40b97bbed01 -r ebce59b45b50 Agendas/trunk/src/Agendas.Blog/Properties/Resources.Designer.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Properties/Resources.Designer.cs Tue May 17 18:04:56 2011 -0300 @@ -0,0 +1,123 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.225 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Agendas.Blog.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Agendas.Blog.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to <p>Ya está publicada la grabación de esta VAN en: </p> + ///<p><a href="{0}">{0}</a></p> + ///<br /> + ///<p> </p> + ///<p>En nombre de la comunidad ALT.NET Hispano,</p> + ///<p>{1}</p> + ///<p></p>. + /// + internal static string VAN_Publicacion_Body { + get { + return ResourceManager.GetString("VAN_Publicacion_Body", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Publicada la grabación de la VAN #{0} - {1}. + /// + internal static string VAN_Publicacion_Title { + get { + return ResourceManager.GetString("VAN_Publicacion_Title", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <p>El día {0}, {1} presentará en una nueva VAN el tema "{2}"</p> + ///{3} + ///<p>&nbsp;</p> + ///<p>Para acceder, pueden hacerlo por live meeting mediante alguno de los siguientes enlaces:</p> + ///<p><a href="http://snipr.com/virtualaltnet">http://snipr.com/virtualaltnet </a></p> + ///<p><a href="https://www323.livemeeting.com/cc/usergroups/join?id=van&amp;role=attend">https://www323.livemeeting.com/cc/usergroups/join?id=van&amp;role=attend</a></p> + ///<p>&nbsp;</p> + ///<p>Más información sobre las reuniones virtuales de la comuni [rest of string was truncated]";. + /// + internal static string VAN_Realizacion_Body { + get { + return ResourceManager.GetString("VAN_Realizacion_Body", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <p>En el siguiente enlace a la lista de correos, podrán encontrar el detalle de los temas a tratar:</p> + ///<p><a href="{0}">{0}</a></p> + ///<p></p>. + /// + internal static string VAN_Realizacion_Body_UrlListaCorreo { + get { + return ResourceManager.GetString("VAN_Realizacion_Body_UrlListaCorreo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Presentación de VAN con {0} - {1}. + /// + internal static string VAN_Realizacion_Title { + get { + return ResourceManager.GetString("VAN_Realizacion_Title", resourceCulture); + } + } + } +} diff -r c40b97bbed01 -r ebce59b45b50 Agendas/trunk/src/Agendas.Blog/Properties/Resources.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Blog/Properties/Resources.resx Tue May 17 18:04:56 2011 -0300 @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + <p>Ya está publicada la grabación de esta VAN en: </p> +<p><a href="{0}">{0}</a></p> +<br /> +<p> </p> +<p>En nombre de la comunidad ALT.NET Hispano,</p> +<p>{1}</p> +<p></p> + + + Publicada la grabación de la VAN #{0} - {1} + + + <p>El día {0}, {1} presentará en una nueva VAN el tema "{2}"</p> +{3} +<p>&nbsp;</p> +<p>Para acceder, pueden hacerlo por live meeting mediante alguno de los siguientes enlaces:</p> +<p><a href="http://snipr.com/virtualaltnet">http://snipr.com/virtualaltnet </a></p> +<p><a href="https://www323.livemeeting.com/cc/usergroups/join?id=van&amp;role=attend">https://www323.livemeeting.com/cc/usergroups/join?id=van&amp;role=attend</a></p> +<p>&nbsp;</p> +<p>Más información sobre las reuniones virtuales de la comunidad:</p> +<p><a href="../../reuniones/descripcion.aspx">http://altnethispano.org/reuniones/descripcion.aspx</a></p> +<p> </p> +<p></p> +<p>En nombre de la comunidad ALT.NET Hispano,</p> +<p>{4}</p> + + + <p>En el siguiente enlace a la lista de correos, podrán encontrar el detalle de los temas a tratar:</p> +<p><a href="{0}">{0}</a></p> +<p></p> + + + Presentación de VAN con {0} - {1} + + \ No newline at end of file diff -r c40b97bbed01 -r ebce59b45b50 Agendas/trunk/src/Agendas.Tests/Agendas.Tests.csproj --- a/Agendas/trunk/src/Agendas.Tests/Agendas.Tests.csproj Tue May 17 01:55:19 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Tests/Agendas.Tests.csproj Tue May 17 18:04:56 2011 -0300 @@ -53,6 +53,7 @@ + diff -r c40b97bbed01 -r ebce59b45b50 Agendas/trunk/src/Agendas.Tests/DateTimeFormattingTests.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Tests/DateTimeFormattingTests.cs Tue May 17 18:04:56 2011 -0300 @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Linq; +using System.Text; +using NUnit.Framework; + +namespace AltNetHispano.Agendas.Tests +{ + [TestFixture] + public class DateTimeFormattingTests + { + [Test] + public void la_fecha_debe_formatearse_en_castellano() + { + var fecha = new DateTime(2010, 11, 20, 18, 0, 0); + Assert.AreEqual("sábado, 20 de noviembre de 2010", fecha.ToString("D", CultureInfo.CreateSpecificCulture("es-ES"))); + } + + [Test] + public void la_hora_debe_expresarse_en_24hs() + { + var fecha = new DateTime(2010, 11, 20, 18, 0, 0); + Assert.AreEqual("18:00", fecha.ToString("t", CultureInfo.CreateSpecificCulture("es-ES"))); + } + } + +} diff -r c40b97bbed01 -r ebce59b45b50 Agendas/trunk/src/Agendas.sln --- a/Agendas/trunk/src/Agendas.sln Tue May 17 01:55:19 2011 -0300 +++ b/Agendas/trunk/src/Agendas.sln Tue May 17 18:04:56 2011 -0300 @@ -22,6 +22,8 @@ Features.txt = Features.txt EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Agendas.Blog", "Agendas.Blog\Agendas.Blog.csproj", "{DDD605FF-EF42-428A-AEB6-F3496A46A82B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -56,6 +58,10 @@ {306DDA8A-49A5-42E5-A639-A9D3D521865F}.Debug|Any CPU.Build.0 = Debug|Any CPU {306DDA8A-49A5-42E5-A639-A9D3D521865F}.Release|Any CPU.ActiveCfg = Release|Any CPU {306DDA8A-49A5-42E5-A639-A9D3D521865F}.Release|Any CPU.Build.0 = Release|Any CPU + {DDD605FF-EF42-428A-AEB6-F3496A46A82B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DDD605FF-EF42-428A-AEB6-F3496A46A82B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DDD605FF-EF42-428A-AEB6-F3496A46A82B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DDD605FF-EF42-428A-AEB6-F3496A46A82B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE