protected void OnItemRenamed([NotNull] object sender, [NotNull] EventArgs args) { Assert.ArgumentNotNull(sender, "sender"); Assert.ArgumentNotNull(args, "args"); var item = Event.ExtractParameter(args, 0) as Item; Assert.IsNotNull(item, "item"); if (item.TemplateName != "Bloggr Post") { return; } try { using (new SecurityDisabler()) { var structure = BloggrContext.GetPostsStructureSure(item); // fix post name because item was renamed and new name may be invalid according to current site IBloggrStructure rules structure.FixPostName(item); } } catch (Exception ex) { Log.Error("Unhandled exception occurred in Alienlab.Bloggr.EventHandler.OnItemRenamed(sender, args)", ex, this); } }
protected void OnItemMoved([NotNull] object sender, [NotNull] EventArgs args) { Assert.ArgumentNotNull(sender, "sender"); Assert.ArgumentNotNull(args, "args"); var item = Event.ExtractParameter(args, 0) as Item; Assert.IsNotNull(item, "item"); if (item.TemplateName != "Bloggr Post") { return; } try { using (new SecurityDisabler()) { var structure = BloggrContext.GetPostsStructureSure(item); structure.FixPostLocation(item); } } catch (Exception ex) { Log.Error("Unhandled exception occurred in Alienlab.Bloggr.EventHandler.OnItemMoved(sender, args)", ex, this); } }