Table of Contents

Class ParagraphService

Namespace
Dynamicweb.Content
Assembly
Dynamicweb.dll

Provides methods for querying and persisting paragraphs.

public class ParagraphService : ICacheStorage<int, Paragraph>, ICacheStorage<int>, ICacheStorage
Inheritance
ParagraphService
Implements
Inherited Members

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 Paragraph with the specified id form trashbin

public void ClearTrashBin(int paragraphId)

Parameters

paragraphId int

The id of the paragraph to delete

Exceptions

ArgumentException

CopyTo(int, int)

Copies the paragraph with the specified source ID to the page with the specified ID.

public Paragraph CopyTo(int pageID, int source)

Parameters

pageID int

The page ID to move the paragraph to.

source int

The id of the paragraph to copy.

Returns

Paragraph

CopyTo(int, int, bool)

Copies the paragraph with the specified source ID to the page with the specified ID.

public Paragraph CopyTo(int pageID, int source, bool isExperiment)

Parameters

pageID int

The page ID to move the paragraph to.

source int

The id of the paragraph to copy.

isExperiment bool

Specifies whether the source paragraph is copied as a part of an experiment.

Returns

Paragraph

CreateFromMaster(int, int, bool)

Creates a paragraph from master and link them.

public void CreateFromMaster(int masterParagraphId, int onPageId, bool show)

Parameters

masterParagraphId int

The master paragraph ID.

onPageId int

The on page ID.

show bool

if set to true [show].

Delete(int)

Deletes the Paragraph with the specified id

public void Delete(int paragraphId)

Parameters

paragraphId int

The id of the paragraph to delete

Exceptions

ArgumentException

DeleteAllPageParagraphs(Page)

Deletes all paragraphs associated with the specified area

public ApplicationResponse DeleteAllPageParagraphs(Page page)

Parameters

page Page

The page for which to delete all associated paragraphs

Returns

ApplicationResponse

A ApplicationResponse indicating the success or failure of the operation

DeleteAllParagraphs(Area)

Deletes all paragraphs associated with the specified area

public ApplicationResponse DeleteAllParagraphs(Area area)

Parameters

area Area

The area for which to delete all associated paragraphs

Returns

ApplicationResponse

A ApplicationResponse indicating the success or failure of the operation

DeleteParagraphItem(int)

Deletes the paragraph item

public void DeleteParagraphItem(int paragraphId)

Parameters

paragraphId int

The id of the paragraph to delete its item

ForceRefreshIndex(int)

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

public bool ForceRefreshIndex(int paragraphId)

Parameters

paragraphId int

Id of paragraph to be refreshed

Returns

bool

GetAvailableParagraphDefinitions(Page, string)

Gets the collection of available paragraph definitions for specified page.

public IEnumerable<ParagraphDefinition> GetAvailableParagraphDefinitions(Page parent, string container)

Parameters

parent Page

The parent page.

container string

The name of container in layout.

Returns

IEnumerable<ParagraphDefinition>

IEnumerable(Of ParagraphDefinition).

GetCache(IEnumerable<int>)

public IEnumerable<Paragraph> GetCache(IEnumerable<int> keys)

Parameters

keys IEnumerable<int>

Returns

IEnumerable<Paragraph>

GetCache(int)

public Paragraph GetCache(int key)

Parameters

key int

Returns

Paragraph

GetDeletedParagraphs(int)

Gets the collection of deleted paragraphs in specified area

public IEnumerable<Paragraph> GetDeletedParagraphs(int areaId)

Parameters

areaId int

The area id.

Returns

IEnumerable<Paragraph>

A collection of paragraphs

GetLanguageVersionsForParagraph(int)

public IEnumerable<Paragraph> GetLanguageVersionsForParagraph(int paragraphId)

Parameters

paragraphId int

Returns

IEnumerable<Paragraph>

GetLatestModifiedParagraphs(int)

public IEnumerable<Paragraph> GetLatestModifiedParagraphs(int count)

Parameters

count int

Returns

IEnumerable<Paragraph>

GetParagraph(int)

Gets the Paragraph with the specified id

public Paragraph GetParagraph(int paragraphId)

Parameters

paragraphId int

The id of the paragraph to get

Returns

Paragraph

The paragraph with the specified id

Exceptions

ArgumentException

GetParagraphByParagraphOrPageIds(List<int>, List<int>)

Gets the paragraph by paragraph or page ids.

public IEnumerable<Paragraph> GetParagraphByParagraphOrPageIds(List<int> paragraphIds, List<int> pageIds)

Parameters

paragraphIds List<int>

The paragraph ids.

pageIds List<int>

The page ids.

Returns

IEnumerable<Paragraph>

IEnumerable(Of Paragraph).

GetParagraphDraft(int)

Gets the draft version of the paragraph with the specified id if any.

public Paragraph GetParagraphDraft(int paragraphId)

Parameters

paragraphId int

Th id of the paragraph for which to get the draft version

Returns

Paragraph

The draft version of the paragraph with the specified id if any, otherwise null (Nothing)

Exceptions

ArgumentException

GetParagraphDraft(int, DateTime)

Gets the draft version of the paragraph with the specified id if any.

public Paragraph GetParagraphDraft(int paragraphId, DateTime previewDate)

Parameters

paragraphId int

Th id of the paragraph for which to get the draft version

previewDate DateTime

The preview date of the draft version

Returns

Paragraph

The draft version of the paragraph with the specified id if any, otherwise null (Nothing)

Exceptions

ArgumentException

GetParagraphForItem(string, string)

Gets the paragraph for the item with the specified name and id

public Paragraph GetParagraphForItem(string itemType, string itemId)

Parameters

itemType string

The name of the item type

itemId string

The id of the item

Returns

Paragraph

The paragraph associated with the specified item

GetParagraphFromVersion(int, int)

Gets the paragraph with the specified id, but with its values populated from the version with the specified versionId

public Paragraph GetParagraphFromVersion(int paragraphId, int versionId)

Parameters

paragraphId int

The id of the paragraph to get

versionId int

The id of the version from which the paragraph should have its data populated

Returns

Paragraph

A paragraph with data populated from the version with the given versionId

Exceptions

ArgumentException

GetParagraphOrLanguage(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 Paragraph GetParagraphOrLanguage(int paragraphId, int areaId)

Parameters

paragraphId int

The id of the paragraph to get

areaId int

The ara id of the current area

Returns

Paragraph

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

GetParagraphs()

Gets all the paragraphs in the systen

public IEnumerable<Paragraph> GetParagraphs()

Returns

IEnumerable<Paragraph>

A ParagraphCollection with all the paragraphs registred in the systen

GetParagraphsByAreaID(int)

Gets all the paragraphs associated with the specified area id

public IEnumerable<Paragraph> GetParagraphsByAreaID(int areaID)

Parameters

areaID int

The id of the area for which to get all associated Paragraphs

Returns

IEnumerable<Paragraph>

A collection of Paragraphs associated with the specified Area id

GetParagraphsByIds(IEnumerable<int>)

Gets the paragraphs matching the id's in the list

public IEnumerable<Paragraph> GetParagraphsByIds(IEnumerable<int> ids)

Parameters

ids IEnumerable<int>

A list of paragraph ids for which to get the matching Paragraphs

Returns

IEnumerable<Paragraph>

A collection of Paragraphs matching the ids in the specified list

GetParagraphsByItemTypes(IEnumerable<string>)

Gets the paragraphs that has one of the ItemTypes specified in the itemTypes list

public IEnumerable<Paragraph> GetParagraphsByItemTypes(IEnumerable<string> itemTypes)

Parameters

itemTypes IEnumerable<string>

A list of itemTypes for which to get Paragraphs

Returns

IEnumerable<Paragraph>

A collection of Paragraphs

GetParagraphsByModuleName(string)

Gets all the paragraphs that have the specified module name

public IEnumerable<Paragraph> GetParagraphsByModuleName(string moduleName)

Parameters

moduleName string

The module name for which to get all paragraphs

Returns

IEnumerable<Paragraph>

A ParagraphCollection with all paragraphs having the specified module name

GetParagraphsByPageId(int)

Gets all the paragraphs belonging to the page with the specified id

public IEnumerable<Paragraph> GetParagraphsByPageId(int pageId)

Parameters

pageId int

The id of the page for which to get all its paragraphs

Returns

IEnumerable<Paragraph>

A collection of Paragraphs

Exceptions

ArgumentException

GetParagraphsByPageId(int, ParagraphSort)

Gets all the paragraphs belonging to the page with the specified id sorted by the specified sort value

public IEnumerable<Paragraph> GetParagraphsByPageId(int pageId, ParagraphSort sortBy)

Parameters

pageId int

The id of the page for which to get all its paragraphs

sortBy ParagraphSort

A value indicating of the collection of Paragraphs should be sorted

Returns

IEnumerable<Paragraph>

A sorted collection of Paragraphs

Exceptions

ArgumentException

GetTemplateParentPage(int)

Get paragraph template folder

public Page GetTemplateParentPage(int areaId)

Parameters

areaId int

The area id.

Returns

Page

The paragraph template folder

Move(int, int, int)

Moves the specified Paragrah from the source page to the target page

public Paragraph Move(int paragraphId, int sourcePageId, int targetPageId)

Parameters

paragraphId int

The id of the paragraph to move

sourcePageId int

The id of the page from which to move the paragraph

targetPageId int

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

Returns

Paragraph

The newly moved Paragraph

RestoreParagraph(int)

Restore the paragraph with the specified id

public void RestoreParagraph(int paragraphId)

Parameters

paragraphId int

The id of the paragraph to restore

Remarks

It is expected that paragraph parent grid row and page are not deleted. Otherwise they needs to be restored at first.

Exceptions

ApplicationException

SaveAsTemplate(Paragraph, string, string, string, string)

Saves the specified paragraph as a template

public Paragraph SaveAsTemplate(Paragraph paragraph, string name, string description, string image, string category)

Parameters

paragraph Paragraph

The paragraph to save as a template

name string

The name of the new template

description string

A description of the template

image string

An image for the template

category string

A category of the template

Returns

Paragraph

The paragraph template

SaveParagraph(Paragraph)

Saves the specified paragraph to persistance

public Paragraph SaveParagraph(Paragraph paragraph)

Parameters

paragraph Paragraph

The paragraph to save

Returns

Paragraph

The newly saved paragraph

ToggleActive(Paragraph, bool)

Include or exclude a paragraph in the layout of the webpage

public void ToggleActive(Paragraph paragraph, bool active)

Parameters

paragraph Paragraph

The paragraph to include or exclude

active bool

Whether a paragraph is included or excluded

UpdateSortIndex(int, int, string)

Updates the paragraph sorting index and container in layout.

public void UpdateSortIndex(int paragraphId, int sortIndex, string container)

Parameters

paragraphId int

The id of the paragraph to update sort index

sortIndex int

The new sort index

container string

The name of container in layout.

To top