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


C# Document.delete方法代码示例

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


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

示例1: delete_Click

        protected void delete_Click(object sender, EventArgs e)
        {
            // delete group
               Document group = new Document(this.SelectedNodeID);
               group.delete(true);

            //Response.Redirect("MembershipManagement.aspx?memgsearch=" + this.txtSearchMembergroup.Text + "&memsearch=" + this.txtSearchMember.Text + "&groupid=" + this.SelectedNodeID + "&documenttype=" + Request.QueryString["documenttype"].ToString());
        }
开发者ID:wakkomail,项目名称:community-framework,代码行数:8,代码来源:MembershipManagement.ascx.cs

示例2: Delete

        public bool Delete()
        {
            var d = new cms.businesslogic.web.Document(ParentID);

            d.delete();

            // Log
            Log.Add(LogTypes.Delete, User.GetCurrent(), d.Id, "");

            return true;

        }
开发者ID:saciervo,项目名称:Umbraco-CMS,代码行数:12,代码来源:contentTasks.cs

示例3: Delete

        public string Delete(int wikiId)
        {
            var currentMemberId = Members.GetCurrentMember().Id;

            if (Xslt.IsMemberInGroup("admin", currentMemberId) || Xslt.IsMemberInGroup("wiki editor", currentMemberId))
            {
                var document = new Document(wikiId);

                umbraco.library.UnPublishSingleNode(document.Id);
                document.delete();
            }

            return "";
        }
开发者ID:larrynPL,项目名称:OurUmbraco,代码行数:14,代码来源:WikiController.cs

示例4: Delete

        public bool Delete()
        {
            cms.businesslogic.web.Document d = new cms.businesslogic.web.Document(ParentID);

            // Log
            BasePages.UmbracoEnsuredPage bp = new BasePages.UmbracoEnsuredPage();
            BusinessLogic.Log.Add(BusinessLogic.LogTypes.Delete, bp.getUser(), d.Id, "");

            library.UnPublishSingleNode(d.Id);

            d.delete();

            return true;
        }
开发者ID:jracabado,项目名称:justEdit-,代码行数:14,代码来源:contentTasks.cs

示例5: Delete

        public bool Delete()
        {
            cms.businesslogic.web.Document d = new cms.businesslogic.web.Document(ParentID);

            // Log
            BusinessLogic.Log.Add(BusinessLogic.LogTypes.Delete, User.GetCurrent(), d.Id, "");

            library.UnPublishSingleNode(d.Id);

            d.delete();

            return true;

        }
开发者ID:elrute,项目名称:Triphulcas,代码行数:14,代码来源:contentTasks.cs

示例6: Document_AfterMoveToTrash

 /// <summary>On event, after moving document to trash.</summary>
 protected void Document_AfterMoveToTrash(Document sender, MoveToTrashEventArgs e)
 {
     // Validate document have a relation and is trashed.
     if(sender.Relations.Length > 0) {
     foreach(var r in sender.Relations) {
         // Validate document is from "Main Site" sender and relation type.
         if(r.Parent.Id == sender.Id && r.RelType.Alias == "relateDocumentOnCopy") {
             // Get document from relation object.
             var doc = new Document(r.Child.Id);
             // Append log, audit trail.
             Log.Add(LogTypes.Delete, doc.ParentId, String.Format("Document (name:{0} id:{1}) related to document (name:{2} id:{3}) moved to trash.", r.Child.Text, r.Child.Id, sender.Text, sender.Id));
             // Unpublish and move document (that is child related) to trash.
             doc.delete();
         }
     }
     }
 }
开发者ID:williamchang,项目名称:umbraco-labs,代码行数:18,代码来源:RelationBackofficeEvent.cs

示例7: Manager_MessageReceived

 /// <summary>
 /// Handles the <c>MessageReceived</c> event of the 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 "deletecontent":
             Document currentPage = new Document(int.Parse(UmbracoContext.Current.PageId.ToString()));
             string redirectUrl = "/";
             try
             {
                 redirectUrl = library.NiceUrl(currentPage.Parent.Id);
             }
             catch { }
             currentPage.delete();
             Page.Response.Redirect(redirectUrl);
             break;
     }
 }
开发者ID:CarlSargunar,项目名称:Umbraco-CMS,代码行数:22,代码来源:DeleteModule.cs

示例8: Delete

        public static string Delete(int ID)
        {
            int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0;

            if (Xslt.IsMemberInGroup("admin", _currentMember) || Xslt.IsMemberInGroup("wiki editor", _currentMember))
            {
                Document d = new Document(ID);

                if (d != null)
                {
                    umbraco.library.UnPublishSingleNode(d.Id);
                    d.delete();
                }
            }

            return "";
        }
开发者ID:nul800sebastiaan,项目名称:OurUmbraco,代码行数:17,代码来源:rest.cs

示例9: 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

示例10: RecycleAndDelete

        /// <summary>
        /// Completely remove the document, this will first recycle it and then delete it (the api doesn't directly support deleting completey in one step)
        /// </summary>
        /// <param name="d"></param>
        internal static void RecycleAndDelete(Document d)
        {
            if (d == null)
            {
                return;
            }

            var id = d.Id;

            //check if it is already trashed
            var alreadyTrashed = d.IsTrashed;

            if (!alreadyTrashed)
            {
                //now recycle it
                d.delete();

                Assert.IsTrue(d.IsTrashed);                
            }

            //now permanently delete
            d.delete(true);
            Assert.IsFalse(Document.IsNode(id));

            //check with sql that it is gone
            var count = Application.SqlHelper.ExecuteScalar<int>("SELECT COUNT(*) FROM umbracoNode WHERE [email protected]",
                Application.SqlHelper.CreateParameter("@id", id));

            Assert.AreEqual(0, count);
        }
开发者ID:elrute,项目名称:Triphulcas,代码行数:34,代码来源:DocumentTest.cs

示例11: UnpublishAndTrashDocument

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

示例12: delete

        public void delete(int id, string username, string password)
        {
            Authenticate(username, password);

            // Some validation, to prevent deletion of system-documents.. (nessecary?)
            if (id < 0)
            {
                throw new Exception("Cannot delete documents with id lower than 1");
            }

            // We load the document
            Document doc = null;
            try
            {
                doc = new Document(id);
            }
            catch
            { }

            if (doc == null)
                throw new Exception("Document not found");

            try
            {
                doc.delete();
            }
            catch (Exception ex)
            {
                throw new Exception("Document could not be deleted" + ex.Message);
            }
        }
开发者ID:rehan-sarwar-confiz,项目名称:Umbraco-CMS,代码行数:31,代码来源:documentService.cs

示例13: Manager_MessageReceived

        /// <summary>
        /// Handles the <c>MessageReceived</c> event of the 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 "deletecontent":
                    Document currentPage = new Document(int.Parse(UmbracoContext.Current.PageId.ToString()));
                    string redirectUrl = "/";
                    try
                    {
                        redirectUrl = library.NiceUrl(currentPage.Parent.Id);
                    }
                    catch { }
                    library.UnPublishSingleNode(currentPage.Id);
                    currentPage.delete();
                    //Unpublish (triphulcas way)
                    currentPage.SetProperty("public", 0);

                    //disable live editing:
                    UmbracoContext.Current.LiveEditingContext.Enabled = false;

                    Page.Response.Redirect(redirectUrl);
                    break;
            }
        }
开发者ID:elrute,项目名称:Triphulcas,代码行数:29,代码来源:DeleteModule.cs


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