/// <summary>
        /// Handles the OnRemoveVersion event of the Provider control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void Provider_OnRemoveVersion(object sender, EventArgs e)
        {
            Assert.ArgumentNotNull(sender, "sender");
            Assert.ArgumentNotNull(e, "e");

            var database = SitecoreEventArgs.GetObject(e, 0) as Database;

            if ((database != null) && (database.Name == this.targetDatabase.Name))
            {
                ID id = SitecoreEventArgs.GetID(e, 1);
                Assert.IsNotNull(id, "ID is not passed to RemoveVersion handler");

                var language = SitecoreEventArgs.GetObject(e, 2) as Language;
                Assert.IsNotNull(language, "Language is not passed to RemoveVersion handler");

                var version = SitecoreEventArgs.GetObject(e, 3) as Version;
                Assert.IsNotNull(version, "Version is not passed to RemoveVersion handler");

                using (IndexDeleteContext context = this.remoteIndex.CreateDeleteContext())
                {
                    this.DeleteVersion(id, language.ToString(), version.ToString(), context);
                    context.Commit();
                }
            }
        }
예제 #2
0
 public void DeleteTree(Item root)
 {
     Assert.ArgumentNotNull(root, "root");
     if (root.Axes.IsDescendantOf(this._root))
     {
         using (IndexDeleteContext context = this._index.CreateDeleteContext())
         {
             this.DeleteTree(root.ID, context);
             context.Commit();
         }
     }
 }
예제 #3
0
 public void DeleteVersion(Item version)
 {
     Assert.ArgumentNotNull(version, "version");
     if (this.IsMatch(version))
     {
         using (IndexDeleteContext context = this._index.CreateDeleteContext())
         {
             this.DeleteVersion(version.ID, version.Language.ToString(), version.Version.ToString(), context);
             context.Commit();
         }
     }
 }
예제 #4
0
 public void DeleteItem(Item item)
 {
     Assert.ArgumentNotNull(item, "item");
     if (this.IsMatch(item))
     {
         using (IndexDeleteContext context = this._index.CreateDeleteContext())
         {
             this.DeleteItem(item.ID, context);
             context.Commit();
         }
     }
 }
        private void Provider_OnRemoveItem(object sender, EventArgs e)
        {
            Assert.ArgumentNotNull(sender, "sender");
            Assert.ArgumentNotNull(e, "e");
            Database database = SitecoreEventArgs.GetObject(e, 0) as Database;

            if ((database != null) && (database.Name == this._database.Name))
            {
                ID iD = SitecoreEventArgs.GetID(e, 1);
                Assert.IsNotNull(iD, "ID is not passed to RemoveItem handler");
                using (IndexDeleteContext context = this._index.CreateDeleteContext())
                {
                    this.DeleteItem(iD, context);
                    context.Commit();
                }
            }
        }