Table of Contents

Class PageService

Namespace
Dynamicweb.Content
Assembly
Dynamicweb.dll

Provides methods for querying and persisting pages.

public class PageService : ICacheStorage<int, Page>, ICacheStorage<int>, ICacheStorage
Inheritance
PageService
Implements
Inherited Members

Constructors

PageService()

The repository implementation providing access to persistence

public PageService()

Methods

ClearCache()

Resets all keys to the default value for objects stored in the object cache

public void ClearCache()

ClearCache(IEnumerable<int>)

Resets the specified keys to the default value for objects stored in the object cache

public void ClearCache(IEnumerable<int> keys)

Parameters

keys IEnumerable<int>

Keys to reset

ClearCache(int)

Resets the specified key to the default value for objects stored in the object cache

public void ClearCache(int key)

Parameters

key int

Key to reset

ClearTrashBin(int)

Deletes the specified page form trashbin

public void ClearTrashBin(int pageId)

Parameters

pageId int

The id of the page to delete

CopyTo(CopyPageInfo)

Creates a copy of a given Page

public ApplicationResponse<Page> CopyTo(CopyPageInfo copyPageInfo)

Parameters

copyPageInfo CopyPageInfo

A CopyPageInfo instance providing information about how to perform the actual copy operation

Returns

ApplicationResponse<Page>

A response indicating the success or failure of the operation

CreateFromMaster(int, int)

Creates a new language version of the page with the specified id

public int CreateFromMaster(int masterPageId, int languageAreaId)

Parameters

masterPageId int

The id of the page acting as master

languageAreaId int

The language version of the website on which to create the new page

Returns

int

The id of the new page

DeleteAllAreaPages(Area)

public ApplicationResponse DeleteAllAreaPages(Area area)

Parameters

area Area

Returns

ApplicationResponse

DeletePage(int)

Deletes the specified page

public void DeletePage(int pageId)

Parameters

pageId int

The id of the page to delete

ForceRefreshIndex(int)

Forces the specific item from the cache to be force-refreshed from the repository.

public bool ForceRefreshIndex(int id)

Parameters

id int

Id of element to be refreshed

Returns

bool

GetAncestors(int, bool)

Gets all ancestor page collection

public IEnumerable<Page> GetAncestors(int pageId, bool includingSelf)

Parameters

pageId int

The id of the page to get ancestors

includingSelf bool

Indicates if page with given Id will be included in result

Returns

IEnumerable<Page>

GetAreaAndPageNameByUrl(string, ref string, ref string)

Gets the area and page name by URL.

public string GetAreaAndPageNameByUrl(string url, ref string internalId, ref string internalAreaId)

Parameters

url string

The URL, i.e. Default.aspx?ID=123.

internalId string

Optional parameter by reference. If passed the ID of the page will be returned.

internalAreaId string

Optional parameter by reference. If passed the ID of the area will be returned.

Returns

string

The name of the area and page of the given link in the format "Area name: Page name"

GetAreaNavigationTree(int)

Gets a representation of pages of the website with the specified id

public PageTree GetAreaNavigationTree(int areaId)

Parameters

areaId int

The id of the area for which to get its page navigation tree

Returns

PageTree

A PageTree instance

GetAreaRootNavigationTree(int)

Gets a representation of a subset of the website with the pages located in the root of the website. Child nodes are added to the root nodes, but not to the tree.

public PageTree GetAreaRootNavigationTree(int areaId)

Parameters

areaId int

The id of the area for which to get its page navigation tree

Returns

PageTree

A PageTree instance

GetAvailablePageDefinitions(int, int)

Gets the collection of available page definitions for specified area.

public IEnumerable<PageDefinition> GetAvailablePageDefinitions(int areaId, int parentPageId)

Parameters

areaId int

The area id.

parentPageId int

The parent page.

Returns

IEnumerable<PageDefinition>

IEnumerable(Of PageDefinition).

GetDeletedPages(int)

Gets the collection of deleted pages in specified area

public IEnumerable<Page> GetDeletedPages(int areaId)

Parameters

areaId int

The area id.

Returns

IEnumerable<Page>

A collection of pages

GetFirstModulePageForArea(int, string)

Gets the first module page for the area with the specified id.

public Page GetFirstModulePageForArea(int areaId, string moduleSystemName)

Parameters

areaId int

The id of the area for which to get the page.

moduleSystemName string

The system name of the module.

Returns

Page

Page.

GetFirstPageForArea(int)

Gets the first root page for the area with the specified id.

public Page GetFirstPageForArea(int areaId)

Parameters

areaId int

The id of the area for which to get the page

Returns

Page

The first page for the specified area

GetLanguagePages(int)

Gets all language versions of the page with the specified id

public PageCollection GetLanguagePages(int pageId)

Parameters

pageId int

The id of the page for which to get all its language versions

Returns

PageCollection

A list of pages

GetPage(int)

Gets the page with the specified id

public Page GetPage(int pageId)

Parameters

pageId int

The id of the page to get

Returns

Page

The page with the specified id. If a page with the Id is not found, null is returned

GetPageByNavigationTag(int, string)

public Page GetPageByNavigationTag(int areaId, string navigationTag)

Parameters

areaId int
navigationTag string

Returns

Page

GetPageForItem(string, string)

Gets the page for the item with the specified type and id

public Page GetPageForItem(string itemType, string itemId)

Parameters

itemType string

The itemType for which to find a page

itemId string

The itemId for which to find a page

Returns

Page

A page that has an associated item with the specified item type and id

GetPageIDByMasterID(int, int)

Gets the id of the page in the specified language version that has a master page with the given id

public int GetPageIDByMasterID(int masterId, int languageAreaId)

Parameters

masterId int

The id of the master page

languageAreaId int

The language version of the page to get

Returns

int

A page id that has a master page with the specified id in the given language

GetPageNavigationTree(int)

Gets a representation of the website and its pages in a PageTree instance

public PageTree GetPageNavigationTree(int parentPageId)

Parameters

parentPageId int

The id of the page for which to get its page navigation tree

Returns

PageTree

A PageTree instance

Remarks

looks up data from database

GetPageOrLanguage(int, int)

Gets the page with the specified id - if the passed areaid does not match the pageid, the language version will be returned if found

public Page GetPageOrLanguage(int pageId, int areaId)

Parameters

pageId int

The id of the page to get

areaId int

The ara id of the current area

Returns

Page

The page with the specified id or its language version for the specified area. If a page with the Id is not found, null is returned. If areaid is not more than 0, exception will be thrown

GetPageTemplatesForArea(int)

Gets all page templates for the specified area

public PageCollection GetPageTemplatesForArea(int areaId)

Parameters

areaId int

The id of the area for which to get it's page templates

Returns

PageCollection

A collection of page templates

GetPages()

Gets all pages in the system

public PageCollection GetPages()

Returns

PageCollection

A list of all pages in the system

GetPages(int[])

Gets all the pages matching the ids in the specified array

public PageCollection GetPages(int[] pageIds)

Parameters

pageIds int[]

An array of ids for which to get the page instances

Returns

PageCollection

A list with the pages matching the specified ids

GetPagesByAreaID(int)

Gets all the pages for the area with the specified id

public PageCollection GetPagesByAreaID(int areaId)

Parameters

areaId int

The id of the area for which to get all its pages

Returns

PageCollection

A list of pages

GetPagesByParentID(int)

Gets all pages having the specified parent id

public IEnumerable<Page> GetPagesByParentID(int parentId)

Parameters

parentId int

The parent id for which to get all children pages

Returns

IEnumerable<Page>

A list of pages all having a parent page with the specified id

GetPagesByTitle(string)

Gets all the pages that have the specified title

public PageCollection GetPagesByTitle(string title)

Parameters

title string

The title fort which to get all pages having that as their title

Returns

PageCollection

A collection of pages with the specified titel

GetPagesForItems(IEnumerable<string>)

Gets a collection of pages having the specified item types

public PageCollection GetPagesForItems(IEnumerable<string> itemTypes)

Parameters

itemTypes IEnumerable<string>

The item types for which to get pages

Returns

PageCollection

A collection of pages having the specified item types

GetRootPagesForArea(int)

Gets all root pages for the area with the specified id

public IEnumerable<Page> GetRootPagesForArea(int areaId)

Parameters

areaId int

The id of the area for which to get all its root pages

Returns

IEnumerable<Page>

A list of pages all being root to the area with the specified id

GetTemplateParentPage(int)

Get page template folder

public Page GetTemplateParentPage(int areaId)

Parameters

areaId int

The area id.

Returns

Page

The page template folder

GetUpdatedLanguagePages(int)

Gets a list of pages for an area that has not been updated after their masters have been updated. The passed areaId has to be for an Area that is a language (has a master).

public IEnumerable<Page> GetUpdatedLanguagePages(int areaId)

Parameters

areaId int

The area id for which to get the updated language pages

Returns

IEnumerable<Page>

Remarks

Uses the database directly

GetWebpageCount(int)

Gets total number of webpages on specified area.

public int GetWebpageCount(int areaId)

Parameters

areaId int

areaId

Returns

int

webpageCount

Move(int, int, int)

Moves the specified page to the target page and area

public ApplicationResponse<Page> Move(int pageId, int destinationAreaId, int destinationPageId)

Parameters

pageId int

The id of the page to move

destinationAreaId int

Area to move to.

destinationPageId int

The id of the page to which the page should be moved

Returns

ApplicationResponse<Page>

A response indicating the success or failure of the operation

RestorePage(int)

Restore the page with the specified id

public void RestorePage(int pageId)

Parameters

pageId int

The id of the page to restore

Exceptions

ApplicationException

SaveAsTemplate(Page, string, string)

Saves the specified page as a template

public int SaveAsTemplate(Page page, string name, string description)

Parameters

page Page

The page to save as a template

name string

The name of the new template

description string

A description of the template

Returns

int

The newly assigned page id for the template

SaveAsTemplate(Page, string, string, string)

Saves the specified page as a template

public int SaveAsTemplate(Page page, string name, string description, string image)

Parameters

page Page

The page to save as a template

name string

The name of the new template

description string

A description of the template

image string

Returns

int

The newly assigned page id for the template

SaveAsTemplate(Page, string, string, string, string)

Saves the specified page as a template

public int SaveAsTemplate(Page page, string name, string description, string image, string category)

Parameters

page Page

The page to save as a template

name string

The name of the new template

description string

A description of the template

image string

The image of the new template

category string

A category of the template

Returns

int

The newly assigned page id for the template

SavePage(Page)

Saves the specified page to persistance

public Page SavePage(Page page)

Parameters

page Page

The page to save

Returns

Page

The newly saved page

UpdatePagesOrder(int, int?, IEnumerable<int>)

Updates sorting for given pages

public void UpdatePagesOrder(int areaId, int? pageId, IEnumerable<int> childPageIdsOrder)

Parameters

areaId int

The id of the area for pages

pageId int?

The parent id for which to update sort indexes

childPageIdsOrder IEnumerable<int>

Ordered collection of pages ids

UserHasAccessToAllBackendSubpages(Page, User)

Gets a value indicating if the user has access to all subpages in the specified page in the administration

public bool UserHasAccessToAllBackendSubpages(Page page, User user)

Parameters

page Page

The page for which to determine if the user can access that and its subpages

user User

The user for whom to determine access

Returns

bool

True if the user can access the page and all of its subpages, otherwise false

To top