Class Section
Represents a section of an application.
Inherited Members
Namespace: DataWeb.Structure
Assembly: DataWeb.Core.dll
Syntax
public sealed class Section
Remarks
Initializes a new instance of the Section class.
Constructors
Section(IReflectionService, IAppErrorService, IAuthorizationService, IAreaStore, IElementStore, ISectionStore, IViewStore, IServiceProvider)
Represents a section of an application.
Declaration
public Section(IReflectionService reflectionService, IAppErrorService appErrorService, IAuthorizationService authorizationService, IAreaStore areaStore, IElementStore elementStore, ISectionStore sectionStore, IViewStore viewStore, IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
IReflectionService | reflectionService | The IReflectionService instance used for reflection operations. |
IAppErrorService | appErrorService | The IAppErrorService instance used for error handling. |
IAuthorizationService | authorizationService | The authorization service. |
IAreaStore | areaStore | The area store. |
IElementStore | elementStore | The element store. |
ISectionStore | sectionStore | The section store. |
IViewStore | viewStore | The view store. |
IServiceProvider | serviceProvider | The IServiceProvider instance used for dependency injection. |
Remarks
Initializes a new instance of the Section class.
Properties
Color
Gets or sets the color of the section.
Declaration
public string Color { get; set; }
Property Value
Type | Description |
---|---|
string |
IdMaster
Gets or sets the unique identifier.
Declaration
public string IdMaster { get; set; }
Property Value
Type | Description |
---|---|
string |
IdMasterStep
Gets or sets the IdMaster of the section step.
Declaration
public string IdMasterStep { get; set; }
Property Value
Type | Description |
---|---|
string |
IsCompleted
Gets or sets a value indicating whether the section is completed.
Declaration
public bool IsCompleted { get; set; }
Property Value
Type | Description |
---|---|
bool |
Module
Gets or sets the module of the section.
Declaration
public string Module { get; set; }
Property Value
Type | Description |
---|---|
string |
ModuleClass
Gets or sets the module class of the section.
Declaration
public string ModuleClass { get; set; }
Property Value
Type | Description |
---|---|
string |
ModuleComponent
Gets or sets the module component of the section.
Declaration
public string ModuleComponent { get; set; }
Property Value
Type | Description |
---|---|
string |
Name
Gets or sets the name of the section.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
PermissionSetName
Gets or sets the name of the permission set for the section.
Declaration
public string PermissionSetName { get; set; }
Property Value
Type | Description |
---|---|
string |
Settings
Gets or sets the settings of the section.
Declaration
public Section.SectionSettings Settings { get; set; }
Property Value
Type | Description |
---|---|
Section.SectionSettings |
Status
Gets or sets the status of the section.
Declaration
public ItemStatus Status { get; set; }
Property Value
Type | Description |
---|---|
ItemStatus |
Title
Gets or sets the title of the section.
Declaration
public string Title { get; set; }
Property Value
Type | Description |
---|---|
string |
Type
Gets or sets the type of the section.
Declaration
public string Type { get; set; }
Property Value
Type | Description |
---|---|
string |
VisibleRoles
Gets or sets the list of roles that can see the section.
Declaration
public List<string> VisibleRoles { get; set; }
Property Value
Type | Description |
---|---|
List<string> |
Methods
GetAllViewsAsync(CancellationToken)
Get all views associated with the section.
Declaration
public Task<IEnumerable<View>> GetAllViewsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<View>> | An enumerable of views associated with the section. |
GetElementAsync(CancellationToken)
Gets the element associated with the section, if one exists.
Declaration
public Task<Element> GetElementAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Element> | The element associated with the section, or null if no element is associated. |
GetParentAreaAsync(CancellationToken)
Gets the parent area of the section, if one exists.
Declaration
public Task<Area> GetParentAreaAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Area> | The parent area of the section, or null if the section is not part of an area. |
GetParentElementAsync(CancellationToken)
Gets the parent element of the section, if one exists.
Declaration
public Task<Element> GetParentElementAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Element> | The parent element of the section, or null if the section is not part of an element. |
GetSettingValue(string)
Gets the value of the specified setting from the section's settings.
Declaration
public object GetSettingValue(string settingName)
Parameters
Type | Name | Description |
---|---|---|
string | settingName | The name of the setting. |
Returns
Type | Description |
---|---|
object | The value of the setting if it exists, otherwise null. |
GetUserViewsAsync(IUser, CancellationToken)
Get the views associated with the section that the specified user is allowed to see.
Declaration
public Task<IEnumerable<View>> GetUserViewsAsync(IUser user, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
IUser | user | The IUser for whom to get the views. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<View>> | An enumerable of views that the user is allowed to see. |
InitAsync(SectionData, CancellationToken)
Initializes the Section object with the specified SectionData object.
Declaration
public Task InitAsync(SectionData sectionData, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
SectionData | sectionData | The SectionData object containing the section data. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
InitAsync(string, CancellationToken)
Initializes the Section object with data from the section store for the specified section name.
Declaration
public Task InitAsync(string name, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the section. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
Exception | Thrown when the section name is not defined or the section data could not be retrieved from the section store. |
IsVisible(PermissionSet)
Determines whether this section is visible to the given permission set.
Declaration
public bool IsVisible(PermissionSet permissionSet)
Parameters
Type | Name | Description |
---|---|---|
PermissionSet | permissionSet | The PermissionSet to check against. |
Returns
Type | Description |
---|---|
bool | True if the section is visible; false otherwise. |
IsVisibleDataField(DataField, IUser)
Determines whether the given data field is visible to the given user.
Declaration
public static bool IsVisibleDataField(Section.DataField dataField, IUser user)
Parameters
Type | Name | Description |
---|---|---|
Section.DataField | dataField | The Section.DataField to check visibility for. |
IUser | user | The IUser to check visibility for. |
Returns
Type | Description |
---|---|
bool | True if the data field is visible; false otherwise. |
IsVisibleListWidget(ListWidget, IUser)
Determines whether the given widget is visible to the given user.
Declaration
public static bool IsVisibleListWidget(ListWidget listWidget, IUser user)
Parameters
Type | Name | Description |
---|---|---|
ListWidget | listWidget | The ListWidget to check visibility for. |
IUser | user | The IUser to check visibility for. |
Returns
Type | Description |
---|---|
bool | True if the widget is visible; false otherwise. |
SetListWidgetAsync(ListWidget, CancellationToken)
Asynchronously sets the properties of a ListWidgetBase instance based on the provided list widget data.
Declaration
public Task<ListWidget> SetListWidgetAsync(SectionData.ListWidget listWidgetData, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
SectionData.ListWidget | listWidgetData | The data containing properties to set for the list widget. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<ListWidget> | Returns a ListWidget instance with properties set based on the provided data. If an error occurs during instantiation using the provided control class, it defaults to using a predetermined class. |