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


C# Document.UnPublish方法代码示例

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


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

示例1: UnpublishAndTrashDocument

 private void UnpublishAndTrashDocument(Document document)
 {
     if (document.Published)
     {
         document.UnPublish();
         umbraco.library.UnPublishSingleNode(document.Id);
     }
     document.delete();
 }
开发者ID:SkouRene,项目名称:Diablo3profiler,代码行数:9,代码来源:D3pServices.cs

示例2: DeletePost

        private void DeletePost()
        {
            // Make sure we have a post id available to us
            int? pId = null;
            if (Request.QueryString["p"] != null)
                pId = Request.QueryString["p"].ToInt32();

            // get the referring page
            var previouspage = HttpContext.Current.Request.UrlReferrer.AbsoluteUri.Split('?')[0];

            if (pId != null && MembershipHelper.IsAuthenticated())
            {
                var postID = pId.ToInt32();
                // great we have a postid, now check the user is allowed to delete it
                var posttodelete = Mapper.MapForumPost(new Node(postID));

                if (posttodelete.Owner.MemberId == CurrentMember.MemberId | CurrentMember.MemberIsAdmin)
                {
                    // These are used either way
                    var topic = new Document(posttodelete.ParentId.ToInt32());

                    // We know we can delete this, but if its a topic starter then delete entire topic
                    if(posttodelete.IsTopicStarter)
                    {
                        var topicId = topic.Id;
                        // Its a topic starter so delete entire topic
                        if (topic.Published)
                        {
                            topic.UnPublish();
                            library.UnPublishSingleNode(topicId);
                        }
                        topic.delete();

                        library.RefreshContent();

                        // Redirect and show message
                        Response.Redirect(string.Concat(Settings.Url, "?nf=true&m=", library.GetDictionaryItem("DeletedText")));
                    }
                    else
                    {
                        // Its just a normal post, delete it
                        var p = new Document(postID);
                        if (p.Published)
                        {
                            p.UnPublish();
                            library.UnPublishSingleNode(postID);
                        }
                        p.delete();

                        // Little bit of a hack to update the topic with the new latest post date
                        Factory.UpdateTopicWithLastPostDate(topic.Id);

                        library.RefreshContent();

                        // Redirect and show message
                        Response.Redirect(string.Concat(previouspage, "?nf=true&m=", library.GetDictionaryItem("DeletedText")));
                    }
                }

            }
            //Error so just redirect back to the page
            Response.Redirect(previouspage);
        }
开发者ID:wakkomail,项目名称:community-framework,代码行数:63,代码来源:ForumDeletePost.ascx.cs

示例3: Manager_MessageReceived

        /// <summary>
        /// Handles the <c>MessageReceived</c> event of the Live Editing manager.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected override void Manager_MessageReceived(object sender, MesssageReceivedArgs e)
        {
            switch (e.Type)
            {
                case "unpublishcontent":
                    var currentPage = new Document(int.Parse(UmbracoContext.Current.PageId.ToString()));                    
                    currentPage.UnPublish();
                    string redirectUrl = "/";
                    try
                    {
                        redirectUrl = library.NiceUrl(currentPage.Parent.Id);
                    }
                    catch
                    {
                    }

                    Page.Response.Redirect(redirectUrl);
                    break;
            }
        }
开发者ID:ChrisNikkel,项目名称:Umbraco-CMS,代码行数:25,代码来源:UnpublishModule.cs


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