Dynamicweb.Notifications Namespace > Standard.Paragraph Class : ActiveStateChanged Field |
namespace Dynamicweb.Examples.CSharp.Notifications.Standard { [Extensibility.Subscribe(Dynamicweb.Notifications.Standard.Paragraph.ActiveStateChanged)] public class ParagraphActiveStateChangedObserver : Dynamicweb.Extensibility.NotificationSubscriber { public override void OnNotify(string notification, Dynamicweb.Extensibility.NotificationArgs args) { if (args == null) return; Dynamicweb.Notifications.Standard.Paragraph.ParagraphNotificationArgs item = (Dynamicweb.Notifications.Standard.Paragraph.ParagraphNotificationArgs)args; if (!item.Target.ShowParagraph) { //Pass paragraph Id to the notification e-mail string emailBody = string.Format("The paragraph (ID:{0}) has been disabled.", item.Target.ID); Dynamicweb.Modules.Common.Email.SendMail("user name", "username@somedomain.dk", "ParagraphActiveStateChangedObserver", "admin", "noreply@dynamicweb.dk", emailBody, "UTF-8"); } } } }
Namespace Notifications.Standard <Extensibility.Subscribe(Global.Dynamicweb.Notifications.Standard.Paragraph.ActiveStateChanged)> _ Public Class ParagraphActiveStateChangedObserver Inherits Global.Dynamicweb.Extensibility.NotificationSubscriber Public Overrides Sub OnNotify(ByVal notification As String, ByVal args As Global.Dynamicweb.Extensibility.NotificationArgs) If args Is Nothing Then Return End If Dim item As Global.Dynamicweb.Notifications.Standard.Paragraph.ParagraphNotificationArgs = DirectCast(args, Global.Dynamicweb.Notifications.Standard.Paragraph.ParagraphNotificationArgs) If Not item.Target.ShowParagraph Then 'Pass paragraph Id to the notification e-mail Dim emailBody As String = String.Format("The paragraph (ID:{0}) has been disabled.", item.Target.ID) Global.Dynamicweb.Modules.Common.Email.SendMail("user name", "username@somedomain.dk", "ParagraphActiveStateChangedObserver", "admin", "noreply@dynamicweb.dk", emailBody, "UTF-8") End If End Sub End Class End Namespace
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2