NotificationsCategoryDeleted Field |
Namespace: Dynamicweb.News
[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");
}
}