本文整理汇总了C#中TreeProvider.SortNodesByDate方法的典型用法代码示例。如果您正苦于以下问题:C# TreeProvider.SortNodesByDate方法的具体用法?C# TreeProvider.SortNodesByDate怎么用?C# TreeProvider.SortNodesByDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeProvider
的用法示例。
在下文中一共展示了TreeProvider.SortNodesByDate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SortDocumentsByDate
/// <summary>
/// Sorts a content tree subsection by date from oldest to newest. Called when the "Sort documents by date" button is pressed.
/// Expects the "CreateDocumentStructure" method to be run first.
/// </summary>
private bool SortDocumentsByDate()
{
// Create an instance of the Tree provider
TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);
// Select a node
TreeNode node = tree.SelectSingleNode(SiteContext.CurrentSiteName, "/API-Example", "en-us");
if (node != null)
{
// Sort its child nodes by date - descending
tree.SortNodesByDate(node.NodeID, false);
return true;
}
return false;
}
示例2: RaisePostBackEvent
//.........这里部分代码省略.........
// Set the device name
string deviceName = ValidationHelper.GetString(Param2, string.Empty);
DeviceContext.CurrentDeviceProfileName = deviceName;
// Refresh the document
if (nodeId > 0)
{
treeElem.SelectedNodeID = nodeId;
AddScript("SelectNode(" + nodeId + ");");
}
}
catch (Exception ex)
{
EventLogProvider.LogEvent(EventType.ERROR, "Content", "SETDEVICE", EventLogProvider.GetExceptionLogMessage(ex), RequestContext.RawURL, currentUser.UserID, currentUser.UserName, nodeId, documentName, RequestContext.UserHostAddress, SiteContext.CurrentSite.SiteID);
AddAlert(GetString("ContentRequest.ErrorChangeLanguage"));
}
break;
// Sorting
case "sortalphaasc":
case "sortalphadesc":
case "sortdateasc":
case "sortdatedesc":
int siteId = SiteContext.CurrentSite.SiteID;
try
{
// Get document to sort
TreeNode node = tree.SelectSingleNode(nodeId);
// Check the permissions for document
if ((node != null) && (currentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Allowed)
&& (currentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.ExploreTree) == AuthorizationResultEnum.Allowed))
{
siteId = node.NodeSiteID;
switch (action)
{
case "sortalphaasc":
tree.SortNodesAlphabetically(nodeId, siteId, true);
break;
case "sortalphadesc":
tree.SortNodesAlphabetically(nodeId, siteId, false);
break;
case "sortdateasc":
tree.SortNodesByDate(nodeId, siteId, true);
break;
case "sortdatedesc":
tree.SortNodesByDate(nodeId, siteId, false);
break;
}
// Log the synchronization tasks for the entire tree level
string fakeAlias = node.NodeAliasPath.TrimEnd('/') + "/child";
DocumentSynchronizationHelper.LogDocumentChangeOrder(siteName, fakeAlias, tree);
}
else
{
AddAlert(GetString("ContentRequest.SortDenied"));
}
// Refresh the tree
if (nodeId > 0)
{
treeElem.ExpandNodeID = nodeId;
treeElem.SelectedNodeID = nodeId;
if (IsProductTree)
{
AddScript("window.frames['contentview'].location.replace(window.frames['contentview'].location);");
}
else
{
AddScript("SelectNode(" + nodeId + ");");
}
}
}
catch (Exception ex)
{
EventLogProvider.LogEvent(EventType.ERROR, "Content", "SORT", EventLogProvider.GetExceptionLogMessage(ex), RequestContext.RawURL, currentUser.UserID, currentUser.UserName, nodeId, documentName, RequestContext.UserHostAddress, siteId);
AddAlert(GetString("ContentRequest.ErrorSort"));
}
break;
}
// Maintain scrollbar position
string script =
@"
SetSelectedNodeId(currentNodeId);
MaintainScroll('" + nodeId + @"','" + pnlTreeArea.ClientID + @"', " + ScrollPosition + @");
HideAllContextMenus();
";
ScriptHelper.RegisterStartupScript(Page, typeof(string), "MaintainScrollbar", script, true);
}