本文整理汇总了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() });
}
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例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;
}