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


C# ContentItem.FindPartVersion方法代码示例

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


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

示例1: UpdateItem

		public override bool UpdateItem(ContentItem item, Control editor)
		{
			bool updated = false;
			ItemEditorList listEditor = (ItemEditorList)editor;
			for (int i = 0; i < listEditor.ItemEditors.Count; i++)
			{
                ItemEditor childEditor = listEditor.ItemEditors[i];
                ItemEditor parentEditor = ItemUtility.FindInParents<ItemEditor>(editor.Parent);

                var childItem = childEditor.CurrentItem;
				if (childItem.ID != 0 && item.ID == 0 && !childItem.IsPage)
                    // we may have initialized the editor with the published version but we want to use the draft here
                    childItem = item.FindPartVersion(childItem);

                if (listEditor.DeletedIndexes.Contains(i))
				{
                    if (childItem.ID == 0)
                        childItem.AddTo(null);
					else
                        Engine.Persister.Delete(childItem);
				}
				else
				{
                    if (parentEditor != null)
					{
						var subContext = parentEditor.BinderContext.CreateNestedContext(childEditor, childItem, childEditor.GetDefinition());
						if (subContext.Binder.UpdateObject(subContext))
						{
                            childItem.AddTo(item); // make sure it's on parent's child collection
							parentEditor.BinderContext.RegisterItemToSave(childItem);
							updated = true;
						}
					}
					else
					{
						IItemEditor fallbackEditor = ItemUtility.FindInParents<IItemEditor>(editor.Parent);
						if (fallbackEditor != null)
						{
							fallbackEditor.Saved += delegate
							{
								var cc = childEditor.CreateCommandContext();
								Engine.Resolve<CommandDispatcher>().Publish(cc);
							};
						}
					}
				}
			}
			return updated || listEditor.DeletedIndexes.Count > 0 || listEditor.AddedDefinitions.Count > 0;
		}
开发者ID:davethieben,项目名称:n2cms,代码行数:49,代码来源:EditableChildrenAttribute.cs

示例2: UpdateItem

		public override bool UpdateItem(ContentItem parentItem, Control editor)
		{
			ItemEditor childEditor = editor as ItemEditor;
			ItemEditor parentEditor = ItemUtility.FindInParents<ItemEditor>(editor.Parent);

            var childItem = childEditor.CurrentItem;
            if (childItem.ID != 0 && parentItem.ID == 0)
                // we may have initialized the editor with the published version but we want to use the draft here
                childItem = parentItem.FindPartVersion(childItem);

			if (childEditor.UpdateObject(parentEditor.BinderContext.CreateNestedContext(childEditor, childItem, childEditor.GetDefinition())))
			{
				parentItem[Name] = childItem;
				return true;
			}
			
			return false;
		}
开发者ID:nagarjunachallapalli,项目名称:n2cms,代码行数:18,代码来源:EditableItemAttribute.cs

示例3: RedirectToVersionOfSelf

		private void RedirectToVersionOfSelf(ContentItem versionOfPage)
		{
			var url = Engine.ManagementPaths.GetEditExistingItemUrl(versionOfPage.FindPartVersion(ParentItem), Page.Request["returnUrl"]);
			Page.Response.Redirect(url);
		}
开发者ID:nikita239,项目名称:Aspect,代码行数:5,代码来源:ItemEditorList.cs

示例4: RedirectToVersionOfSelf

		private void RedirectToVersionOfSelf(ContentItem versionOfPage)
		{
			var url = Engine.ManagementPaths.GetEditExistingItemUrl(versionOfPage.FindPartVersion(ParentItem), Page.Request["returnUrl"], Page.Request.Url.AbsolutePath);
			//if (Page.Request.Url.AbsolutePath.EndsWith("EditRecursive.aspx"))
			//	Page.Response.Redirect(Page.Request.Url.AbsolutePath + "?" + url.ToUrl().Query);
			Page.Response.Redirect(url);
		}
开发者ID:EzyWebwerkstaden,项目名称:n2cms,代码行数:7,代码来源:ItemEditorList.cs


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