Table of Contents

Class PageService

Namespace
Dynamicweb.Content
Assembly
Dynamicweb.dll
Provides methods for querying and persisting pages.
public class PageService : IPageService, IRecyclable<Page>, ICacheStorage<int, Page>, ICacheStorage<int>, ICacheStorage
Inheritance
PageService
Implements
Inherited Members

Constructors

PageService()

The repository implementation providing access to persistence
public PageService()

Properties

Repository

Gets the repository for working with the Page aggregate
[Obsolete("Do not use")]
public static IPageRepository Repository { get; set; }

Property Value

IPageRepository

Methods

ClearCache()

Clear page cache
public void ClearCache()

ClearCache(IEnumerable<int>)

Clear page cache
public void ClearCache(IEnumerable<int> keys)

Parameters

keys IEnumerable<int>

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

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)

Deletes all pages in the specified area
public ApplicationResponse DeleteAllAreaPages(Area area)

Parameters

area Area
The area for which to delete all pages

Returns

ApplicationResponse

DeleteAllPages(Area)

Deletes all pages in the specified area
[Obsolete("Use DeleteAllAreaPages instead.")]
public ApplicationResponse DeleteAllPages(Area area)

Parameters

area Area
The area for which to delete all pages

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 a subset of the website with the pages located under the page 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

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).

GetFirstActivePageForArea(int)

Gets the first active root page for the area with the specified id.
[Obsolete("Use GetFirstPageForArea instead.")]
public Page GetFirstActivePageForArea(int areaId)

Parameters

areaId int
The id of the area for which to get the page

Returns

Page
The first active page for the specified area

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)

Gets the page with the specified navigation tag.
public Page GetPageByNavigationTag(int areaId, string navigationTag)

Parameters

areaId int
The area identifier.
navigationTag string
The navigation tag.

Returns

Page
The first area page with the specified navigationtag

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

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

GetPagesWithPermissions()

Gets all pages that have assigned permissions
public IEnumerable<Page> GetPagesWithPermissions()

Returns

IEnumerable<Page>
A list of page instances that have permissions assigned

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

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

GetSolutionInfo()

Gets a SolutionInfo instance having general information about the entire solution
[Obsolete("Use GetWebpageCount instead.")]
public SolutionInfo GetSolutionInfo()

Returns

SolutionInfo
A SolutionInfo instance having information about the entire solution

Remarks

Method was obsoleted because it uses an expensive database call to calculate page count.

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()

Gets number of webpages on solution.
public int GetWebpageCount()

Returns

int
webpageCount

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

MoveToBin(Page)

Moves the specified page to the recycle bin
public Guid MoveToBin(Page obj)

Parameters

obj Page
The page to move to the recycle bin

Returns

Guid

MoveToExistingBin(Page, Guid)

Moves the specified page to an existing RecycleBin with the specified unit id
public void MoveToExistingBin(Page obj, Guid unitId)

Parameters

obj Page
The page to move to an existing bin
unitId Guid
The id of the existing recycle bin to which this page should be moved

Restore(object)

Restores the page with the given id from the recycle bin
public void Restore(object id)

Parameters

id object
The id of the page to restore

Exceptions

InvalidOperationException
Thrown when there is attempt to restore page having non-existing relations e.g. parent page or itemtype.

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
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