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


C# Page.Delete方法代码示例

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


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

示例1: SetStatus

        public ActionResult SetStatus(string id, string status) {
            return null;
            Guid pageID = new Guid(id);
            ActionResult result;
            var pg = new Page(pageID);//_cmsRepository.GetPage(pageID);

            if (status == "Publish") {
                //pull the page
                pg.Status = PublishStatus.Published;
                pg.Update(User.Identity.Name);
                return RedirectToAction("Index", "Home", new { slug = pg.Slug });
            } else if (status == "Take Offline") {
                //offline
                pg.Status = PublishStatus.Offline;
                pg.Update(User.Identity.Name);
                return RedirectToAction("Edit", "Page", new { id = pg.PageID.ToString() });

            } else if (status == "Delete") {
                pg.Delete();
                return RedirectToAction("Index", "Home");
            } else {
                return RedirectToAction("Edit", "Page", new { id = pg.PageID.ToString() });

            }


        }
开发者ID:christattum,项目名称:Kona,代码行数:27,代码来源:PageController.cs

示例2: AccountPagesWrite_Delete

        void AccountPagesWrite_Delete(object sender, EventArgs e)
        {
            AuthoriseRequestSid();

            long pageId = core.Functions.RequestLong("id", 0);

            try
            {
                Page page = new Page(core, Owner, pageId);

                if (page.Delete(core, Owner))
                {
                    SetRedirectUri(BuildUri("manage"));
                    core.Display.ShowMessage("Page Deleted", "The page has been deleted from the database.");
                    return;
                }
                else
                {
                    core.Display.ShowMessage("Error", "Could not delete the page.");
                    return;
                }
            }
            catch (PageNotFoundException)
            {
                core.Display.ShowMessage("Error", "Could not delete the page.");
                return;
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:28,代码来源:AccountPagesWrite.cs

示例3: UpdateInstall


//.........这里部分代码省略.........
                        query.AddFields("page_id");
                        query.AddCondition("page_item_id", viewer.Id);
                        query.AddCondition("page_item_type_id", viewer.TypeId);
                        query.AddCondition("page_title", slugs[slug].PageTitle);
                        query.AddCondition("page_slug", slug);
                        query.AddCondition("page_parent_path", string.Empty);

                        if (core.Db.Query(query).Rows.Count == 0)
                        {
                            string tSlug = slug;
                            Page myPage = Page.Create(core, false, viewer, slugs[slug].PageTitle, ref tSlug, 0, string.Empty, PageStatus.PageList, 0, Classifications.None);

                            if (myPage != null)
                            {
                                if (viewer is User)
                                {
                                    myPage.Access.Viewer = (User)viewer;
                                }

                                if (myPage.ListOnly)
                                {
                                    if (HasIcon)
                                    {
                                        myPage.Icon = Icon;
                                        try
                                        {
                                            myPage.Update();
                                        }
                                        catch (UnauthorisedToUpdateItemException)
                                        {
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            try
                            {
                                Page myPage = new Page(core, viewer, slug, string.Empty);

                                if (viewer is User)
                                {
                                    myPage.Access.Viewer = (User)viewer;
                                }

                                if (myPage.ListOnly)
                                {
                                    myPage.Title = slugs[slug].PageTitle;
                                    if (!string.IsNullOrEmpty(Icon))
                                    {
                                        myPage.Icon = Icon;
                                    }

                                    myPage.Update();
                                }
                            }
                            catch (PageNotFoundException)
                            {
                                string tSlug = slug;
                                Page myPage = Page.Create(core, false, viewer, slugs[slug].PageTitle, ref tSlug, 0, string.Empty, PageStatus.PageList, 0, Classifications.None);

                                if (viewer is User)
                                {
                                    myPage.Access.Viewer = (User)viewer;
                                }

                                if (myPage.ListOnly)
                                {
                                    if (!string.IsNullOrEmpty(Icon))
                                    {
                                        myPage.Icon = Icon;
                                    }

                                    myPage.Update();
                                }
                            }
                        }
                    }
                    else
                    {
                        // Delete any hanging
                        try
                        {
                            Page myPage = new Page(core, viewer, slug, string.Empty);

                            if (myPage.ListOnly)
                            {
                                myPage.Delete();
                            }
                        }
                        catch (PageNotFoundException)
                        {
                        }
                    }
                }
                return true;
            }
            return false;
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:101,代码来源:ApplicationEntry.cs

示例4: AccountListsManage_Delete

        /// <summary>
        /// Delete the list itself
        /// </summary>
        void AccountListsManage_Delete(object sender, EventArgs e)
        {
            AuthoriseRequestSid();

            long listId = core.Functions.RequestLong("id", 0);

            try
            {
                List list = new List(core, core.Session.LoggedInMember, listId);

                try
                {
                    list.Delete();
                }
                catch (UnauthorisedToDeleteItemException)
                {
                    core.Display.ShowMessage("Cannot Delete", "You are unauthorised to delete this list");
                    return;
                }

                try
                {
                    Page listPage = new Page(core, core.Session.LoggedInMember, list.Path, "lists");

                    listPage.Delete();
                }
                catch (PageNotFoundException)
                {
                    // Can ignore
                }

                SetRedirectUri(core.Hyperlink.BuildAccountSubModuleUri(ModuleKey, "lists"));
                core.Display.ShowMessage("List Deleted", "You have deleted a list.");
                return;
            }
            catch (InvalidListException)
            {
                core.Display.ShowMessage("List Error", "You submitted invalid information. Go back and try again. List may have already been deleted.");
                return;
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:44,代码来源:AccountListsManage.cs

示例5: Uninstall

        public bool Uninstall(Core core, Primitive viewer, Primitive owner, bool force)
        {
            if (this.ApplicationType != Internals.ApplicationType.Native) return false;

            if (!force)
            {
                if (isPrimitive)
                {
                    // Groups and Networks are primitive applications
                    return false;
                }

                switch (assemblyName.ToLower())
                {
                    case "profile":
                    case "networks":
                    case "groups":
                    case "gallery":
                    case "mail":
                        return false;
                    case "calendar":
                        if (owner.ItemKey.Equals(viewer.ItemKey))
                        {
                            return false;
                        }
                        break;
                }
            }

            if (HasInstalled(core, owner))
            {
                Application newApplication = Application.GetApplication(core, owner.AppPrimitive, this);

                Dictionary<string, PageSlugAttribute> slugs = newApplication.GetPageSlugs(owner.AppPrimitive);

                foreach (string slug in slugs.Keys)
                {
                    Page page = new Page(core, owner, slug, string.Empty);
                    page.Delete();
                }

                DeleteQuery dQuery = new DeleteQuery(typeof(PrimitiveApplicationInfo));
                dQuery.AddCondition("application_id", Id);
                dQuery.AddCondition("item_id", owner.Id);
                dQuery.AddCondition("item_type_id", owner.TypeId);

                if (core.Db.Query(dQuery) > 0)
                {
                    return true;
                }
            }
            return false;
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:53,代码来源:ApplicationEntry.cs


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