本文整理汇总了C#中TreeProvider.SelectNodesCount方法的典型用法代码示例。如果您正苦于以下问题:C# TreeProvider.SelectNodesCount方法的具体用法?C# TreeProvider.SelectNodesCount怎么用?C# TreeProvider.SelectNodesCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeProvider
的用法示例。
在下文中一共展示了TreeProvider.SelectNodesCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
//.........这里部分代码省略.........
{
DataRow dr = allDocs.Tables[0].Rows[0];
node = TreeNode.New(ValidationHelper.GetString(dr["ClassName"], string.Empty), dr, tree);
}
}
if (node != null)
{
bool rootDeleteDisabled = false;
if (IsProductsMode)
{
string startingPath = SettingsKeyInfoProvider.GetValue(CurrentSiteName + ".CMSStoreProductsStartingPath");
if (node.NodeAliasPath.CompareToCSafe(startingPath) == 0)
{
string closeLink = "<a href=\"#\"><span style=\"cursor: pointer;\" " +
"onclick=\"SelectNode(" + node.NodeID + "); return false;\">" + GetString("general.back") +
"</span></a>";
ShowError(string.Format(GetString("com.productsection.deleteroot"), closeLink, ""));
pnlDelete.Visible = false;
rootDeleteDisabled = true;
}
}
if (node.IsRoot() && isMultilingual)
{
// Hide 'Delete all cultures' checkbox
pnlAllCultures.Visible = false;
if (!URLHelper.IsPostback())
{
// Check if there are any documents in another culture or current culture has some documents
pnlDeleteRoot.Visible = IsAnyDocumentInAnotherCulture(node) && (tree.SelectNodesCount(SiteContext.CurrentSiteName, "/%", LocalizationContext.PreferredCultureCode, false, null, null, null, TreeProvider.ALL_LEVELS, false) > 0);
if (pnlDeleteRoot.Visible)
{
// Insert 'Delete current root' option if current root node is translated to current culture
if (node.DocumentCulture == LocalizationContext.PreferredCultureCode)
{
rblRoot.Items.Add(new ListItem(GetString("rootdeletion.currentroot"), "current"));
}
rblRoot.Items.Add(new ListItem(GetString("rootdeletion.currentculture"), "allculturepages"));
rblRoot.Items.Add(new ListItem(GetString("rootdeletion.allpages"), "allpages"));
}
else
{
rblRoot.Items.Add(new ListItem(GetString("rootdeletion.allpages"), "allpages"));
}
if (rblRoot.SelectedIndex < 0)
{
rblRoot.SelectedIndex = 0;
}
}
}
// Display warning for root node
if (!rootDeleteDisabled && node.IsRoot())
{
if (!currentUser.IsGlobalAdministrator)
{
pnlDelete.Visible = false;
ShowInformation(GetString("delete.rootonlyglobaladmin"));
示例2: NodeHasChildWithProduct
/// <summary>
/// Returns true when given node has product related child.
/// </summary>
/// <param name="tree">Tree provider to use</param>
/// <param name="node">Node to check</param>
protected bool NodeHasChildWithProduct(TreeProvider tree, TreeNode node)
{
string aliasPath = node.NodeAliasPath.TrimEnd('/') + "/%";
return 0 < tree.SelectNodesCount(node.NodeSiteName, aliasPath, TreeProvider.ALL_CULTURES, true, null, "NodeLinkedNodeID IS NULL AND NodeSKUID IS NOT NULL", null, TreeProvider.ALL_LEVELS, false);
}
示例3: NodeSharesSKUWithOtherNode
/// <summary>
/// Returns true when given node is bound to the same SKU as some other node does.
/// </summary>
/// <param name="tree">Tree provider to use</param>
/// <param name="node">Node to check</param>
protected bool NodeSharesSKUWithOtherNode(TreeProvider tree, TreeNode node)
{
string where = "NodeLinkedNodeID IS NULL AND NodeSKUID = " + node.NodeSKUID + " AND NodeID <> " + node.NodeID;
return 0 < tree.SelectNodesCount(TreeProvider.ALL_SITES, "/%", TreeProvider.ALL_CULTURES, true, null, where, null, TreeProvider.ALL_LEVELS, false);
}
示例4: rptPostArchive_ItemDataBound
/// <summary>
/// Item databound handler.
/// </summary>
protected void rptPostArchive_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
// Select only publish is depend on view mode
bool selectOnlyPublished = (PageManager.ViewMode.IsLiveSite());
// Get month NodeID
int parentId = ValidationHelper.GetInteger((DataHelper.GetDataRowValue(((DataRowView)e.Item.DataItem).Row, "NodeID")), 0);
TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);
// Posts count, default '0'
int count = 0;
// Try to get data from cache
using (var cs = new CachedSection<int>(ref count, CacheMinutes, true, CacheItemName, "postarchivecount", SiteContext.CurrentSiteName, rptPostArchive.Path, LocalizationContext.PreferredCultureCode, parentId, selectOnlyPublished))
{
if (cs.LoadData)
{
count = tree.SelectNodesCount(SiteContext.CurrentSiteName, rptPostArchive.Path, LocalizationContext.PreferredCultureCode, false, null, "NodeParentID = " + parentId, "", -1, selectOnlyPublished);
// Save to cache
if (cs.Cached)
{
cs.CacheDependency = GetCacheDependency();
}
cs.Data = count;
}
}
// Set post count as text to the label control in repeater transformation
if (e.Item.Controls.Count > 0)
{
// Try find label control with id 'lblPostCount'
Label lblCtrl = e.Item.Controls[0].FindControl("lblPostCount") as Label;
if (lblCtrl != null)
{
lblCtrl.Text = count.ToString();
}
}
}