Example #1
0
        /// <summary>
        /// Called when the item has deleted.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The arguments.</param>
        public void OnItemDeletedRemote(object sender, EventArgs args)
        {
            if (!Configuration.Enabled || args == null)
            {
                return;
            }

            var eventArgs = args as Data.Events.ItemDeletedRemoteEventArgs;

            Assert.IsNotNull(eventArgs, "ItemSavedRemoteEventArgs is null");

            var item = eventArgs.Item;

            Assert.IsNotNull(item, "No item in parameters");

            if (item.Database.Name != Configuration.Database)
            {
                return;
            }

            if (item.TemplateID == Multisite.TemplateId)
            {
                RedirectProcessor.RebuildMultisites();
                RedirectProcessor.CreateListOfRedirectsInThread();
                return;
            }

            if (!CheckTemplate(item))
            {
                return;
            }

            RedirectProcessor.RemoveRedirectInThread(item);
        }
Example #2
0
        /// <summary>
        /// Called when the item has deleted.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The arguments.</param>
        public void OnItemDeleted(object sender, EventArgs args)
        {
            if (!Configuration.Enabled || args == null)
            {
                return;
            }

            var item = Event.ExtractParameter(args, 0) as Item;

            Assert.IsNotNull(item, "No item in parameters");
            if (item.Database.Name != Configuration.Database)
            {
                return;
            }

            if (item.TemplateID == Multisite.TemplateId)
            {
                RedirectProcessor.RebuildMultisites();
                RedirectProcessor.CreateListOfRedirectsInThread();
                return;
            }

            if (!CheckTemplate(item))
            {
                return;
            }

            RedirectProcessor.RemoveRedirectInThread(item);
        }