当前位置: 首页>>代码示例>>C#>>正文


C# Item.Delete方法代码示例

本文整理汇总了C#中System.Item.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# Item.Delete方法的具体用法?C# Item.Delete怎么用?C# Item.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Item的用法示例。


在下文中一共展示了Item.Delete方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateRetrieveUpdateDelete

        public void CreateRetrieveUpdateDelete()
        {
            string sku = DateTime.Now.ToString( "MMddHHmm" );
            string name = string.Format( "test item - {0}", DateTime.Now.ToString( "MMdd HHmm" ) );

            // create test
            Item item = new Item();
            item.Sku = sku;
            item.Name = name;
            item.Save();

            // retrieve test
            item = Item.Retrieve( sku );
            Assert.AreEqual( name, item.Name );

            // update test
            item.Name += " update test";
            item.Save();

            // delete test
            item.Delete();
        }
开发者ID:ranjeetkarn,项目名称:fetchapp-api-dotnet,代码行数:22,代码来源:ItemTests.cs

示例2: MoveItemToDateFolder

        /// <summary>
        /// Moves an Item to a Date Format Folder. Will create the folder based off the Date if the folder does not exist.
        /// </summary>
        /// <param name="topParent">Destination Folder</param>
        /// <param name="toMove">Item that is being moved</param>
        private static void MoveItemToDateFolder(Item topParent, Item toMove)
        {
            #if NET40
            Contract.Requires(topParent.IsNotNull());
            Contract.Requires(toMove.IsNotNull());
            #else
            Assert.ArgumentNotNull(topParent, "topParent");
            Assert.ArgumentNotNull(toMove, "toMove");
            #endif

            foreach (var item in toMove.Children.ToList())
            {
                MoveItemToDateFolder(topParent, item);
            }

            if (ShouldMoveToDateFolder(toMove))
            {
                using (new EditContext(toMove, SecurityCheck.Disable))
                {
                    if (toMove.Fields["__BucketParentRef"].IsNotNull())
                    {
                        toMove.Fields["__BucketParentRef"].Value = toMove.Parent.ID.ToString();
                    }
                }

                var destinationFolder = CreateAndReturnDateFolderDestination(topParent, toMove);
                var returnValue = ItemManager.MoveItem(toMove, destinationFolder);

                // TODO: This should be handled by MoveItem. Remove this check once Logging is placed into ItemManager code.
                if (!returnValue)
                {
                    Log.Error("There has been an issue moving the item from " + toMove + " to " + destinationFolder, returnValue);
                }
            }
            else if (ShouldDeleteInCreationOfBucket(toMove))
            {
                toMove.Delete();
            }
        }
开发者ID:csteeg,项目名称:Sitecore-Item-Buckets,代码行数:44,代码来源:BucketManager.cs

示例3: DeleteItem

        /// <summary>
        /// Moves to recycle bin or deletes a Sitecore item.
        /// </summary>
        /// <param name="item">Sitecore item to delete.</param>
        public void DeleteItem(Item item)
        {
            if (item == null)
            {
                return;
            }

            try
            {
                using (new SecurityDisabler())
                {
                    if (Settings.RecycleBinActive)
                    {
                        item.Recycle();
                    }
                    else
                    {
                        item.Delete();
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(string.Format("Scheduled Publish: Failed delete item {0} {1} {2}",
                    item.Paths.FullPath,
                    item.ID,
                    ex), new object());
            }
        }
开发者ID:maxslabyak,项目名称:SCScheduledPublishing,代码行数:33,代码来源:ScheduledPublishRepo.cs

示例4: RemoveStatus

        public static void RemoveStatus(PlayerMobile from, Item item)
        {
            for (int i = from.Quests.Count - 1; i >= 0; i --)
            {
                BaseQuest quest = from.Quests[i];
				
                for (int j = quest.Objectives.Count - 1; j >= 0; j --)
                {
                    if (quest.Objectives[j] is ObtainObjective)
                    {
                        ObtainObjective obtain = (ObtainObjective)quest.Objectives[j];
						
                        if (obtain.Obtain != null && obtain.Obtain.IsAssignableFrom(item.GetType()))
                        {
                            obtain.CurProgress -= item.Amount;									
                            item.QuestItem = false;							
                            from.SendLocalizedMessage(1074769); // An item must be in your backpack (and not in a container within) to be toggled as a quest item. 	
                            return;					
                        }
                    }
                    else if (quest.Objectives[j] is DeliverObjective)
                    {
                        DeliverObjective deliver = (DeliverObjective)quest.Objectives[j];
						
                        if (deliver.Delivery != null && deliver.Delivery.IsAssignableFrom(item.GetType()))
                        {
                            from.SendLocalizedMessage(1074813);  // You have failed to complete your delivery.							
                            DeleteItems(from, deliver.Delivery, deliver.MaxProgress, false);						
                            deliver.Fail();
                            item.Delete();							
                            return;
                        }
                    }
                }
            }
        }
开发者ID:jasegiffin,项目名称:JustUO,代码行数:36,代码来源:QuestHelper.cs

示例5: RemoveProduct

 internal void RemoveProduct(Item basket, Item product)
 {
     using (new SecurityDisabler())
     {
         product.Delete();
     }
 }
开发者ID:Trayek,项目名称:informa,代码行数:7,代码来源:BasketHelper.cs

示例6: DeleteMediaItemIfEmpty

 private static void DeleteMediaItemIfEmpty(BaseDataMap map, ref Item newItem, ref LevelLogger logger)
 {
     var mediaItem = (MediaItem)newItem;
     if (mediaItem != null)
     {
         if (!mediaItem.HasMediaStream(FieldNameBlog))
         {
             logger.AddInfo("Deleted Empty MediaItem Without Blob", String.Format("The media doesn't contain any Blob value (no image). To prevent an empty Media Item without a blob to remain in the Media Library, the MediaItem was deleted. Item: {0}", map.GetItemDebugInfo(newItem)));
             newItem.Delete();
             newItem = null;
             logger.IncrementCounter("DeletedEmptyMediaItem");
         }
     }
 }
开发者ID:NetlabSharedSource,项目名称:SitecoreDataSync,代码行数:14,代码来源:ToMediaItemBlob.cs

示例7: DeleteItem

        /// <summary>
        /// Deletes an item from Sitecore
        /// </summary>
        /// <returns>true if the item's database should have its template engine reloaded, false otherwise</returns>
        private bool DeleteItem(Item item, IProgressStatus progress)
        {
            bool resetFromChild = DeleteItems(item.Children, progress);
            Database db = item.Database;
            ID id = item.ID;
            string path = item.Paths.Path;

            item.Delete();

            if (EventDisabler.IsActive)
            {
                db.Caches.ItemCache.RemoveItem(id);
                db.Caches.DataCache.RemoveItemInformation(id);
            }

            progress.ReportStatus("[DELETED] {0}:{1} because it did not exist on disk".FormatWith(db.Name, path), MessageType.Warning);

            if (!resetFromChild && item.Database.Engines.TemplateEngine.IsTemplatePart(item))
            {
                return true;
            }

            return false;
        }
开发者ID:connectivedx,项目名称:Unicorn,代码行数:28,代码来源:SerializationLoader.cs

示例8: DestoryItem

 public static void DestoryItem(Mobile from, Item item)
 {
     Effects.PlaySound(from.Location, from.Map, 0x307);
     Effects.SendLocationEffect(from.Location, from.Map, 0x36BD, 9, 10, 0, 0);
     item.Delete();
 }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:6,代码来源:Ethic.cs

示例9: Delete

 public static void Delete(Item item)
 {
     item.Delete();
 }
开发者ID:Refactored,项目名称:SitecoreCalendarModule,代码行数:4,代码来源:Event.cs

示例10: MoveItemToDateFolder

        /// <summary>
        /// Moves the item to a Date Format Folder. Will create the folder based off the Date if the folder does not exist.
        /// </summary>
        /// <param name="topParent">Destination Folder</param>
        /// <param name="movedItemve">The item that is being moved.</param>
        private static void MoveItemToDateFolder(Item topParent, Item movedItem)
        {
            Contract.Requires(topParent.IsNotNull());
              Contract.Requires(movedItem.IsNotNull());

              foreach (Item item in movedItem.Children.ToList())
              {
            MoveItemToDateFolder(topParent, item);
              }

              if (ShouldMoveToDateFolder(movedItem))
              {
            using (new EditContext(movedItem, SecurityCheck.Disable))
            {
              if (movedItem.Fields["__BucketParentRef"].IsNotNull())
              {
            movedItem.Fields["__BucketParentRef"].Value = movedItem.Parent.ID.ToString();
              }
            }

            Item destinationFolder = CreateAndReturnDateFolderDestination(topParent, movedItem);
            bool returnValue = ItemManager.MoveItem(movedItem, destinationFolder);

            // TODO: This should be handled by MoveItem. Remove this check once Logging is placed into ItemManager code.
            if (returnValue == false)
            {
              Log.Error("There has been an issue moving the item from " + movedItem + " to " + destinationFolder, returnValue);
            }
              }
              else if (ShouldDeleteInCreationOfBucket(movedItem))
              {
            movedItem.Delete();
              }
        }
开发者ID:udt1106,项目名称:Sitecore-Item-Buckets,代码行数:39,代码来源:BucketManager.cs


注:本文中的System.Item.Delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。