Click or drag to resize

NotificationsCategoryDeleted Field

Occurs after the news category has been deleted.

Namespace:  Dynamicweb.News
Assembly:  Dynamicweb.News (in Dynamicweb.News.dll) Version: 1.0.10
Syntax
public const string CategoryDeleted = "DWN_MODULES_NEWSV2_CATEGORYDELETED"

Field Value

Type: String
Remarks
Examples
Example
[Dynamicweb.Extensibility.Subscribe(Dynamicweb.Notifications.NewsV2.CategoryDeleted)]
    public class NewsV2CategoryDeletedObserver : Dynamicweb.Extensibility.NotificationSubscriber
    {
        public override void OnNotify(string notification, Dynamicweb.Extensibility.NotificationArgs args)
        {
            if (args == null || !(args is Dynamicweb.NewsV2.Extensibility.NewsItemCategoryNotificationArgs))
                return;

            Dynamicweb.NewsV2.Extensibility.NewsItemCategoryNotificationArgs item = (Dynamicweb.NewsV2.Extensibility.NewsItemCategoryNotificationArgs)args;

            //send e-mail
            string emailBody = string.Format("The news category (ID:{0}) has been deleted.", item.Category.ID);
            Dynamicweb.Modules.Common.Email.SendMail("user name", "username@somedomain.dk", "NewsV2CategoryDeletedObserver",
                "admin", Dynamicweb.Mailing.EmailHandler.SystemMailFromAddress(), emailBody, "UTF-8");
        }
    }
See Also