本文整理汇总了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;
}
示例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;
}
示例3: RedirectToVersionOfSelf
private void RedirectToVersionOfSelf(ContentItem versionOfPage)
{
var url = Engine.ManagementPaths.GetEditExistingItemUrl(versionOfPage.FindPartVersion(ParentItem), Page.Request["returnUrl"]);
Page.Response.Redirect(url);
}
示例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);
}