DataWeb
Search Results for

    Show / Hide Table of Contents

    Class FormService

    Provides services related to forms.

    Inheritance
    object
    FormService
    Implements
    IFormService
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DataWeb.Data
    Assembly: DataWeb.Core.dll
    Syntax
    public sealed class FormService : IFormService
    Remarks

    Initializes a new instance of the FormService class.

    Constructors

    FormService(IReflectionService, IAppErrorService, IFormStore, IServiceProvider)

    Provides services related to forms.

    Declaration
    public FormService(IReflectionService reflectionService, IAppErrorService appErrorService, IFormStore formStore, IServiceProvider serviceProvider)
    Parameters
    Type Name Description
    IReflectionService reflectionService

    The reflection service.

    IAppErrorService appErrorService

    The application error service.

    IFormStore formStore

    The form store.

    IServiceProvider serviceProvider

    The service provider.

    Remarks

    Initializes a new instance of the FormService class.

    Methods

    GetFormAsync(string, string, CancellationToken)

    Gets a Form object for the specified form name and culture.

    Declaration
    public Task<Form> GetFormAsync(string name, string culture = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string name

    The name of the form.

    string culture

    The culture.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<Form>

    A Form object.

    GetFormDefaultValuesAsync(Form, IUser, string, NavigationContext, CancellationToken)

    Gets the default values of a form's controls.

    Declaration
    public Task<Dictionary<string, object>> GetFormDefaultValuesAsync(Form form, IUser user, string itemId = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Form form

    The Form to get the default values for.

    IUser user

    The IUser requesting the form.

    string itemId

    The Id of the item the form relates to.

    NavigationContext navigationContext

    The NavigationContext for the form.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<Dictionary<string, object>>

    A Dictionary<TKey, TValue> containing the default values of the form's controls.

    GetFormValuesAsync(Form, Dictionary<string, object>, IUser, string, NavigationContext, Control, CancellationToken)

    Gets the values of a form's controls.

    Declaration
    public Task<Dictionary<string, object>> GetFormValuesAsync(Form form, Dictionary<string, object> sectionData, IUser user, string itemId = null, NavigationContext navigationContext = null, Control parentControl = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Form form

    The Form to get the values for.

    Dictionary<string, object> sectionData

    The section data for the form.

    IUser user

    The IUser requesting the form.

    string itemId

    The Id of the item the form relates to.

    NavigationContext navigationContext

    The NavigationContext for the form.

    Control parentControl

    The parent Control for the form.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<Dictionary<string, object>>

    A Dictionary<TKey, TValue> containing the values of the form's controls.

    GetFormsAsync(string, CancellationToken)

    Gets all forms for the specified culture.

    Declaration
    public Task<IEnumerable<Form>> GetFormsAsync(string culture = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string culture

    The culture to retrieve the forms for.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IEnumerable<Form>>

    An IEnumerable<T> of Form objects representing the retrieved forms.

    UpdateDataWithFormAsync(Dictionary<string, object>, Form, List<ProvidedValue>, IUser, string, NavigationContext, Control, CancellationToken)

    Updates the data for the provided section with the values from the form and provided values.

    Declaration
    public Task UpdateDataWithFormAsync(Dictionary<string, object> sectionData, Form form, List<Form.ProvidedValue> providedValues, IUser user, string itemId = null, NavigationContext navigationContext = null, Control parentControl = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Dictionary<string, object> sectionData

    The data for the section to update.

    Form form

    The Form containing the controls for the data.

    List<Form.ProvidedValue> providedValues

    The values provided for the form.

    IUser user

    The IUser who is updating the data.

    string itemId

    The Id of the item to update (if applicable).

    NavigationContext navigationContext

    The NavigationContext for the form (if applicable).

    Control parentControl

    The parent Control for the section data (if applicable).

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task representing the asynchronous update operation.

    ValidateControlContextAsync(string, string, string, IUser, CancellationToken)

    Validates the context of a control against the specified user's permissions.

    Declaration
    public Task<ValidateControlContextResult> ValidateControlContextAsync(string formName, string controlFullName, string controlType, IUser user, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string formName

    The name of the form containing the control.

    string controlFullName

    The full name of the control.

    string controlType

    The type of the control.

    IUser user

    The IUser to validate the control context against.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<ValidateControlContextResult>

    A task representing the asynchronous validation operation. The result of the task is a ValidateControlContextResult object containing the result of the validation.

    ValidateControlContextWithActionAsync(string, string, string, string, string, string, Module, IUser, CancellationToken)

    Validates the context of a control against the specified user's permissions.

    Declaration
    public Task<ValidateControlContextResult> ValidateControlContextWithActionAsync(string formName, string controlFullName, string controlType, string actionName, string actionContext, string sourceFullName, Module explorerModule, IUser user, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string formName

    The name of the form containing the control.

    string controlFullName

    The full name of the control.

    string controlType

    The type of the control.

    string actionName

    The action containing the form.

    string actionContext

    The action context of the action.

    string sourceFullName

    The suorce control full name associated to the action.

    Module explorerModule

    The Module in the context.

    IUser user

    The IUser to validate the control context against.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<ValidateControlContextResult>

    A task representing the asynchronous validation operation. The result of the task is a ValidateControlContextResult object containing the result of the validation.

    ValidateFormAsync(Form, List<ProvidedValue>, IUser, Dictionary<string, object>, string, NavigationContext, string, CancellationToken)

    Validates the entire form against the provided values and returns a list of validation errors.

    Declaration
    public Task<List<ValidationError>> ValidateFormAsync(Form form, List<Form.ProvidedValue> providedValues, IUser user, Dictionary<string, object> sectionData, string itemId = null, NavigationContext navigationContext = null, string prefix = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Form form

    The Form to validate.

    List<Form.ProvidedValue> providedValues

    The values provided for the form.

    IUser user

    The IUser who is validating the form.

    Dictionary<string, object> sectionData

    The data for the form sections.

    string itemId

    The Id of the item to validate (if applicable).

    NavigationContext navigationContext

    The NavigationContext for the form (if applicable).

    string prefix

    The prefix for the controls in the form (if applicable).

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<List<ValidationError>>

    A task representing the asynchronous validation operation. The result of the task is a list of validation errors.

    Implements

    IFormService
    In this article
    Back to top Generated by DocFX