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


C# TreeProvider类代码示例

本文整理汇总了C#中TreeProvider的典型用法代码示例。如果您正苦于以下问题:C# TreeProvider类的具体用法?C# TreeProvider怎么用?C# TreeProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ApplySettings

    /// <summary>
    /// Apply control settings.
    /// </summary>
    public bool ApplySettings()
    {
        if (MasterTemplateId <= 0)
        {
            lblError.Text = GetString("TemplateSelection.SelectTemplate");
            return false;
        }
        else
        {
            // Update all culture versions
            TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);
            DataSet ds = tree.SelectNodes(SiteName, "/", TreeProvider.ALL_CULTURES, false, "CMS.Root", null, null, -1, false);
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    // Update the document
                    TreeNode node = TreeNode.New("CMS.Root", dr, tree);

                    node.SetDefaultPageTemplateID(MasterTemplateId);

                    node.Update();

                    // Update search index for node
                    if (DocumentHelper.IsSearchTaskCreationAllowed(node))
                    {
                        SearchTaskInfoProvider.CreateTask(SearchTaskTypeEnum.Update, TreeNode.OBJECT_TYPE, SearchFieldsConstants.ID, node.GetSearchID(), node.DocumentID);
                    }
                }
            }
        }

        return true;
    }
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:37,代码来源:SelectMasterTemplate.ascx.cs

示例2: ProcessAction

    public void ProcessAction()
    {
        if (ctrl != null)
        {
            // Get the node
            TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);

            TreeNode node = tree.SelectSingleNode(mNodeId);
            int groupId = ValidationHelper.GetInteger(ctrl.Value, 0);

            // Check inherited documents
            if (chkInherit.Checked)
            {
                tree.ChangeCommunityGroup(node.NodeAliasPath, groupId, mSiteId, true);
            }

            // Update the document node
            node.SetIntegerValue("NodeGroupID", groupId, false);
            node.Update();

            // Log synchronization
            DocumentSynchronizationHelper.LogDocumentChange(node, TaskTypeEnum.UpdateDocument, tree);
        }

        ltlScript.Text = ScriptHelper.GetScript("wopener.ReloadOwner(); window.close();");
    }
开发者ID:KuduApps,项目名称:Kentico,代码行数:26,代码来源:SelectDocumentGroup.ascx.cs

示例3: CameToLandingPage

    /// <summary>
    /// Returns true if contact came to specified landing page.
    /// </summary>
    /// <param name="parameters">Contact; Node ID or alias path of the page</param>
    public static object CameToLandingPage(params object[] parameters)
    {
        switch (parameters.Length)
        {
            case 2:
                int nodeId = ValidationHelper.GetInteger(parameters[1], 0);
                string nodeIds = null;
                if (nodeId <= 0)
                {
                    string alias = ValidationHelper.GetString(parameters[1], "");
                    if (!string.IsNullOrEmpty(alias))
                    {
                        TreeNodeDataSet ds = new TreeProvider().SelectNodes(TreeProvider.ALL_SITES, alias, TreeProvider.ALL_CULTURES, true);
                        if (!DataHelper.DataSourceIsEmpty(ds))
                        {
                            nodeIds = TextHelper.Join(",", SystemDataHelper.GetStringValues(ds.Tables[0], "NodeID"));
                        }
                    }
                }

                if (nodeId > 0)
                {
                    return OnlineMarketingFunctions.DidActivity(parameters[0], "landingpage", null, 0, "ActivityNodeID = " + nodeId);
                }
                else if (!string.IsNullOrEmpty(nodeIds))
                {
                    return OnlineMarketingFunctions.DidActivity(parameters[0], "landingpage", null, 0, "ActivityNodeID IN (" + nodeIds + ")");
                }
                return false;

            default:
                throw new NotSupportedException();
        }
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:38,代码来源:OnlineMarketingMethods.cs

示例4: CreateAttendee

    /// <summary>
    /// Creates attendee. Called when the "Create attendee" button is pressed.
    /// Expects the CreateEvent method to be run first.
    /// </summary>
    private bool CreateAttendee()
    {
        TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);

        // Get event document
        TreeNode eventNode = tree.SelectSingleNode(CMSContext.CurrentSiteName, "/MyNewDocument/MyNewEvent", null, true);

        if (eventNode != null)
        {
            // Create new attendee object
            EventAttendeeInfo newAttendee = new EventAttendeeInfo();

            // Set the properties
            newAttendee.AttendeeEmail = "[email protected]";
            newAttendee.AttendeeEventNodeID = eventNode.NodeID;
            newAttendee.AttendeeFirstName = "My firstname";
            newAttendee.AttendeeLastName = "My lastname";

            // Save the attendee
            EventAttendeeInfoProvider.SetEventAttendeeInfo(newAttendee);

            return true;
        }

        return false;
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:30,代码来源:Default.aspx.cs

示例5: AddTagToDocument

    /// <summary>
    /// Creates tag. Called when the "Create tag" button is pressed.
    /// </summary>
    private bool AddTagToDocument()
    {
        TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);

        // Get the root document
        TreeNode root = tree.SelectSingleNode(CMSContext.CurrentSiteName, "/", null, true);

        // Get tag group ID
        TagGroupInfo updateGroup = TagGroupInfoProvider.GetTagGroupInfo("MyNewGroup", CMSContext.CurrentSiteID);

        if ((root != null) && (updateGroup != null))
        {
            // Add tag to document
            root.DocumentTags = "\"My New Tag\"";

            // Add tag to document
            root.DocumentTagGroupID = updateGroup.TagGroupID;

            // Update document
            root.Update();

            return true;
        }

        return false;
    }
开发者ID:KuduApps,项目名称:Kentico,代码行数:29,代码来源:Default.aspx.cs

示例6: Page_Load

		protected void Page_Load(object sender, EventArgs e)
		{
			districtParm =  DistrictParms.LoadDistrictParms();
            treeProvider = KenticoHelper.GetUserTreeProvider(SessionObject.LoggedInUser.ToString());
			Master.Search += SearchHandler;

			base.Page_Init(sender, e);

			if (!IsPostBack)
			{ InitializeCriteriaControls(); }

			btnAdd.Visible = UserHasPermission(Thinkgate.Base.Enums.Permission.Add_Reference);
            string cmsTreePathToReferences = ConfigurationManager.AppSettings["CMSTreePathToReferences"];
            if (districtParm.isStateSystem)
                stateInitial.Value = districtParm.State.ToString();
            if (!string.IsNullOrWhiteSpace(cmsTreePathToReferences))
            {
                TreeNode tNode = treeProvider.SelectSingleNode(CMSContext.CurrentSiteName, cmsTreePathToReferences.Substring(0, cmsTreePathToReferences.Length - 2), CMSContext.PreferredCultureCode);

                if (tNode != null)
                {
                    int messageCenterClassId = CMS.SettingsProvider.DataClassInfoProvider.GetDataClass("Thinkgate.ReferenceCenter").ClassID;
                    classId.Value = messageCenterClassId.ToString();
                    parentNodeId.Value = tNode.NodeID.ToString();
                    clientName.Value = districtParm.ClientID.ToString();
                }
            }
		}
开发者ID:ezimaxtechnologies,项目名称:ASP.Net,代码行数:28,代码来源:ReferenceCenter.aspx.cs

示例7: SetupControl

    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        string path = (string)this.GetValue("Path");
        string formatPath = path.Substring(1);

        try
        {
            litArchive.Text = (string)this.GetValue("Header");

            DataSet dataSet = null;
            TreeProvider tree = new TreeProvider();
            dataSet = tree.SelectNodes("Custom.BlogMonth").Path(formatPath, PathTypeEnum.Children)
                            .Where("")
                            .OrderBy("NodeLevel, NodeOrder, NodeName");

            if (dataSet != null)
            {
                rptblogLister.DataSource = dataSet.Tables[0];
                rptblogLister.DataBind();
            }
        }

        catch (Exception ex1)
        {
            Response.Write(ex1.Message.ToString() + ex1.StackTrace.ToString());
        }
    }
开发者ID:DeepakV1985,项目名称:MyCompany,代码行数:30,代码来源:BlogArchive.ascx.cs

示例8: CopyDocument

    /// <summary>
    /// Copies the document under workflow to a different section. Called when the "Copy document" button is pressd.
    /// Expects the "CreateExampleObjects" and "CreateDocument" methods to be run first.
    /// </summary>
    private bool CopyDocument()
    {
        // Create an instance of the Tree provider first
        TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);

        // Prepare parameters
        string siteName = CMSContext.CurrentSiteName;
        string aliasPath = "/API-Example/My-new-document";
        string culture = "en-us";
        bool combineWithDefaultCulture = false;
        string classNames = TreeProvider.ALL_CLASSNAMES;
        string where = null;
        string orderBy = null;
        int maxRelativeLevel = -1;
        bool selectOnlyPublished = false;
        string columns = null;

        // Get the example folder
        TreeNode node = DocumentHelper.GetDocument(siteName, aliasPath, culture, combineWithDefaultCulture, classNames, where, orderBy, maxRelativeLevel, selectOnlyPublished, columns, tree);

        aliasPath = "/API-Example/Source";

        // Get the new parent document
        TreeNode parentNode = DocumentHelper.GetDocument(siteName, aliasPath, culture, combineWithDefaultCulture, classNames, where, orderBy, maxRelativeLevel, selectOnlyPublished, columns, tree);

        if ((node != null) && (parentNode != null))
        {
            // Copy the document
            DocumentHelper.CopyDocument(node, parentNode.NodeID, false, tree);

            return true;
        }

        return false;
    }
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:39,代码来源:Default.aspx.cs

示例9: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        int currentNodeId = QueryHelper.GetInteger("nodeid", 0);

        // Initializes page breadcrumbs
        string[,] pageTitleTabs = new string[2, 3];
        pageTitleTabs[0, 0] = GetString("Relationship.RelatedDocs");
        pageTitleTabs[0, 1] = "~/CMSModules/Content/CMSDesk/Properties/Relateddocs_List.aspx?nodeid=" + currentNodeId;
        pageTitleTabs[0, 2] = "propedit";
        pageTitleTabs[1, 0] = GetString("Relationship.AddRelatedDocs");
        pageTitleTabs[1, 1] = string.Empty;
        pageTitleTabs[1, 2] = string.Empty;
        titleElem.Breadcrumbs = pageTitleTabs;

        if (currentNodeId > 0)
        {
            TreeProvider treeProvider = new TreeProvider(CMSContext.CurrentUser);
            TreeNode node = treeProvider.SelectSingleNode(currentNodeId);
            // Set edited document
            EditedDocument = node;

            // Set node
            addRelatedDocument.TreeNode = node;
            addRelatedDocument.IsLiveSite = false;
        }
    }
开发者ID:puentepr,项目名称:kentico-site-example,代码行数:26,代码来源:Relateddocs_Add.aspx.cs

示例10: ApplySettings

    /// <summary>
    /// Apply control settings.
    /// </summary>
    public bool ApplySettings()
    {
        if (MasterTemplateId <= 0)
        {
            lblError.Text = GetString("TemplateSelection.SelectTemplate");
            return false;
        }
        else
        {
            // Update all culture versions
            TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);
            DataSet ds = tree.SelectNodes(SiteName, "/", TreeProvider.ALL_CULTURES, false, "CMS.Root", null, null, -1, false);
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    // Update the document
                    TreeNode node = TreeNode.New(dr, "CMS.Root", tree);
                    node.DocumentPageTemplateID = MasterTemplateId;
                    node.Update();

                    // Update search index for node
                    if ((node.PublishedVersionExists) && (SearchIndexInfoProvider.SearchEnabled))
                    {
                        SearchTaskInfoProvider.CreateTask(SearchTaskTypeEnum.Update, PredefinedObjectType.DOCUMENT, SearchHelper.ID_FIELD, node.GetSearchID());
                    }
                }
            }
        }

        return true;
    }
开发者ID:v-jli,项目名称:jean0407large,代码行数:35,代码来源:SelectMasterTemplate.ascx.cs

示例11: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Redirect to the web site root by default
        string returnUrl = URLHelper.ResolveUrl("~/");

        // Check whether on-site editing is enabled
        if (PortalHelper.IsOnSiteEditingEnabled(SiteContext.CurrentSiteName))
        {
            var cui = MembershipContext.AuthenticatedUser;
            // Check the permissions
            if (cui.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Editor,SiteContext.CurrentSiteName)  && cui.IsAuthorizedPerResource("cms.content", "ExploreTree") && cui.IsAuthorizedPerResource("cms.content", "Read"))
            {
                // Set edit-live view mode
                PortalContext.SetViewMode(ViewModeEnum.EditLive);
            }
            else
            {
                // Redirect to access denied page when the current user does not have permissions for the OnSite editing
                CMSPage.RedirectToUINotAvailable();
            }

            // Try get return URL
            string queryUrl = QueryHelper.GetString("returnurl", String.Empty);
            if (!String.IsNullOrEmpty(queryUrl) && (queryUrl.StartsWithCSafe("~/") || queryUrl.StartsWithCSafe("/")))
            {
                // Remove return url duplication if exist
                int commaIndex = queryUrl.IndexOfCSafe(",", 0, false);
                if (commaIndex > 0)
                {
                    queryUrl = queryUrl.Substring(0, commaIndex);
                }
                returnUrl = URLHelper.ResolveUrl(queryUrl);
            }
            // Use default alias path if return url isn't defined
            else
            {
                string aliasPath = PageInfoProvider.GetDefaultAliasPath(RequestContext.CurrentDomain, SiteContext.CurrentSiteName);
                if (!String.IsNullOrEmpty(aliasPath))
                {
                    // Get the document which will be displayed for the default alias path
                    TreeProvider tr = new TreeProvider();
                    TreeNode node = tr.SelectSingleNode(SiteContext.CurrentSiteName, aliasPath, LocalizationContext.PreferredCultureCode, true);
                    if (node != null)
                    {
                        aliasPath = node.NodeAliasPath;
                    }

                    returnUrl = DocumentURLProvider.GetUrl(aliasPath);
                    returnUrl = URLHelper.ResolveUrl(returnUrl);
                }
            }

            // Remove view mode value from query string
            returnUrl = URLHelper.RemoveParameterFromUrl(returnUrl, "viewmode");
        }

        // Redirect to the requested page
        URLHelper.Redirect(returnUrl);
    }
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:59,代码来源:Default.aspx.cs

示例12: GetDocumentLink

        /// <summary>
        /// Get url by Guid</summary>
        public static string GetDocumentLink(Guid nodeGuid, string siteName)
        {
            var tp = new TreeProvider();
            TreeNode tn = tp.SelectSingleNode(TreePathUtils.GetNodeIdByNodeGUID(nodeGuid, siteName));
            if (tn != null) return tn.RelativeURL;

            return string.Empty;
        }
开发者ID:Belka64,项目名称:KenticoHelpers,代码行数:10,代码来源:Extensions.cs

示例13: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Register the scripts
        ScriptHelper.RegisterProgress(this.Page);

        UIContext.PropertyTab = PropertyTabEnum.Categories;

        // UI settings
        lblCategoryInfo.Text = GetString("Categories.DocumentAssignedTo");
        categoriesElem.DisplaySavedMessage = false;
        categoriesElem.OnAfterSave += categoriesElem_OnAfterSave;
        categoriesElem.UniSelector.OnSelectionChanged += categoriesElem_OnSelectionChanged;

        int nodeId = QueryHelper.GetInteger("nodeid", 0);
        if (nodeId > 0)
        {
            tree = new TreeProvider(CMSContext.CurrentUser);
            node = tree.SelectSingleNode(nodeId, CMSContext.PreferredCultureCode, false);

            // Redirect to page 'New culture version' in split mode. It must be before setting EditedDocument.
            if ((node == null) && displaySplitMode)
            {
                URLHelper.Redirect("~/CMSModules/Content/CMSDesk/New/NewCultureVersion.aspx" + URLHelper.Url.Query);
            }
            // Set edited document
            EditedDocument = node;

            if (node != null)
            {
                // Check read permissions
                if (CMSContext.CurrentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.Read) == AuthorizationResultEnum.Denied)
                {
                    RedirectToAccessDenied(String.Format(GetString("cmsdesk.notauthorizedtoreaddocument"), node.NodeAliasPath));
                }
                // Check modify permissions
                else if (CMSContext.CurrentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Denied)
                {
                    hasModifyPermission = false;
                    pnlUserCatgerories.Enabled = false;

                    // Disable selector
                    categoriesElem.Enabled = false;

                    lblCategoryInfo.Text = String.Format(GetString("cmsdesk.notauthorizedtoeditdocument"), node.NodeAliasPath);
                    lblCategoryInfo.Visible = true;
                }
                // Display all global categories in administration UI
                categoriesElem.UserID = CMSContext.CurrentUser.UserID;
                categoriesElem.DocumentID = node.DocumentID;

                // Register js synchronization script for split mode
                if (displaySplitMode)
                {
                    RegisterSplitModeSync(true, false);
                }
            }
        }
    }
开发者ID:puentepr,项目名称:kentico-site-example,代码行数:58,代码来源:Categories.aspx.cs

示例14: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Register script files
        ScriptHelper.RegisterShortcuts(this);
        ScriptHelper.RegisterSpellChecker(this);

        ltlScript.Text = GetSpellCheckDialog();

        parentNodeId = QueryHelper.GetInteger("nodeid", 0);
        txtPageName.MaxLength = TreePathUtils.MaxNameLength;

        TreeProvider tp = new TreeProvider(CMSContext.CurrentUser);
        // For new node is not document culture important, preffered culture is used
        TreeNode node = tp.SelectSingleNode(parentNodeId);
        if (node != null)
        {
            selTemplate.DocumentID = node.DocumentID;
            selTemplate.ParentNodeID = parentNodeId;
        }

        // Register progress script
        ScriptHelper.RegisterProgress(Page);

        // Check permission to create page with redirect
        CheckSecurity(true);

        if (!LicenseHelper.LicenseVersionCheck(URLHelper.GetCurrentDomain(), FeatureEnum.Documents, VersionActionEnum.Insert))
        {
            RedirectToAccessDenied(String.Format(GetString("cmsdesk.documentslicenselimits"), ""));
        }

        // Hide error label
        lblError.Style.Add("display", "none");

        string jsValidation = "function ValidateNewPage(){" +
        " var value = document.getElementById('" + txtPageName.ClientID + "').value;" +
        " value = value.replace(/^\\s+|\\s+$/g, '');" +
        " var errorLabel = document.getElementById('" + lblError.ClientID + "'); " +
        " if (value == '') {" +
        " errorLabel.style.display = ''; errorLabel.innerHTML  = " + ScriptHelper.GetString(GetString("newpage.nameempty")) + "; resizearea(); return false;}";

        jsValidation += selTemplate.GetValidationScript();

        jsValidation += " return true;}";

        // Register validate script
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ValidateNewPage", ScriptHelper.GetScript(jsValidation));

        // Register save document script
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "SaveDocument",
            ScriptHelper.GetScript("function SaveDocument(nodeId, createAnother) {if (ValidateNewPage()) { " + ControlsHelper.GetPostBackEventReference(this, "#", false).Replace("'#'", "createAnother+''") + "; return false; }}"));

        // Set default focus on page name field
        if (!RequestHelper.IsPostBack())
        {
            txtPageName.Focus();
        }
    }
开发者ID:puentepr,项目名称:kentico-site-example,代码行数:58,代码来源:NewPage.aspx.cs

示例15: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        UIContext.PropertyTab = PropertyTabEnum.RelatedDocs;

        nodeId = QueryHelper.GetInteger("nodeid", 0);

        // Check if any relationship exists
        DataSet dsRel = RelationshipNameInfoProvider.GetRelationshipNames("RelationshipNameID", "RelationshipAllowedObjects LIKE '%" + CMSObjectHelper.GROUP_DOCUMENTS + "%' AND RelationshipNameID IN (SELECT RelationshipNameID FROM CMS_RelationshipNameSite WHERE SiteID = " + CMSContext.CurrentSiteID + ")", null, 1);
        if (DataHelper.DataSourceIsEmpty(dsRel))
        {
            pnlNewItem.Visible = false;
            relatedDocuments.Visible = false;
            lblInfo.Text = ResHelper.GetString("relationship.norelationship");
            lblInfo.Visible = true;
        }
        else
        {
            if (nodeId > 0)
            {
                // Get the node
                tree = new TreeProvider(CMSContext.CurrentUser);
                node = tree.SelectSingleNode(nodeId, CMSContext.PreferredCultureCode, tree.CombineWithDefaultCulture);
                // Set edited document
                EditedDocument = node;

                if (node != null)
                {
                    // Check read permissions
                    if (CMSContext.CurrentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.Read) == AuthorizationResultEnum.Denied)
                    {
                        RedirectToAccessDenied(String.Format(GetString("cmsdesk.notauthorizedtoreaddocument"), node.NodeAliasPath));
                    }
                    // Check modify permissions
                    else if (CMSContext.CurrentUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Denied)
                    {
                        relatedDocuments.Enabled = false;
                        lnkNewRelationship.Enabled = false;
                        imgNewRelationship.Enabled = false;
                        lblInfo.Visible = true;
                        lblInfo.Text = String.Format(GetString("cmsdesk.notauthorizedtoeditdocument"), node.NodeAliasPath);
                    }
                    else
                    {
                        lblInfo.Visible = false;
                    }

                    // Set tree node
                    relatedDocuments.TreeNode = node;

                    // Initialize controls
                    lnkNewRelationship.NavigateUrl = "~/CMSModules/Content/CMSDesk/Properties/Relateddocs_Add.aspx?nodeid=" + nodeId;
                    imgNewRelationship.ImageUrl = GetImageUrl("CMSModules/CMS_Content/Properties/addrelationship.png");
                    imgNewRelationship.DisabledImageUrl = GetImageUrl("CMSModules/CMS_Content/Properties/addrelationshipdisabled.png");
                }
            }
        }
    }
开发者ID:KuduApps,项目名称:Kentico,代码行数:57,代码来源:Relateddocs_List.aspx.cs


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