diff --git a/Notification/EventHandlers/Forum.cs b/Notification/EventHandlers/Forum.cs deleted file mode 100644 index cfeeb78e..00000000 --- a/Notification/EventHandlers/Forum.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using uForum.Businesslogic; - -namespace NotificationsCore.EventHandlers -{ - public class Forum : umbraco.BusinessLogic.ApplicationBase - { - public Forum() - { - Comment.AfterCreate += new EventHandler(Comment_AfterCreate); - } - - void Comment_AfterCreate(object sender, uForum.Businesslogic.CreateEventArgs e) - { - Comment c = (Comment)sender; - - //InstantNotification.Execute("NewComment", c.Id); - } - } -} diff --git a/Notification/InstantNotification.cs b/Notification/InstantNotification.cs deleted file mode 100644 index 56f15e4a..00000000 --- a/Notification/InstantNotification.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Xml; -using System.Reflection; - -namespace NotificationsCore -{ - public class InstantNotification - { - private delegate void ExecuteDelegate(string config, string assemblydir, string name, params object[] args); - private ExecuteDelegate ed; - - public InstantNotification() - { - ed = new ExecuteDelegate(this.Execute); - } - - public void Invoke(string config, string assemblydir, string name, params object[] args) - { - ed.BeginInvoke(config, assemblydir, name, args, null, null); - } - - public void Execute(string config,string assemblydir, string name, params object[] args) - { - try - { - XmlDocument notifications = new XmlDocument(); - notifications.Load(config); - - XmlNode settings = notifications.SelectSingleNode("//global"); - - XmlNode node = notifications.SelectSingleNode( - string.Format("//instant//notification [@name = '{0}']", name)); - - XmlDocument details = new XmlDocument(); - XmlNode cont = details.CreateElement("details"); - - cont.AppendChild(details.ImportNode(settings,true)); - cont.AppendChild(details.ImportNode(node,true)); - - details.AppendChild(cont); - - if (node != null) - { - - - string assemblyFile = - String.Format("{0}{1}.dll", assemblydir, node.Attributes["assembly"].Value); - - Assembly nAssembly = System.Reflection.Assembly.LoadFrom(assemblyFile); - - Notification n = - (Notification)Activator.CreateInstance( - nAssembly.GetType(node.Attributes["type"].Value)); - - n.SendNotification(details, args); - } - else - { - umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, 666, "not found"); - } - - } - catch (Exception e) - { - umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, 666, e.Message); - } - } - } -} diff --git a/Notification/Interfaces/INotification.cs b/Notification/Interfaces/INotification.cs deleted file mode 100644 index 5f1457ac..00000000 --- a/Notification/Interfaces/INotification.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace NotificationsCore.Interfaces -{ - interface INotification - { - bool SendNotification(XmlNode details, params object[] args); - } -} diff --git a/Notification/Notification.cs b/Notification/Notification.cs deleted file mode 100644 index ae7fb55e..00000000 --- a/Notification/Notification.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using NotificationsCore.Interfaces; -using System.Xml; - -namespace NotificationsCore -{ - public abstract class Notification: INotification - { - #region INotification Members - - public virtual bool SendNotification(XmlNode details, params object[] args) { return false; } - - #endregion - } -} diff --git a/Notification/Notification.csproj b/Notification/Notification.csproj deleted file mode 100644 index 82f61fc7..00000000 --- a/Notification/Notification.csproj +++ /dev/null @@ -1,294 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2} - Library - Properties - NotificationsCore - NotificationsCore - v4.5.1 - 512 - - - - - 3.5 - - ..\ - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - - ..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.dll - True - - - ..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.Net4.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\businesslogic.dll - True - - - ..\packages\ClientDependency.1.8.4\lib\net45\ClientDependency.Core.dll - True - - - ..\packages\ClientDependency-Mvc5.1.8.0.0\lib\net45\ClientDependency.Core.Mvc.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\cms.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\controls.dll - True - - - ..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll - True - - - ..\packages\Examine.0.1.68.0\lib\Examine.dll - True - - - ..\packages\HtmlAgilityPack.1.4.9\lib\Net45\HtmlAgilityPack.dll - True - - - ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - True - - - ..\packages\ImageProcessor.2.3.3.0\lib\net45\ImageProcessor.dll - True - - - ..\packages\ImageProcessor.Web.4.5.3.0\lib\net45\ImageProcessor.Web.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\interfaces.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\log4net.dll - True - - - ..\packages\Lucene.Net.2.9.4.1\lib\net40\Lucene.Net.dll - True - - - ..\packages\Markdown.1.14.4\lib\net45\MarkdownSharp.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\Microsoft.ApplicationBlocks.Data.dll - True - - - ..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll - True - - - ..\packages\Microsoft.AspNet.Identity.Owin.2.2.1\lib\net45\Microsoft.AspNet.Identity.Owin.dll - True - - - ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll - True - - - ..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll - True - - - ..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll - True - - - ..\packages\Microsoft.Owin.Security.Cookies.3.0.1\lib\net45\Microsoft.Owin.Security.Cookies.dll - True - - - ..\packages\Microsoft.Owin.Security.OAuth.3.0.1\lib\net45\Microsoft.Owin.Security.OAuth.dll - True - - - ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - True - - - ..\packages\MiniProfiler.2.1.0\lib\net40\MiniProfiler.dll - True - - - ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll - True - - - ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - True - - - ..\packages\Owin.1.0\lib\net40\Owin.dll - True - - - ..\packages\semver.1.1.2\lib\net451\Semver.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\SQLCE4Umbraco.dll - True - - - - - 3.5 - - - - ..\packages\UmbracoCms.Core.7.4.2\lib\System.Data.SqlServerCe.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\System.Data.SqlServerCe.Entity.dll - True - - - - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll - True - - - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll - True - - - ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll - True - - - ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll - True - - - ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll - True - - - ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll - True - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll - True - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll - True - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll - True - - - - ..\packages\UmbracoCms.Core.7.4.2\lib\TidyNet.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\umbraco.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\Umbraco.Core.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\umbraco.DataLayer.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\umbraco.editorControls.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\umbraco.MacroEngines.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\umbraco.providers.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\Umbraco.Web.UI.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\UmbracoExamine.dll - True - - - ..\packages\UrlRewritingNet.2.0.7\lib\UrlRewritingNet.UrlRewriter.dll - True - - - - - - - - - - - - - - - - - - {a8e5c936-ecab-45b3-bfda-d12f680eb2a6} - OurUmbraco - - - - - \ No newline at end of file diff --git a/Notification/NotificationExecuter.cs b/Notification/NotificationExecuter.cs deleted file mode 100644 index b0b84c02..00000000 --- a/Notification/NotificationExecuter.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Timers; -using System.Reflection; -using System.Xml; - - -namespace NotificationsCore -{ - public class NotificationExecuter - { - public string Name { get; set; } - public double Interval { get; set; } - public string Assembly { get; set; } - public string Type { get; set; } - public XmlNode Details { get; set; } - - Timer timer = new Timer(); - - public NotificationExecuter(string name, double interval, string assembly, string type, XmlNode details) - { - this.Name = name; - this.Interval = interval; - this.Assembly = assembly; - this.Type = type; - this.Details = details; - } - public void Start() - { - timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); - timer.Interval = Interval; - timer.Enabled = true; - - } - - void timer_Elapsed(object sender, ElapsedEventArgs e) - { - string assemblyFile = - String.Format("{0}.dll", Assembly); - - Assembly nAssembly = System.Reflection.Assembly.LoadFrom(assemblyFile); - - Notification n = - (Notification)Activator.CreateInstance( - nAssembly.GetType(Type)); - - n.SendNotification(Details); - - } - } -} diff --git a/Notification/Properties/AssemblyInfo.cs b/Notification/Properties/AssemblyInfo.cs deleted file mode 100644 index 27c8bfda..00000000 --- a/Notification/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -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("Notification")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Notification")] -[assembly: AssemblyCopyright("Copyright © 2010")] -[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("df83d509-8920-49a4-a9e0-41665d8bfa42")] - -// 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 --git a/Notification/SheduledNotification.cs b/Notification/SheduledNotification.cs deleted file mode 100644 index 60963039..00000000 --- a/Notification/SheduledNotification.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Timers; -using System.Reflection; -using System.Xml; - - -namespace NotificationsCore -{ - public class SheduledNotification - { - public string Name { get; set; } - public double Interval { get; set; } - public string Assembly { get; set; } - public string Type { get; set; } - public XmlNode Details { get; set; } - - Timer timer = new Timer(); - - public SheduledNotification(string name, double interval, string assembly, string type, XmlNode details) - { - this.Name = name; - this.Interval = interval; - this.Assembly = assembly; - this.Type = type; - this.Details = details; - } - public void Start() - { - timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); - timer.Interval = Interval; - timer.Enabled = true; - - } - - void timer_Elapsed(object sender, ElapsedEventArgs e) - { - string assemblyFile = - String.Format("{0}.dll", Assembly); - - Assembly nAssembly = System.Reflection.Assembly.LoadFrom(assemblyFile); - - Notification n = - (Notification)Activator.CreateInstance( - nAssembly.GetType(Type)); - - n.SendNotification(Details); - - } - } -} diff --git a/Notification/app.config b/Notification/app.config deleted file mode 100644 index edfccc1b..00000000 --- a/Notification/app.config +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Notification/packages.config b/Notification/packages.config deleted file mode 100644 index 4e916ada..00000000 --- a/Notification/packages.config +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NotificationMailer/App.config b/NotificationMailer/App.config deleted file mode 100644 index c32441b1..00000000 --- a/NotificationMailer/App.config +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - diff --git a/NotificationMailer/Notification.config b/NotificationMailer/Notification.config deleted file mode 100644 index 80ea9e03..00000000 --- a/NotificationMailer/Notification.config +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - Our umbraco - robot@umbraco.org - - There has been a new post - There has been a new post - - - - - - Our umbraco - robot@umbraco.org - - There has been a new post - There has been a new post - - - - \ No newline at end of file diff --git a/NotificationMailer/NotificationExecuter.cs b/NotificationMailer/NotificationExecuter.cs deleted file mode 100644 index ca86df42..00000000 --- a/NotificationMailer/NotificationExecuter.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Timers; -using System.Reflection; -using Notifications; -using System.Xml; - - -namespace NotificationMailer -{ - public class NotificationExecuter - { - public string Name { get; set; } - public double Interval { get; set; } - public string Assembly { get; set; } - public string Type { get; set; } - public XmlNode Details { get; set; } - - Timer timer = new Timer(); - - public NotificationExecuter(string name, double interval, string assembly, string type, XmlNode details) - { - this.Name = name; - this.Interval = interval; - this.Assembly = assembly; - this.Type = type; - this.Details = details; - } - public void Start() - { - timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); - timer.Interval = Interval; - timer.Enabled = true; - - } - - void timer_Elapsed(object sender, ElapsedEventArgs e) - { - string assemblyFile = - String.Format("{0}.dll", Assembly); - - Assembly nAssembly = System.Reflection.Assembly.LoadFrom(assemblyFile); - - Notification n = - (Notification)Activator.CreateInstance( - nAssembly.GetType(Type)); - - n.SendNotification(Details); - - } - } -} diff --git a/NotificationMailer/NotificationMailer.csproj b/NotificationMailer/NotificationMailer.csproj deleted file mode 100644 index 76f2d345..00000000 --- a/NotificationMailer/NotificationMailer.csproj +++ /dev/null @@ -1,85 +0,0 @@ - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {F41D51B7-3ECF-4C4C-955E-6E761345E18E} - WinExe - Properties - NotificationMailer - NotificationMailer - v4.5.1 - 512 - - - 3.5 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - - - - - - - - - - Component - - - NotificationService.cs - - - - Component - - - ProjectInstaller.cs - - - - - - Designer - - - - - NotificationService.cs - - - ProjectInstaller.cs - - - - - \ No newline at end of file diff --git a/NotificationMailer/NotificationService.Designer.cs b/NotificationMailer/NotificationService.Designer.cs deleted file mode 100644 index 122ae666..00000000 --- a/NotificationMailer/NotificationService.Designer.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace NotificationMailer -{ - partial class NotificationService - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - // - // NotificationService - // - this.ServiceName = "NotificationService"; - - } - - #endregion - } -} diff --git a/NotificationMailer/NotificationService.cs b/NotificationMailer/NotificationService.cs deleted file mode 100644 index 8f841725..00000000 --- a/NotificationMailer/NotificationService.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Diagnostics; -using System.ServiceProcess; -using System.Text; -using System.Xml; -using System.Configuration; -using System.Threading; -using System.Net; - -namespace NotificationMailer -{ - public partial class NotificationService : ServiceBase - { - - public NotificationService() - { - InitializeComponent(); - } - - protected override void OnStart(string[] args) - { - - System.Timers.Timer timer = new System.Timers.Timer(); - - timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); - timer.Interval = double.Parse(ConfigurationSettings.AppSettings["interval"]); - timer.Enabled = true; - - timer.Start(); - - - //XmlDocument notifications = new XmlDocument(); - //notifications.Load(ConfigurationSettings.AppSettings["configFile"]); - - //XmlNode settings = notifications.SelectSingleNode("//global"); - - //XmlNodeList xnl = notifications.SelectNodes("//sheduled//notification"); - //foreach (XmlNode node in xnl) - //{ - // XmlDocument details = new XmlDocument(); - // XmlNode cont = details.CreateElement("details"); - - // cont.AppendChild(details.ImportNode(settings, true)); - // cont.AppendChild(details.ImportNode(node, true)); - - // details.AppendChild(cont); - - // SheduledNotification n = - // new SheduledNotification( - // node.Attributes["name"].Value, - // double.Parse(node.Attributes["interval"].Value), - // node.Attributes["assembly"].Value, - // node.Attributes["type"].Value, - // details); - - // Thread nThread = new Thread(new ThreadStart(n.Start)); - // nThread.Start(); - - //} - } - - void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) - { - HttpWebRequest request = (HttpWebRequest) - WebRequest.Create(ConfigurationSettings.AppSettings["url"]); - - HttpWebResponse response = (HttpWebResponse) - request.GetResponse(); - - - } - - protected override void OnStop() - { - } - - - //public static string GetNodeValue(XmlNode n) - //{ - // if (n == null || n.FirstChild == null) - // return string.Empty; - // return n.FirstChild.Value; - //} - } -} diff --git a/NotificationMailer/NotificationService.resx b/NotificationMailer/NotificationService.resx deleted file mode 100644 index 3e82cf3c..00000000 --- a/NotificationMailer/NotificationService.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - \ No newline at end of file diff --git a/NotificationMailer/Program.cs b/NotificationMailer/Program.cs deleted file mode 100644 index ddcb2bc1..00000000 --- a/NotificationMailer/Program.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ServiceProcess; -using System.Text; - -namespace NotificationMailer -{ - static class Program - { - /// - /// The main entry point for the application. - /// - static void Main() - { - ServiceBase[] ServicesToRun; - ServicesToRun = new ServiceBase[] - { - new NotificationService() - }; - ServiceBase.Run(ServicesToRun); - } - } -} diff --git a/NotificationMailer/ProjectInstaller.Designer.cs b/NotificationMailer/ProjectInstaller.Designer.cs deleted file mode 100644 index 3a3798c3..00000000 --- a/NotificationMailer/ProjectInstaller.Designer.cs +++ /dev/null @@ -1,58 +0,0 @@ -namespace NotificationMailer -{ - partial class ProjectInstaller - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller(); - this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller(); - // - // serviceProcessInstaller1 - // - this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem; - this.serviceProcessInstaller1.Password = null; - this.serviceProcessInstaller1.Username = null; - // - // serviceInstaller1 - // - this.serviceInstaller1.ServiceName = "NotificationService"; - this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic; - // - // ProjectInstaller - // - this.Installers.AddRange(new System.Configuration.Install.Installer[] { - this.serviceProcessInstaller1, - this.serviceInstaller1}); - - } - - #endregion - - private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1; - private System.ServiceProcess.ServiceInstaller serviceInstaller1; - } -} \ No newline at end of file diff --git a/NotificationMailer/ProjectInstaller.cs b/NotificationMailer/ProjectInstaller.cs deleted file mode 100644 index e6929013..00000000 --- a/NotificationMailer/ProjectInstaller.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Configuration.Install; -using System.Linq; - - -namespace NotificationMailer -{ - [RunInstaller(true)] - public partial class ProjectInstaller : System.Configuration.Install.Installer - { - public ProjectInstaller() - { - InitializeComponent(); - } - } -} diff --git a/NotificationMailer/ProjectInstaller.resx b/NotificationMailer/ProjectInstaller.resx deleted file mode 100644 index 2c68f57b..00000000 --- a/NotificationMailer/ProjectInstaller.resx +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 196, 17 - - - False - - \ No newline at end of file diff --git a/NotificationMailer/Properties/AssemblyInfo.cs b/NotificationMailer/Properties/AssemblyInfo.cs deleted file mode 100644 index b7d6735c..00000000 --- a/NotificationMailer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -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("NotificationMailer")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("NotificationMailer")] -[assembly: AssemblyCopyright("Copyright © 2010")] -[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("d9a67c91-946c-4774-b7d7-dc4f97a17a1d")] - -// 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 --git a/NotificationsWeb/Config.cs b/NotificationsWeb/Config.cs deleted file mode 100644 index a0a5e2cc..00000000 --- a/NotificationsWeb/Config.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.IO; - -namespace NotificationsWeb -{ - public class Config - { - private static string _path = umbraco.GlobalSettings.FullpathToRoot + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar; - private static string _filename = "Notification.config"; - - public static string AssemblyDir - { - get - { - return umbraco.GlobalSettings.FullpathToRoot + Path.DirectorySeparatorChar + "bin" + Path.DirectorySeparatorChar; - } - } - - - public static string ConfigurationFile - { - get - { - return _path + _filename; - } - } - } -} diff --git a/NotificationsWeb/NotificationsWeb.csproj b/NotificationsWeb/NotificationsWeb.csproj deleted file mode 100644 index 741152dc..00000000 --- a/NotificationsWeb/NotificationsWeb.csproj +++ /dev/null @@ -1,318 +0,0 @@ - - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {6CF53D68-BD81-47BB-8F56-350A1B04F114} - Library - Properties - NotificationsWeb - NotificationsWeb - v4.5.1 - - - - - 4.0 - - ..\ - true - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\ - TRACE - prompt - 4 - false - - - - ..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.dll - True - - - ..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.Net4.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\businesslogic.dll - True - - - ..\packages\ClientDependency.1.8.4\lib\net45\ClientDependency.Core.dll - True - - - ..\packages\ClientDependency-Mvc5.1.8.0.0\lib\net45\ClientDependency.Core.Mvc.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\cms.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\controls.dll - True - - - ..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll - True - - - ..\packages\Examine.0.1.68.0\lib\Examine.dll - True - - - ..\packages\HtmlAgilityPack.1.4.9\lib\Net45\HtmlAgilityPack.dll - True - - - ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - True - - - ..\packages\ImageProcessor.2.3.3.0\lib\net45\ImageProcessor.dll - True - - - ..\packages\ImageProcessor.Web.4.5.3.0\lib\net45\ImageProcessor.Web.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\interfaces.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\log4net.dll - True - - - ..\packages\Lucene.Net.2.9.4.1\lib\net40\Lucene.Net.dll - True - - - ..\packages\Markdown.1.14.4\lib\net45\MarkdownSharp.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\Microsoft.ApplicationBlocks.Data.dll - True - - - ..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll - True - - - ..\packages\Microsoft.AspNet.Identity.Owin.2.2.1\lib\net45\Microsoft.AspNet.Identity.Owin.dll - True - - - ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll - True - - - ..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll - True - - - ..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll - True - - - ..\packages\Microsoft.Owin.Security.Cookies.3.0.1\lib\net45\Microsoft.Owin.Security.Cookies.dll - True - - - ..\packages\Microsoft.Owin.Security.OAuth.3.0.1\lib\net45\Microsoft.Owin.Security.OAuth.dll - True - - - ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - True - - - ..\packages\MiniProfiler.2.1.0\lib\net40\MiniProfiler.dll - True - - - ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll - True - - - ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - True - - - ..\packages\Owin.1.0\lib\net40\Owin.dll - True - - - ..\packages\semver.1.1.2\lib\net451\Semver.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\SQLCE4Umbraco.dll - True - - - - - - ..\packages\UmbracoCms.Core.7.4.2\lib\System.Data.SqlServerCe.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\System.Data.SqlServerCe.Entity.dll - True - - - - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll - True - - - - - - - - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll - True - - - ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll - True - - - ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll - True - - - ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll - True - - - ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll - True - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll - True - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll - True - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll - True - - - - - - - - - ..\packages\UmbracoCms.Core.7.4.2\lib\TidyNet.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\umbraco.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\Umbraco.Core.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\umbraco.DataLayer.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\umbraco.editorControls.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\umbraco.MacroEngines.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\umbraco.providers.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\Umbraco.Web.UI.dll - True - - - ..\packages\UmbracoCms.Core.7.4.2\lib\UmbracoExamine.dll - True - - - ..\packages\UrlRewritingNet.2.0.7\lib\UrlRewritingNet.UrlRewriter.dll - True - - - - - - - - - - - - - - - - {80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2} - Notification - - - {a8e5c936-ecab-45b3-bfda-d12f680eb2a6} - OurUmbraco - - - - - - - - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - - - - - - - \ No newline at end of file diff --git a/NotificationsWeb/Properties/AssemblyInfo.cs b/NotificationsWeb/Properties/AssemblyInfo.cs deleted file mode 100644 index f2f31c78..00000000 --- a/NotificationsWeb/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -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("NotificationsWeb")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("NotificationsWeb")] -[assembly: AssemblyCopyright("Copyright © 2010")] -[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("3d5900ae-111a-45be-96b3-d9e4606ca793")] - -// 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 Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/NotificationsWeb/app.config b/NotificationsWeb/app.config deleted file mode 100644 index edfccc1b..00000000 --- a/NotificationsWeb/app.config +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NotificationsWeb/packages.config b/NotificationsWeb/packages.config deleted file mode 100644 index e59eda36..00000000 --- a/NotificationsWeb/packages.config +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/OurUmbraco.Site/OurUmbraco.Site.csproj b/OurUmbraco.Site/OurUmbraco.Site.csproj index c6e8f268..3462eb6f 100644 --- a/OurUmbraco.Site/OurUmbraco.Site.csproj +++ b/OurUmbraco.Site/OurUmbraco.Site.csproj @@ -4398,14 +4398,6 @@ - - {6cf53d68-bd81-47bb-8f56-350a1b04f114} - NotificationsWeb - - - {80e5f59d-a7a0-4cee-aeb6-6c626c44b2b2} - Notification - {A8E5C936-ECAB-45B3-BFDA-D12F680EB2A6} OurUmbraco @@ -4423,8 +4415,10 @@ - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + 11.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v11.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v12.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v14.0 OnBuildSuccess diff --git a/OurUmbraco.Site/Views/MacroPartials/Forum/ForumActions.cshtml b/OurUmbraco.Site/Views/MacroPartials/Forum/ForumActions.cshtml index 53277642..efd1e1e6 100644 --- a/OurUmbraco.Site/Views/MacroPartials/Forum/ForumActions.cshtml +++ b/OurUmbraco.Site/Views/MacroPartials/Forum/ForumActions.cshtml @@ -1,4 +1,5 @@ @using OurUmbraco.Forum.Extensions +@using OurUmbraco.NotificationsWeb.Library @inherits Umbraco.Web.Macros.PartialViewMacroPage
@@ -15,7 +16,7 @@ var subscribed = false; if (mem != null) { - subscribed = NotificationsWeb.Library.Utils.IsSubscribedToForum(CurrentPage.Id, mem.Id); + subscribed = Utils.IsSubscribedToForum(CurrentPage.Id, mem.Id); } if (subscribed) diff --git a/OurUmbraco.Site/Views/MacroPartials/Forum/Thread.cshtml b/OurUmbraco.Site/Views/MacroPartials/Forum/Thread.cshtml index 6bc36db6..d9d29af5 100644 --- a/OurUmbraco.Site/Views/MacroPartials/Forum/Thread.cshtml +++ b/OurUmbraco.Site/Views/MacroPartials/Forum/Thread.cshtml @@ -2,6 +2,7 @@ @using System.Web.Mvc.Html @using OurUmbraco.Forum.Extensions @using OurUmbraco.Forum.Services +@using OurUmbraco.NotificationsWeb.Library @{ var topicService = new TopicService(ApplicationContext.DatabaseContext); @@ -98,7 +99,7 @@ var subscribed = false; if (mem != null) { - subscribed = NotificationsWeb.Library.Utils.IsSubscribedToForumTopic(topic.Id, mem.Id); + subscribed = Utils.IsSubscribedToForumTopic(topic.Id, mem.Id); } if (Members.IsAdmin()) diff --git a/OurUmbraco.Site/Views/MacroPartials/Forum/TopicActions.cshtml b/OurUmbraco.Site/Views/MacroPartials/Forum/TopicActions.cshtml index 2b0b26d3..1247ad7a 100644 --- a/OurUmbraco.Site/Views/MacroPartials/Forum/TopicActions.cshtml +++ b/OurUmbraco.Site/Views/MacroPartials/Forum/TopicActions.cshtml @@ -1,5 +1,6 @@ @using OurUmbraco.Forum.Extensions @using OurUmbraco.Forum.Services +@using OurUmbraco.NotificationsWeb.Library @inherits Umbraco.Web.Macros.PartialViewMacroPage @{ var topicService = new TopicService(ApplicationContext.DatabaseContext); @@ -15,7 +16,7 @@ var subscribed = false; if (mem != null) { - subscribed = NotificationsWeb.Library.Utils.IsSubscribedToForumTopic(topic.Id, mem.Id); + subscribed = Utils.IsSubscribedToForumTopic(topic.Id, mem.Id); } if (Members.IsAdmin()) diff --git a/OurUmbraco.Site/Views/MacroPartials/Members/ProfileNotifications.cshtml b/OurUmbraco.Site/Views/MacroPartials/Members/ProfileNotifications.cshtml index 8c9112a4..d282cfb1 100644 --- a/OurUmbraco.Site/Views/MacroPartials/Members/ProfileNotifications.cshtml +++ b/OurUmbraco.Site/Views/MacroPartials/Members/ProfileNotifications.cshtml @@ -1,5 +1,5 @@ -@using NotificationsWeb.Services @using OurUmbraco.Forum.Services +@using OurUmbraco.NotificationsWeb.Services @inherits Umbraco.Web.Macros.PartialViewMacroPage @{ diff --git a/OurUmbraco.Site/config/Notification.config b/OurUmbraco.Site/config/Notification.config index eac65244..bcf1b6e9 100644 --- a/OurUmbraco.Site/config/Notification.config +++ b/OurUmbraco.Site/config/Notification.config @@ -16,8 +16,8 @@ + assembly="OurUmbraco" + type="OurUmbraco.NotificationsCore.NotificationTypes"> Umbraco community: New topic in '{0}' forum {2} just added a new topic to the '{0}' forum. @@ -41,8 +41,8 @@ You can unsubscribe from your profile on our.umbraco.org + assembly="OurUmbraco" + type="OurUmbraco.NotificationsCore.NotificationTypes.NewForumTopicComment"> Umbraco community: New comment in topic '{0}' {2} just added a new comment to the '{0}' topic. diff --git a/OurUmbraco/NotificationsCore/InstantNotification.cs b/OurUmbraco/NotificationsCore/InstantNotification.cs new file mode 100644 index 00000000..1df2f079 --- /dev/null +++ b/OurUmbraco/NotificationsCore/InstantNotification.cs @@ -0,0 +1,63 @@ +using System; +using System.Reflection; +using System.Xml; + +namespace OurUmbraco.NotificationsCore +{ + public class InstantNotification + { + private delegate void ExecuteDelegate(string config, string assemblydir, string name, params object[] args); + private readonly ExecuteDelegate _ed; + + public InstantNotification() + { + _ed = Execute; + } + + public void Invoke(string config, string assemblydir, string name, params object[] args) + { + _ed.BeginInvoke(config, assemblydir, name, args, null, null); + } + + public void Execute(string config, string assemblydir, string name, params object[] args) + { + try + { + var notifications = new XmlDocument(); + notifications.Load(config); + + var settings = notifications.SelectSingleNode("//global"); + + var node = notifications.SelectSingleNode(string.Format("//instant//notification [@name = '{0}']", name)); + + var details = new XmlDocument(); + var cont = details.CreateElement("details"); + + cont.AppendChild(details.ImportNode(settings, true)); + cont.AppendChild(details.ImportNode(node, true)); + + details.AppendChild(cont); + + if (node != null) + { + var assemblyFile = string.Format("{0}{1}.dll", assemblydir, node.Attributes["assembly"].Value); + + var nAssembly = Assembly.LoadFrom(assemblyFile); + + var n = (Notification)Activator.CreateInstance(nAssembly.GetType(node.Attributes["type"].Value)); + + n.SendNotification(details, args); + } + else + { + umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, 666, "not found"); + } + + } + catch (Exception e) + { + umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, 666, e.Message); + } + } + } +} \ No newline at end of file diff --git a/OurUmbraco/NotificationsCore/Interfaces/INotification.cs b/OurUmbraco/NotificationsCore/Interfaces/INotification.cs new file mode 100644 index 00000000..620c4966 --- /dev/null +++ b/OurUmbraco/NotificationsCore/Interfaces/INotification.cs @@ -0,0 +1,9 @@ +using System.Xml; + +namespace OurUmbraco.NotificationsCore.Interfaces +{ + interface INotification + { + bool SendNotification(XmlNode details, params object[] args); + } +} diff --git a/OurUmbraco/NotificationsCore/Notification.cs b/OurUmbraco/NotificationsCore/Notification.cs new file mode 100644 index 00000000..f5593dd7 --- /dev/null +++ b/OurUmbraco/NotificationsCore/Notification.cs @@ -0,0 +1,10 @@ +using System.Xml; +using OurUmbraco.NotificationsCore.Interfaces; + +namespace OurUmbraco.NotificationsCore +{ + public abstract class Notification: INotification + { + public virtual bool SendNotification(XmlNode details, params object[] args) { return false; } + } +} diff --git a/Notification/NotificationTypes/MarkAsSolutionReminder.cs b/OurUmbraco/NotificationsCore/NotificationTypes/MarkAsSolutionReminder.cs similarity index 97% rename from Notification/NotificationTypes/MarkAsSolutionReminder.cs rename to OurUmbraco/NotificationsCore/NotificationTypes/MarkAsSolutionReminder.cs index 32b79c9b..bf65eb84 100644 --- a/Notification/NotificationTypes/MarkAsSolutionReminder.cs +++ b/OurUmbraco/NotificationsCore/NotificationTypes/MarkAsSolutionReminder.cs @@ -1,87 +1,87 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Data.SqlClient; -using System.Net.Mail; - -namespace NotificationsCore.NotificationTypes -{ - public class MarkAsSolutionReminder: Notification - { - public MarkAsSolutionReminder() - { - } - - public override bool SendNotification(System.Xml.XmlNode details, params object[] args) - { - - - - SmtpClient c = new SmtpClient(details.SelectSingleNode("//smtp").InnerText); - c.Credentials = new System.Net.NetworkCredential(details.SelectSingleNode("//username").InnerText, details.SelectSingleNode("//password").InnerText); - - MailAddress from = new MailAddress( - details.SelectSingleNode("//from/email").InnerText, - details.SelectSingleNode("//from/name").InnerText); - - string subject = details.SelectSingleNode("//subject").InnerText; - string body = details.SelectSingleNode("//body").InnerText; - - SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["umbracoDbDSN"]); - - string select = @"select id, memberId from forumTopics where answer = 0 - and created < getdate() - 7 - and created > '2010-06-10 00:00:00' - and id not in (select topicId from notificationMarkAsSolution) - order by created desc;"; - - - SqlCommand comm = new SqlCommand( - select, conn); - conn.Open(); - SqlDataReader dr = comm.ExecuteReader(); - - string domain = details.SelectSingleNode("//domain").InnerText; - - - while (dr.Read()) - { - int topicId = dr.GetInt32(0); - - string mbody = string.Format(body, - t.Title, - "https://" + domain + args[1].ToString()); - - - Member m = new Member(dr.GetInt32(1)); - - - if (m.getProperty("bugMeNot") != null || m.getProperty("bugMeNot").Value.ToString() != "1") - { - MailMessage mm = new MailMessage(); - mm.Subject = subject; - mm.Body = mbody; - - mm.To.Add(m.Email); - mm.From = from; - - c.Send(mm); - } - - string insert = - "Insert into notificationMarkAsSolution(topicId, memberID, timestamp) values(@topicId, @memberID, getdate())"; - - SqlCommand icomm = new SqlCommand(insert, conn); - icomm.Parameters.AddWithValue("@topicId", topicId); - icomm.Parameters.AddWithValue("@memberID", m.Id); - icomm.ExecuteNonQuery(); - - } - conn.Close(); - - return true; - - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Data.SqlClient; +using System.Net.Mail; + +namespace NotificationsCore.NotificationTypes +{ + public class MarkAsSolutionReminder: Notification + { + public MarkAsSolutionReminder() + { + } + + public override bool SendNotification(System.Xml.XmlNode details, params object[] args) + { + + + + SmtpClient c = new SmtpClient(details.SelectSingleNode("//smtp").InnerText); + c.Credentials = new System.Net.NetworkCredential(details.SelectSingleNode("//username").InnerText, details.SelectSingleNode("//password").InnerText); + + MailAddress from = new MailAddress( + details.SelectSingleNode("//from/email").InnerText, + details.SelectSingleNode("//from/name").InnerText); + + string subject = details.SelectSingleNode("//subject").InnerText; + string body = details.SelectSingleNode("//body").InnerText; + + SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["umbracoDbDSN"]); + + string select = @"select id, memberId from forumTopics where answer = 0 + and created < getdate() - 7 + and created > '2010-06-10 00:00:00' + and id not in (select topicId from notificationMarkAsSolution) + order by created desc;"; + + + SqlCommand comm = new SqlCommand( + select, conn); + conn.Open(); + SqlDataReader dr = comm.ExecuteReader(); + + string domain = details.SelectSingleNode("//domain").InnerText; + + + while (dr.Read()) + { + int topicId = dr.GetInt32(0); + + string mbody = string.Format(body, + t.Title, + "https://" + domain + args[1].ToString()); + + + Member m = new Member(dr.GetInt32(1)); + + + if (m.getProperty("bugMeNot") != null || m.getProperty("bugMeNot").Value.ToString() != "1") + { + MailMessage mm = new MailMessage(); + mm.Subject = subject; + mm.Body = mbody; + + mm.To.Add(m.Email); + mm.From = from; + + c.Send(mm); + } + + string insert = + "Insert into notificationMarkAsSolution(topicId, memberID, timestamp) values(@topicId, @memberID, getdate())"; + + SqlCommand icomm = new SqlCommand(insert, conn); + icomm.Parameters.AddWithValue("@topicId", topicId); + icomm.Parameters.AddWithValue("@memberID", m.Id); + icomm.ExecuteNonQuery(); + + } + conn.Close(); + + return true; + + } + } +} diff --git a/Notification/NotificationTypes/MarkAsSolutionReminderSingle.cs b/OurUmbraco/NotificationsCore/NotificationTypes/MarkAsSolutionReminderSingle.cs similarity index 97% rename from Notification/NotificationTypes/MarkAsSolutionReminderSingle.cs rename to OurUmbraco/NotificationsCore/NotificationTypes/MarkAsSolutionReminderSingle.cs index ce475f38..63e09034 100644 --- a/Notification/NotificationTypes/MarkAsSolutionReminderSingle.cs +++ b/OurUmbraco/NotificationsCore/NotificationTypes/MarkAsSolutionReminderSingle.cs @@ -1,83 +1,83 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Net.Mail; -using System.Data.SqlClient; -using umbraco.cms.businesslogic.member; - -namespace NotificationsCore.NotificationTypes -{ - public class MarkAsSolutionReminderSingle : Notification - { - public MarkAsSolutionReminderSingle() - { - - } - - public override bool SendNotification(System.Xml.XmlNode details, params object[] args) - { - try - { - SmtpClient c = new SmtpClient(details.SelectSingleNode("//smtp").InnerText); - c.Credentials = new System.Net.NetworkCredential(details.SelectSingleNode("//username").InnerText, details.SelectSingleNode("//password").InnerText); - - MailAddress from = new MailAddress( - details.SelectSingleNode("//from/email").InnerText, - details.SelectSingleNode("//from/name").InnerText); - - string subject = details.SelectSingleNode("//subject").InnerText; - string body = details.SelectSingleNode("//body").InnerText; - - string domain = details.SelectSingleNode("//domain").InnerText; - - int topicId = int.Parse(args[0].ToString()); - int memberId = int.Parse(args[1].ToString()); - - uForum.Businesslogic.Topic t = uForum.Businesslogic.Topic.GetTopic(topicId); - - - Member m = new Member(memberId); - - body = string.Format(body, - t.Title, - "https://" + domain + args[2].ToString()); - - - if (m.getProperty("bugMeNot").Value.ToString() != "1") - { - MailMessage mm = new MailMessage(); - mm.Subject = subject; - mm.Body = body; - - mm.To.Add(m.Email); - mm.From = from; - - c.Send(mm); - } - - SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["umbracoDbDSN"]); - - - conn.Open(); - - - - string insert = - "Insert into notificationMarkAsSolution(topicId, memberID, timestamp) values(@topicId, @memberID, getdate())"; - - SqlCommand icomm = new SqlCommand(insert, conn); - icomm.Parameters.AddWithValue("@topicId", topicId); - icomm.Parameters.AddWithValue("@memberID", m.Id); - icomm.ExecuteNonQuery(); - - conn.Close(); - } - catch (Exception e) - { - umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications]" + e.Message); - } - return true; - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Net.Mail; +using System.Data.SqlClient; +using umbraco.cms.businesslogic.member; + +namespace NotificationsCore.NotificationTypes +{ + public class MarkAsSolutionReminderSingle : Notification + { + public MarkAsSolutionReminderSingle() + { + + } + + public override bool SendNotification(System.Xml.XmlNode details, params object[] args) + { + try + { + SmtpClient c = new SmtpClient(details.SelectSingleNode("//smtp").InnerText); + c.Credentials = new System.Net.NetworkCredential(details.SelectSingleNode("//username").InnerText, details.SelectSingleNode("//password").InnerText); + + MailAddress from = new MailAddress( + details.SelectSingleNode("//from/email").InnerText, + details.SelectSingleNode("//from/name").InnerText); + + string subject = details.SelectSingleNode("//subject").InnerText; + string body = details.SelectSingleNode("//body").InnerText; + + string domain = details.SelectSingleNode("//domain").InnerText; + + int topicId = int.Parse(args[0].ToString()); + int memberId = int.Parse(args[1].ToString()); + + uForum.Businesslogic.Topic t = uForum.Businesslogic.Topic.GetTopic(topicId); + + + Member m = new Member(memberId); + + body = string.Format(body, + t.Title, + "https://" + domain + args[2].ToString()); + + + if (m.getProperty("bugMeNot").Value.ToString() != "1") + { + MailMessage mm = new MailMessage(); + mm.Subject = subject; + mm.Body = body; + + mm.To.Add(m.Email); + mm.From = from; + + c.Send(mm); + } + + SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["umbracoDbDSN"]); + + + conn.Open(); + + + + string insert = + "Insert into notificationMarkAsSolution(topicId, memberID, timestamp) values(@topicId, @memberID, getdate())"; + + SqlCommand icomm = new SqlCommand(insert, conn); + icomm.Parameters.AddWithValue("@topicId", topicId); + icomm.Parameters.AddWithValue("@memberID", m.Id); + icomm.ExecuteNonQuery(); + + conn.Close(); + } + catch (Exception e) + { + umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications]" + e.Message); + } + return true; + } + } +} diff --git a/Notification/NotificationTypes/NewForumTopic.cs b/OurUmbraco/NotificationsCore/NotificationTypes/NewForumTopic.cs similarity index 93% rename from Notification/NotificationTypes/NewForumTopic.cs rename to OurUmbraco/NotificationsCore/NotificationTypes/NewForumTopic.cs index ecd0b80e..8159f092 100644 --- a/Notification/NotificationTypes/NewForumTopic.cs +++ b/OurUmbraco/NotificationsCore/NotificationTypes/NewForumTopic.cs @@ -1,113 +1,109 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Net.Mail; -using System.Data.SqlClient; -using umbraco.cms.businesslogic.member; -using umbraco.presentation.nodeFactory; -using umbraco.cms.businesslogic.web; -using System.Web; -using OurUmbraco.Forum.Models; - -namespace NotificationsCore.NotificationTypes -{ - public class NewForumTopic: Notification - { - public NewForumTopic() - { - - } - - public override bool SendNotification(System.Xml.XmlNode details, params object[] args) - { - try - { - - var topic = (Topic)args[0]; - string url = (string)args[1]; - var memberName = (string)args[2]; - - if (topic.IsSpam) - { - umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, string.Format("[Notifications] Topic ID {0} is marked as spam, no notification sent{0}", topic.Id)); - return true; - } - - - SmtpClient c = new SmtpClient(); - //c.Credentials = new System.Net.NetworkCredential(details.SelectSingleNode("//username").InnerText, details.SelectSingleNode("//password").InnerText); - - MailAddress from = new MailAddress( - details.SelectSingleNode("//from/email").InnerText, - details.SelectSingleNode("//from/name").InnerText); - - string subject = details.SelectSingleNode("//subject").InnerText; - string body = details.SelectSingleNode("//body").InnerText; - - - - //currently using document api instead of nodefactory - Document forum = new Document(topic.ParentId); - - - subject = string.Format(subject, forum.Text); - - var domain = details.SelectSingleNode("//domain").InnerText; - - body = string.Format(body, forum.Text, "https://" + domain + url, memberName, topic.Title, HttpUtility.HtmlDecode(umbraco.library.StripHtml(topic.Body))); - - - SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["umbracoDbDSN"].ConnectionString); - - - SqlCommand comm = new SqlCommand("Select memberId from forumSubscribers where forumId = @forumId", conn); - comm.Parameters.AddWithValue("@forumId", topic.ParentId); - conn.Open(); - - SqlDataReader dr = comm.ExecuteReader(); - - while (dr.Read()) - { - - int mid = dr.GetInt32(0); - try - { - - Member m = new Member(mid); - - - if (m.Id != topic.MemberId - && (m.getProperty("bugMeNot").Value.ToString() != "1")) - { - MailMessage mm = new MailMessage(); - mm.Subject = subject; - mm.Body = body; - - mm.To.Add(m.Email); - mm.From = from; - - c.Send(mm); - } - - } - catch(Exception e) - { - umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, - "[Notifications] Error sending mail to " + mid.ToString() + " " + e.Message); - } - } - - conn.Close(); - - - - } - catch (Exception e) - { - umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications]" + e.Message); - } - return true; - } - } -} +using System; +using System.Data.SqlClient; +using System.Net.Mail; +using System.Web; +using OurUmbraco.Forum.Models; +using umbraco.cms.businesslogic.member; +using umbraco.cms.businesslogic.web; + +namespace OurUmbraco.NotificationsCore.NotificationTypes +{ + public class NewForumTopic: Notification + { + public NewForumTopic() + { + + } + + public override bool SendNotification(System.Xml.XmlNode details, params object[] args) + { + try + { + + var topic = (Topic)args[0]; + string url = (string)args[1]; + var memberName = (string)args[2]; + + if (topic.IsSpam) + { + umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, string.Format("[Notifications] Topic ID {0} is marked as spam, no notification sent{0}", topic.Id)); + return true; + } + + + SmtpClient c = new SmtpClient(); + //c.Credentials = new System.Net.NetworkCredential(details.SelectSingleNode("//username").InnerText, details.SelectSingleNode("//password").InnerText); + + MailAddress from = new MailAddress( + details.SelectSingleNode("//from/email").InnerText, + details.SelectSingleNode("//from/name").InnerText); + + string subject = details.SelectSingleNode("//subject").InnerText; + string body = details.SelectSingleNode("//body").InnerText; + + + + //currently using document api instead of nodefactory + Document forum = new Document(topic.ParentId); + + + subject = string.Format(subject, forum.Text); + + var domain = details.SelectSingleNode("//domain").InnerText; + + body = string.Format(body, forum.Text, "https://" + domain + url, memberName, topic.Title, HttpUtility.HtmlDecode(umbraco.library.StripHtml(topic.Body))); + + + SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["umbracoDbDSN"].ConnectionString); + + + SqlCommand comm = new SqlCommand("Select memberId from forumSubscribers where forumId = @forumId", conn); + comm.Parameters.AddWithValue("@forumId", topic.ParentId); + conn.Open(); + + SqlDataReader dr = comm.ExecuteReader(); + + while (dr.Read()) + { + + int mid = dr.GetInt32(0); + try + { + + Member m = new Member(mid); + + + if (m.Id != topic.MemberId + && (m.getProperty("bugMeNot").Value.ToString() != "1")) + { + MailMessage mm = new MailMessage(); + mm.Subject = subject; + mm.Body = body; + + mm.To.Add(m.Email); + mm.From = from; + + c.Send(mm); + } + + } + catch(Exception e) + { + umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, + "[Notifications] Error sending mail to " + mid.ToString() + " " + e.Message); + } + } + + conn.Close(); + + + + } + catch (Exception e) + { + umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications]" + e.Message); + } + return true; + } + } +} diff --git a/Notification/NotificationTypes/NewForumTopicComment.cs b/OurUmbraco/NotificationsCore/NotificationTypes/NewForumTopicComment.cs similarity index 91% rename from Notification/NotificationTypes/NewForumTopicComment.cs rename to OurUmbraco/NotificationsCore/NotificationTypes/NewForumTopicComment.cs index d03726bd..64724b9e 100644 --- a/Notification/NotificationTypes/NewForumTopicComment.cs +++ b/OurUmbraco/NotificationsCore/NotificationTypes/NewForumTopicComment.cs @@ -1,107 +1,100 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Net.Mail; -using System.Data.SqlClient; -using umbraco.cms.businesslogic.member; -using System.Web; -using OurUmbraco.Forum.Models; -using Umbraco.Core.Models; -using Umbraco.Web; -using Umbraco.Core; -using Umbraco.Web.Security; - -namespace NotificationsCore.NotificationTypes -{ - public class NewForumTopicComment: Notification - { - public NewForumTopicComment() - { - - } - - public override bool SendNotification(System.Xml.XmlNode details, params object[] args) - { - try - { - - - - Comment com = (Comment)args[0]; - Topic topic = (Topic)args[1]; - string url = (string)args[2]; - string memberName = (string)args[3]; - - - if (com.IsSpam) - { - umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, string.Format("[Notifications] Comment Id {{0}} is marked as spam, no notification sent{0}", com.Id)); - return true; - } - - - //SMTP SETTINGS - SmtpClient c = new SmtpClient(); - //c.Credentials = new System.Net.NetworkCredential(details.SelectSingleNode("//username").InnerText, details.SelectSingleNode("//password").InnerText); - - //SENDER ADDRESS - MailAddress from = new MailAddress( - details.SelectSingleNode("//from/email").InnerText, - details.SelectSingleNode("//from/name").InnerText); - - //Notification details - var domain = details.SelectSingleNode("//domain").InnerText; - var subject = string.Format(details.SelectSingleNode("//subject").InnerText, topic.Title); - var body = details.SelectSingleNode("//body").InnerText; - body = string.Format(body, topic.Title, "https://" + domain + url + "#comment-" + com.Id, memberName, HttpUtility.HtmlDecode(umbraco.library.StripHtml(com.Body))); - - - //connect to DB - - SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["umbracoDbDSN"].ConnectionString); - SqlCommand comm = new SqlCommand("Select memberId from forumTopicSubscribers where topicId = @topicId", conn); - comm.Parameters.AddWithValue("@topicId", topic.Id); - conn.Open(); - - - //shit this must be so fucking slow - SqlDataReader dr = comm.ExecuteReader(); - while (dr.Read()) - { - int mid = dr.GetInt32(0); - try - { - var m = new umbraco.cms.businesslogic.member.Member(mid); - - if (m.Id != com.MemberId - && m.getProperty("bugMeNot").Value.ToString() != "1") - { - MailMessage mm = new MailMessage(); - mm.Subject = subject; - mm.Body = body; - - mm.To.Add(m.Email); - mm.From = from; - - c.Send(mm); - } - } - catch (Exception e) - { - umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, - "[Notifications] Error sending mail to " + mid.ToString() + " " + e.Message); - } - } - - conn.Close(); - } - catch (Exception e) - { - umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications]" + e.Message); - } - return true; - - } - } -} +using System; +using System.Data.SqlClient; +using System.Net.Mail; +using System.Web; +using OurUmbraco.Forum.Models; +using Notification = OurUmbraco.NotificationsCore.Notification; + +namespace OurUmbraco.NotificationsCore.NotificationTypes +{ + public class NewForumTopicComment: Notification + { + public NewForumTopicComment() + { + + } + + public override bool SendNotification(System.Xml.XmlNode details, params object[] args) + { + try + { + + + + Comment com = (Comment)args[0]; + Topic topic = (Topic)args[1]; + string url = (string)args[2]; + string memberName = (string)args[3]; + + + if (com.IsSpam) + { + umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, string.Format("[Notifications] Comment Id {{0}} is marked as spam, no notification sent{0}", com.Id)); + return true; + } + + + //SMTP SETTINGS + SmtpClient c = new SmtpClient(); + //c.Credentials = new System.Net.NetworkCredential(details.SelectSingleNode("//username").InnerText, details.SelectSingleNode("//password").InnerText); + + //SENDER ADDRESS + MailAddress from = new MailAddress( + details.SelectSingleNode("//from/email").InnerText, + details.SelectSingleNode("//from/name").InnerText); + + //Notification details + var domain = details.SelectSingleNode("//domain").InnerText; + var subject = string.Format(details.SelectSingleNode("//subject").InnerText, topic.Title); + var body = details.SelectSingleNode("//body").InnerText; + body = string.Format(body, topic.Title, "https://" + domain + url + "#comment-" + com.Id, memberName, HttpUtility.HtmlDecode(umbraco.library.StripHtml(com.Body))); + + + //connect to DB + + SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["umbracoDbDSN"].ConnectionString); + SqlCommand comm = new SqlCommand("Select memberId from forumTopicSubscribers where topicId = @topicId", conn); + comm.Parameters.AddWithValue("@topicId", topic.Id); + conn.Open(); + + + //shit this must be so fucking slow + SqlDataReader dr = comm.ExecuteReader(); + while (dr.Read()) + { + int mid = dr.GetInt32(0); + try + { + var m = new umbraco.cms.businesslogic.member.Member(mid); + + if (m.Id != com.MemberId + && m.getProperty("bugMeNot").Value.ToString() != "1") + { + MailMessage mm = new MailMessage(); + mm.Subject = subject; + mm.Body = body; + + mm.To.Add(m.Email); + mm.From = from; + + c.Send(mm); + } + } + catch (Exception e) + { + umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, + "[Notifications] Error sending mail to " + mid.ToString() + " " + e.Message); + } + } + + conn.Close(); + } + catch (Exception e) + { + umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications]" + e.Message); + } + return true; + + } + } +} diff --git a/Notification/NotificationTypes/SampleNotification.cs b/OurUmbraco/NotificationsCore/NotificationTypes/SampleNotification.cs similarity index 95% rename from Notification/NotificationTypes/SampleNotification.cs rename to OurUmbraco/NotificationsCore/NotificationTypes/SampleNotification.cs index 0d8430bf..556e79a8 100644 --- a/Notification/NotificationTypes/SampleNotification.cs +++ b/OurUmbraco/NotificationsCore/NotificationTypes/SampleNotification.cs @@ -1,38 +1,38 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Net; - -namespace NotificationsCore.NotificationTypes -{ - public class SampleNotification: Notification - { - public SampleNotification() - { - - } - - - public override bool SendNotification(System.Xml.XmlNode details, params object[] args) - { - //int i = 0; - - //while (i < 10) - //{ - // HttpWebRequest request = (HttpWebRequest) - // WebRequest.Create("http://www.google.com"); - - // // execute the request - // HttpWebResponse response = (HttpWebResponse) - // request.GetResponse(); - - - // i++; - //} - - - return true; - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Net; + +namespace NotificationsCore.NotificationTypes +{ + public class SampleNotification: Notification + { + public SampleNotification() + { + + } + + + public override bool SendNotification(System.Xml.XmlNode details, params object[] args) + { + //int i = 0; + + //while (i < 10) + //{ + // HttpWebRequest request = (HttpWebRequest) + // WebRequest.Create("http://www.google.com"); + + // // execute the request + // HttpWebResponse response = (HttpWebResponse) + // request.GetResponse(); + + + // i++; + //} + + + return true; + } + } +} diff --git a/OurUmbraco/NotificationsCore/SheduledNotification.cs b/OurUmbraco/NotificationsCore/SheduledNotification.cs new file mode 100644 index 00000000..18f652cc --- /dev/null +++ b/OurUmbraco/NotificationsCore/SheduledNotification.cs @@ -0,0 +1,44 @@ +using System; +using System.Timers; +using System.Xml; + +namespace OurUmbraco.NotificationsCore +{ + public class SheduledNotification + { + public string Name { get; set; } + public double Interval { get; set; } + public string Assembly { get; set; } + public string Type { get; set; } + public XmlNode Details { get; set; } + + readonly Timer _timer = new Timer(); + + public SheduledNotification(string name, double interval, string assembly, string type, XmlNode details) + { + Name = name; + Interval = interval; + Assembly = assembly; + Type = type; + Details = details; + } + public void Start() + { + _timer.Elapsed += timer_Elapsed; + _timer.Interval = Interval; + _timer.Enabled = true; + + } + + void timer_Elapsed(object sender, ElapsedEventArgs e) + { + var assemblyFile = string.Format("{0}.dll", Assembly); + + var nAssembly = System.Reflection.Assembly.LoadFrom(assemblyFile); + + var n = (Notification)Activator.CreateInstance(nAssembly.GetType(Type)); + + n.SendNotification(Details); + } + } +} diff --git a/NotificationsWeb/Api/NotificationsController.cs b/OurUmbraco/NotificationsWeb/Api/NotificationsController.cs similarity index 90% rename from NotificationsWeb/Api/NotificationsController.cs rename to OurUmbraco/NotificationsWeb/Api/NotificationsController.cs index 7f6ea8d6..ce0467dd 100644 --- a/NotificationsWeb/Api/NotificationsController.cs +++ b/OurUmbraco/NotificationsWeb/Api/NotificationsController.cs @@ -1,11 +1,10 @@ -using NotificationsWeb.Services; -using System.Linq; -using System.Web.Http; +using System.Web.Http; +using OurUmbraco.NotificationsWeb.Services; using Umbraco.Web.WebApi; -namespace NotificationsWeb.Api +namespace OurUmbraco.NotificationsWeb.Api { - public class NotificationsController:UmbracoApiController + public class NotificationsController : UmbracoApiController { public NotificationsController() { diff --git a/OurUmbraco/NotificationsWeb/Config.cs b/OurUmbraco/NotificationsWeb/Config.cs new file mode 100644 index 00000000..a476a5ec --- /dev/null +++ b/OurUmbraco/NotificationsWeb/Config.cs @@ -0,0 +1,25 @@ +namespace OurUmbraco.NotificationsWeb +{ + public class Config + { + private static readonly string Path = umbraco.GlobalSettings.FullpathToRoot + System.IO.Path.DirectorySeparatorChar + "config" + System.IO.Path.DirectorySeparatorChar; + private static string _filename = "Notification.config"; + + public static string AssemblyDir + { + get + { + return umbraco.GlobalSettings.FullpathToRoot + System.IO.Path.DirectorySeparatorChar + "bin" + System.IO.Path.DirectorySeparatorChar; + } + } + + + public static string ConfigurationFile + { + get + { + return Path + _filename; + } + } + } +} diff --git a/NotificationsWeb/EventHandlers/Forum.cs b/OurUmbraco/NotificationsWeb/EventHandlers/Forum.cs similarity index 90% rename from NotificationsWeb/EventHandlers/Forum.cs rename to OurUmbraco/NotificationsWeb/EventHandlers/Forum.cs index 2a14ed44..8d7e194d 100644 --- a/NotificationsWeb/EventHandlers/Forum.cs +++ b/OurUmbraco/NotificationsWeb/EventHandlers/Forum.cs @@ -1,92 +1,87 @@ -using System; -using System.Collections.Generic; -using System.Text; -using NotificationsCore; -using umbraco.presentation.nodeFactory; -using umbraco.cms.businesslogic.member; -using Umbraco.Core; -using NotificationsWeb.Services; -using OurUmbraco.Forum; -using OurUmbraco.Forum.Services; -using Umbraco.Web.Security; - -namespace NotificationsWeb.EventHandlers -{ - public class Forum : ApplicationEventHandler - { - protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) - { - //sub comment author to topic - CommentService.Created += CommentService_Created; - - //sub owner to topic - TopicService.Created += TopicService_Created; - - //If its a project forum, subscribe the owner to all topics - ForumService.Created += ForumService_Created; - - //remove all forum subs - ForumService.Deleted += ForumService_Deleted; - } - - void ForumService_Deleted(object sender, ForumEventArgs e) - { - var ns = new NotificationService(ApplicationContext.Current.DatabaseContext); - ns.RemoveAllForumSubscriptions(e.Forum.Id); - } - - void ForumService_Created(object sender, ForumEventArgs e) - { - var content = Umbraco.Web.UmbracoContext.Current.Application.Services.ContentService.GetById(e.Forum.ParentId); - if (content.ContentType.Alias == "Project") - { - var owner = content.GetValue("owner"); - //NotificationsWeb.BusinessLogic.Forum.Subscribe(e.Forum.Id, owner); - var ns = new NotificationService(ApplicationContext.Current.DatabaseContext); - ns.SubscribeToForum(e.Forum.Id, owner); - } - } - - void TopicService_Created(object sender, TopicEventArgs e) - { - - var ns = new NotificationService(ApplicationContext.Current.DatabaseContext); - ns.SubscribeToForumTopic(e.Topic.Id, e.Topic.MemberId); - - //send notification - InstantNotification not = new InstantNotification(); - - //data for notification: - var membershipHelper = new MembershipHelper(Umbraco.Web.UmbracoContext.Current); - var member = membershipHelper.GetById(e.Topic.MemberId); - var memberName = string.Empty; - if (member != null) - memberName = member.Name; - - not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "NewTopic", e.Topic, e.Topic.GetUrl(), memberName); - } - - void CommentService_Created(object sender, CommentEventArgs e) - { - var ts = new TopicService(ApplicationContext.Current.DatabaseContext); - - //Subscribe to topic - var ns = new NotificationService(ApplicationContext.Current.DatabaseContext); - ns.SubscribeToForumTopic(e.Comment.TopicId, e.Comment.MemberId); - - //data for notification: - var membershipHelper = new MembershipHelper(Umbraco.Web.UmbracoContext.Current); - var member = membershipHelper.GetById(e.Comment.MemberId); - var memberName = string.Empty; - if (member != null) - memberName = member.Name; - var topic = ts.GetById(e.Comment.TopicId); - - //send notifications - InstantNotification not = new InstantNotification(); - not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "NewComment", e.Comment, topic, topic.GetUrl(), memberName); - } - - - } -} +using OurUmbraco.Forum; +using OurUmbraco.Forum.Services; +using OurUmbraco.NotificationsCore; +using OurUmbraco.NotificationsWeb.Services; +using Umbraco.Core; +using Umbraco.Web.Security; + +namespace OurUmbraco.NotificationsWeb.EventHandlers +{ + public class Forum : ApplicationEventHandler + { + protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) + { + //sub comment author to topic + CommentService.Created += CommentService_Created; + + //sub owner to topic + TopicService.Created += TopicService_Created; + + //If its a project forum, subscribe the owner to all topics + ForumService.Created += ForumService_Created; + + //remove all forum subs + ForumService.Deleted += ForumService_Deleted; + } + + void ForumService_Deleted(object sender, ForumEventArgs e) + { + var ns = new NotificationService(ApplicationContext.Current.DatabaseContext); + ns.RemoveAllForumSubscriptions(e.Forum.Id); + } + + void ForumService_Created(object sender, ForumEventArgs e) + { + var content = Umbraco.Web.UmbracoContext.Current.Application.Services.ContentService.GetById(e.Forum.ParentId); + if (content.ContentType.Alias == "Project") + { + var owner = content.GetValue("owner"); + //NotificationsWeb.BusinessLogic.Forum.Subscribe(e.Forum.Id, owner); + var ns = new NotificationService(ApplicationContext.Current.DatabaseContext); + ns.SubscribeToForum(e.Forum.Id, owner); + } + } + + void TopicService_Created(object sender, TopicEventArgs e) + { + + var ns = new NotificationService(ApplicationContext.Current.DatabaseContext); + ns.SubscribeToForumTopic(e.Topic.Id, e.Topic.MemberId); + + //send notification + InstantNotification not = new InstantNotification(); + + //data for notification: + var membershipHelper = new MembershipHelper(Umbraco.Web.UmbracoContext.Current); + var member = membershipHelper.GetById(e.Topic.MemberId); + var memberName = string.Empty; + if (member != null) + memberName = member.Name; + + not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "NewTopic", e.Topic, e.Topic.GetUrl(), memberName); + } + + void CommentService_Created(object sender, CommentEventArgs e) + { + var ts = new TopicService(ApplicationContext.Current.DatabaseContext); + + //Subscribe to topic + var ns = new NotificationService(ApplicationContext.Current.DatabaseContext); + ns.SubscribeToForumTopic(e.Comment.TopicId, e.Comment.MemberId); + + //data for notification: + var membershipHelper = new MembershipHelper(Umbraco.Web.UmbracoContext.Current); + var member = membershipHelper.GetById(e.Comment.MemberId); + var memberName = string.Empty; + if (member != null) + memberName = member.Name; + var topic = ts.GetById(e.Comment.TopicId); + + //send notifications + InstantNotification not = new InstantNotification(); + not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "NewComment", e.Comment, topic, topic.GetUrl(), memberName); + } + + + } +} diff --git a/NotificationsWeb/EventHandlers/Test.cs b/OurUmbraco/NotificationsWeb/EventHandlers/Test.cs similarity index 96% rename from NotificationsWeb/EventHandlers/Test.cs rename to OurUmbraco/NotificationsWeb/EventHandlers/Test.cs index 7675106c..ae707dc0 100644 --- a/NotificationsWeb/EventHandlers/Test.cs +++ b/OurUmbraco/NotificationsWeb/EventHandlers/Test.cs @@ -1,26 +1,26 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using umbraco.BusinessLogic; -using umbraco.cms.businesslogic.web; -using NotificationsCore; - -namespace NotificationsWeb.EventHandlers -{ - public class Test: ApplicationBase - { - - public Test() - { - //Document.AfterPublish += new Document.PublishEventHandler(Document_AfterPublish); - } - - void Document_AfterPublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e) - { - InstantNotification not = new InstantNotification(); - - not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "NewComment", sender); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using umbraco.BusinessLogic; +using umbraco.cms.businesslogic.web; +using NotificationsCore; + +namespace NotificationsWeb.EventHandlers +{ + public class Test: ApplicationBase + { + + public Test() + { + //Document.AfterPublish += new Document.PublishEventHandler(Document_AfterPublish); + } + + void Document_AfterPublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e) + { + InstantNotification not = new InstantNotification(); + + not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "NewComment", sender); + } + } +} diff --git a/NotificationsWeb/Library/Utils.cs b/OurUmbraco/NotificationsWeb/Library/Utils.cs similarity index 73% rename from NotificationsWeb/Library/Utils.cs rename to OurUmbraco/NotificationsWeb/Library/Utils.cs index afcd2a0d..ccff2178 100644 --- a/NotificationsWeb/Library/Utils.cs +++ b/OurUmbraco/NotificationsWeb/Library/Utils.cs @@ -1,15 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Xml.XPath; -using System.Xml; -using NotificationsWeb.Services; +using OurUmbraco.NotificationsWeb.Services; using Umbraco.Core; -namespace NotificationsWeb.Library +namespace OurUmbraco.NotificationsWeb.Library { - //used from razor // public class Utils { @@ -17,7 +10,6 @@ namespace NotificationsWeb.Library { var ns = new NotificationService(ApplicationContext.Current.DatabaseContext); return ns.IsSubscribedToForum(forumId, memberId); - } public static bool IsSubscribedToForumTopic(int topicId, int memberId) @@ -25,6 +17,5 @@ namespace NotificationsWeb.Library var ns = new NotificationService(ApplicationContext.Current.DatabaseContext); return ns.IsSubscribedToTopic(topicId, memberId); } - } } diff --git a/NotificationsWeb/Models/ForumSubscriber.cs b/OurUmbraco/NotificationsWeb/Models/ForumSubscriber.cs similarity index 55% rename from NotificationsWeb/Models/ForumSubscriber.cs rename to OurUmbraco/NotificationsWeb/Models/ForumSubscriber.cs index 10e54177..97f8809d 100644 --- a/NotificationsWeb/Models/ForumSubscriber.cs +++ b/OurUmbraco/NotificationsWeb/Models/ForumSubscriber.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Umbraco.Core.Persistence; +using Umbraco.Core.Persistence; -namespace NotificationsWeb.Models +namespace OurUmbraco.NotificationsWeb.Models { [TableName("forumSubscribers")] public class ForumSubscriber diff --git a/NotificationsWeb/Models/ForumTopicSubscriber.cs b/OurUmbraco/NotificationsWeb/Models/ForumTopicSubscriber.cs similarity index 56% rename from NotificationsWeb/Models/ForumTopicSubscriber.cs rename to OurUmbraco/NotificationsWeb/Models/ForumTopicSubscriber.cs index bfb74ad6..2aad75e7 100644 --- a/NotificationsWeb/Models/ForumTopicSubscriber.cs +++ b/OurUmbraco/NotificationsWeb/Models/ForumTopicSubscriber.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Umbraco.Core.Persistence; +using Umbraco.Core.Persistence; -namespace NotificationsWeb.Models +namespace OurUmbraco.NotificationsWeb.Models { [TableName("forumTopicSubscribers")] public class ForumTopicSubscriber diff --git a/NotificationsWeb/Services/NotificationService.cs b/OurUmbraco/NotificationsWeb/Services/NotificationService.cs similarity index 91% rename from NotificationsWeb/Services/NotificationService.cs rename to OurUmbraco/NotificationsWeb/Services/NotificationService.cs index e2ad2350..9fa89a9d 100644 --- a/NotificationsWeb/Services/NotificationService.cs +++ b/OurUmbraco/NotificationsWeb/Services/NotificationService.cs @@ -1,13 +1,9 @@ -using NotificationsWeb.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System; +using OurUmbraco.NotificationsWeb.Models; using Umbraco.Core; using Umbraco.Core.Persistence; -namespace NotificationsWeb.Services +namespace OurUmbraco.NotificationsWeb.Services { public class NotificationService { @@ -19,7 +15,6 @@ namespace NotificationsWeb.Services _databaseContext = dbContext; } - public void SubscribeToForumTopic(int topicId, int memberId) { var r = _databaseContext.Database.SingleOrDefault( @@ -29,13 +24,14 @@ namespace NotificationsWeb.Services if(r == null) { - var rec = new ForumTopicSubscriber(); - rec.MemberId = memberId; - rec.TopicId = topicId; + var rec = new ForumTopicSubscriber + { + MemberId = memberId, + TopicId = topicId + }; _databaseContext.Database.Insert(rec); } - } public void UnSubscribeFromForumTopic(int topicId, int memberId) @@ -43,8 +39,7 @@ namespace NotificationsWeb.Services _databaseContext.Database.Delete( "Where topicId=@0 and memberId=@1", topicId, - memberId); - + memberId); } public void RemoveAllTopicSubscriptions(int topicId) @@ -60,8 +55,8 @@ namespace NotificationsWeb.Services "SELECT * FROM forumtopicsubscribers WHERE topicId=@0 and memberId=@1", topicId, memberId) != null; - } + public void SubscribeToForum(int forumId, int memberId) { var r = _databaseContext.Database.SingleOrDefault( @@ -101,6 +96,7 @@ namespace NotificationsWeb.Services forumId, memberId) != null; } + public Page GetForumSubscriptionsFromMember(int memberId, long take = 50, long page = 1) { var sql = new Sql() @@ -110,7 +106,6 @@ namespace NotificationsWeb.Services sql.Where(x => x.MemberId == memberId); return _databaseContext.Database.Page(page, take, sql); - } public long GetNumberOfForumSubscriptionsFromMember(int memberId) @@ -127,13 +122,11 @@ namespace NotificationsWeb.Services sql.Where(x => x.MemberId == memberId); return _databaseContext.Database.Page(page, take, sql); - } public long GetNumberOfTopicSubscriptionsFromMember(int memberId) { return _databaseContext.Database.ExecuteScalar("SELECT Count(*) FROM forumTopicSubscribers where memberId=@0",memberId); } - } } diff --git a/NotificationsWeb/Singleton.cs b/OurUmbraco/NotificationsWeb/Singleton.cs similarity index 69% rename from NotificationsWeb/Singleton.cs rename to OurUmbraco/NotificationsWeb/Singleton.cs index 3a07312a..44b813f1 100644 --- a/NotificationsWeb/Singleton.cs +++ b/OurUmbraco/NotificationsWeb/Singleton.cs @@ -1,10 +1,6 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -namespace NotificationsWeb +namespace OurUmbraco.NotificationsWeb { public class Singleton where T : class, new() { diff --git a/OurUmbraco/OurUmbraco.csproj b/OurUmbraco/OurUmbraco.csproj index 8449e133..1e576bf3 100644 --- a/OurUmbraco/OurUmbraco.csproj +++ b/OurUmbraco/OurUmbraco.csproj @@ -361,6 +361,20 @@ + + + + + + + + + + + + + + @@ -688,6 +702,12 @@ + + 11.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v11.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v12.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v14.0 + XCOPY "$(ProjectDir)Project\usercontrols\Deli\*.ascx" "$(ProjectDir)..\OurUmbraco.Site\usercontrols\Deli" /y /s XCOPY "$(ProjectDir)Our\usercontrols\*.ascx" "$(ProjectDir)..\OurUmbraco.Site\usercontrols\our.umbraco.org" /y diff --git a/our.umbraco.org.sln b/our.umbraco.org.sln index 013a5600..63e0bcef 100644 --- a/our.umbraco.org.sln +++ b/our.umbraco.org.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.40629.0 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OurUmbraco.Site", "OurUmbraco.Site\OurUmbraco.Site.csproj", "{911907FB-3B9D-4E5F-9A45-16700A451A54}" EndProject @@ -10,10 +10,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Notification", "Notification\Notification.csproj", "{80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotificationsWeb", "NotificationsWeb\NotificationsWeb.csproj", "{6CF53D68-BD81-47BB-8F56-350A1B04F114}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{F3A30EFB-C5EA-460A-A591-8FBD7176B131}" ProjectSection(SolutionItems) = preProject .nuget\NuGet.exe = .nuget\NuGet.exe @@ -41,26 +37,6 @@ Global {911907FB-3B9D-4E5F-9A45-16700A451A54}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {911907FB-3B9D-4E5F-9A45-16700A451A54}.Release|Mixed Platforms.Build.0 = Release|Any CPU {911907FB-3B9D-4E5F-9A45-16700A451A54}.Release|x86.ActiveCfg = Release|Any CPU - {80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}.Debug|x86.ActiveCfg = Debug|Any CPU - {80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}.Release|Any CPU.Build.0 = Release|Any CPU - {80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}.Release|x86.ActiveCfg = Release|Any CPU - {6CF53D68-BD81-47BB-8F56-350A1B04F114}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6CF53D68-BD81-47BB-8F56-350A1B04F114}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6CF53D68-BD81-47BB-8F56-350A1B04F114}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {6CF53D68-BD81-47BB-8F56-350A1B04F114}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {6CF53D68-BD81-47BB-8F56-350A1B04F114}.Debug|x86.ActiveCfg = Debug|Any CPU - {6CF53D68-BD81-47BB-8F56-350A1B04F114}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6CF53D68-BD81-47BB-8F56-350A1B04F114}.Release|Any CPU.Build.0 = Release|Any CPU - {6CF53D68-BD81-47BB-8F56-350A1B04F114}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {6CF53D68-BD81-47BB-8F56-350A1B04F114}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {6CF53D68-BD81-47BB-8F56-350A1B04F114}.Release|x86.ActiveCfg = Release|Any CPU {A8E5C936-ECAB-45B3-BFDA-D12F680EB2A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A8E5C936-ECAB-45B3-BFDA-D12F680EB2A6}.Debug|Any CPU.Build.0 = Debug|Any CPU {A8E5C936-ECAB-45B3-BFDA-D12F680EB2A6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU