DataWeb
Search Results for

    Show / Hide Table of Contents

    Class AutomationEventService

    Provides methods for managing event automation.

    Inheritance
    object
    AutomationEventService
    Implements
    IAutomationEventService
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DataWeb.Automation
    Assembly: DataWeb.Core.dll
    Syntax
    public class AutomationEventService : IAutomationEventService
    Remarks

    Initializes a new instance of the AppSettingService class.

    Constructors

    AutomationEventService(IAutomationProfileStore, IAutomationEventStore, IListService, IConfiguration, TimeProvider, IDataProtectionProvider, IAppErrorService)

    Provides methods for managing event automation.

    Declaration
    public AutomationEventService(IAutomationProfileStore automationProfileStore, IAutomationEventStore automationEventStore, IListService listService, IConfiguration Configuration, TimeProvider timeProvider, IDataProtectionProvider dataProtectionProvider, IAppErrorService appErrorService)
    Parameters
    Type Name Description
    IAutomationProfileStore automationProfileStore

    An instance of the IAutomationProfileStore interface.

    IAutomationEventStore automationEventStore

    An instance of the IAutomationEventStore interface.

    IListService listService
    IConfiguration Configuration
    TimeProvider timeProvider
    IDataProtectionProvider dataProtectionProvider
    IAppErrorService appErrorService
    Remarks

    Initializes a new instance of the AppSettingService class.

    Properties

    AutomationAppSettings

    Gets the automation application settings loaded from configuration.

    Declaration
    public AutomationAppSettings AutomationAppSettings { get; }
    Property Value
    Type Description
    AutomationAppSettings

    Methods

    AddTriggeredTaskToEventAsync(string, string, TriggeredTask, CancellationToken)

    Asynchronously adds a triggered task to the automation event.

    Declaration
    public Task AddTriggeredTaskToEventAsync(string automationEventId, string automationEventEmail, AutomationEvent.TriggeredTask triggeredTask, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string automationEventId

    The id of the automation event.

    string automationEventEmail

    The email of the automation event.

    AutomationEvent.TriggeredTask triggeredTask

    The triggered task to add.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task that represents the asynchronous operation.

    EventExistsAsync(AutomationEventFilter, CancellationToken)

    Determines whether an automation event exists based on the specified filter.

    Declaration
    public Task<bool> EventExistsAsync(AutomationEventFilter filter, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEventFilter filter

    The filter to apply when checking for the event.

    CancellationToken cancellationToken

    A token to cancel the operation.

    Returns
    Type Description
    Task<bool>

    True if the event exists; otherwise, false.

    GetEmailFromContext(IUser, HttpContext)

    Retrieves the email of the authenticated user, or attempts to get and decrypt the email from a browser cookie if the user is not authenticated.

    Declaration
    public string GetEmailFromContext(IUser user, HttpContext httpContext)
    Parameters
    Type Name Description
    IUser user

    The user object containing authentication and email information.

    HttpContext httpContext

    The current HTTP context, used to access request cookies.

    Returns
    Type Description
    string

    The user's email if authenticated, the decrypted email from the cookie if available, or null if neither is found.

    GetEventAsync(AutomationEventFilter, CancellationToken)

    Retrieves a single automation event that matches the specified filter.

    Declaration
    public Task<AutomationEvent> GetEventAsync(AutomationEventFilter filter, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEventFilter filter

    The filter to apply when searching for the event.

    CancellationToken cancellationToken

    A token to cancel the operation.

    Returns
    Type Description
    Task<AutomationEvent>

    The matching automation event, if found.

    GetEventCountAsync(AutomationEventFilter, CancellationToken)

    Asynchronously retrieves the count of automation events that match the specified filter.

    Declaration
    public Task<long> GetEventCountAsync(AutomationEventFilter filter, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEventFilter filter

    The filter criteria used to query the automation events.

    CancellationToken cancellationToken

    A token to monitor for cancellation requests.

    Returns
    Type Description
    Task<long>

    The total number of matching automation events as a long.

    GetEventsAsync(AutomationEventFilter, CancellationToken)

    Retrieves a list of automation events based on the specified filter.

    Declaration
    public Task<IEnumerable<AutomationEvent>> GetEventsAsync(AutomationEventFilter filter, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEventFilter filter

    The filter to apply when searching for events.

    CancellationToken cancellationToken

    A token to cancel the operation.

    Returns
    Type Description
    Task<IEnumerable<AutomationEvent>>

    A list of matching automation events.

    SetEventAsync(AutomationEvent, CancellationToken)

    Asynchronously adds an automation event to the store.

    Declaration
    public Task SetEventAsync(AutomationEvent automationEvent, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEvent automationEvent

    The AutomationEvent to add to the store.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task that represents the asynchronous operation.

    SetEventAsync(string, string, List<Parameter>, List<AdditionalValue>, int, int, bool, CancellationToken)

    Creates and stores an automation event for a given user, validating input data, event type requirements, throttling constraints, and profile existence if specified.

    Declaration
    public Task<AutomationEventService.EventEditResult> SetEventAsync(string email, string type, List<AutomationEvent.Parameter> parameters = null, List<AutomationEvent.AdditionalValue> additionalValues = null, int throttlingHours = 24, int expirationDays = 365, bool checkProfileExists = true, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string email

    The email address of the user for whom the event is being created.

    string type

    The type of automation event to create. Must correspond to a valid value in the AutomationEvent_Types list.

    List<AutomationEvent.Parameter> parameters

    Optional list of parameters required by the event type.

    List<AutomationEvent.AdditionalValue> additionalValues

    Optional list of additional values associated with the event.

    int throttlingHours

    The number of hours used to prevent duplicate events within the specified window. Must be greater than 0. Default is 24.

    int expirationDays

    The number of days after which the event expires. Default is 365.

    bool checkProfileExists

    Whether to check if the user has an active automation profile before creating the event. Default is true.

    CancellationToken cancellationToken

    A token to monitor for cancellation requests.

    Returns
    Type Description
    Task<AutomationEventService.EventEditResult>

    An AutomationEventService.EventEditResult object containing the result of the operation and the created event, if any.

    Exceptions
    Type Condition
    Exception

    Thrown when the event type is not specified or when throttlingHours is set to 0.

    SetProfileCookie(string, HttpContext, bool)

    Sets a secure, HTTP-only cookie containing the encrypted email address for user profile automation purposes.

    Declaration
    public void SetProfileCookie(string email, HttpContext httpContext, bool isProfilingConsentRequired = true)
    Parameters
    Type Name Description
    string email

    The email address to be encrypted and stored in the cookie.

    HttpContext httpContext

    The current HTTP context, used to append response cookies.

    bool isProfilingConsentRequired

    Indicates whether to enforce profiling cookie consent checks before setting the automation email cookie.

    Implements

    IAutomationEventService
    In this article
    Back to top Generated by DocFX