Class EventService
Provides event management operations for the OEMS system.
Implements
Inherited Members
Namespace: OEMS.Core.Application.ApplicationServices
Assembly: OEMS.Core.dll
Syntax
public class EventService : IEventService
Constructors
EventService(IEventRepository, IEventProcessRepository, IMapper, IEventParticipationRepository, IUserRepository, IFileService, IProcessService, IEventCategoryRepository)
Initializes a new instance of the EventService class.
Declaration
public EventService(IEventRepository eventRepo, IEventProcessRepository eventProcess, IMapper mapper, IEventParticipationRepository participationRepo, IUserRepository userRepository, IFileService fileService, IProcessService processService, IEventCategoryRepository categoryRepository)
Parameters
Type | Name | Description |
---|---|---|
IEventRepository | eventRepo | The event repository for data access operations. |
IEventProcessRepository | eventProcess | The event process repository for process data access operations. |
IMapper | mapper | The AutoMapper instance for object mapping. |
IEventParticipationRepository | participationRepo | The event participation repository for participation data access operations. |
IUserRepository | userRepository | The user repository for user data access operations. |
IFileService | fileService | The file service for file operations. |
IProcessService | processService | The process service for process operations. |
IEventCategoryRepository | categoryRepository | The event category repository for category data access operations. |
Methods
AddProcessAsync(Guid, CreateProcessDto)
Adds a new process to an event.
Declaration
public Task<ProcessDto> AddProcessAsync(Guid eventId, CreateProcessDto dto)
Parameters
Type | Name | Description |
---|---|---|
Guid | eventId | The unique identifier of the event. |
CreateProcessDto | dto | The process creation data transfer object. |
Returns
Type | Description |
---|---|
Task<ProcessDto> | A task that represents the asynchronous operation. The task result contains the created process data transfer object. |
AddProcessStepAsync(Guid, CreateProcessStepDto)
Takes a create processstep Dto and adds it to existing process
Declaration
public Task<ProcessStepDto> AddProcessStepAsync(Guid processId, CreateProcessStepDto dto)
Parameters
Type | Name | Description |
---|---|---|
Guid | processId | GUID of process |
CreateProcessStepDto | dto | Create Processstep Dto |
Returns
Type | Description |
---|---|
Task<ProcessStepDto> |
ArchivePastEventsAsync(CancellationToken)
Archives Events
Declaration
public Task<int> ArchivePastEventsAsync(CancellationToken ct = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | ct | Cancellation Token |
Returns
Type | Description |
---|---|
Task<int> | Number of Events archived |
CancelEventAsync(Guid, string)
Setzt den Status eines Events auf „Cancelled“ und speichert einen Grund.
Declaration
public Task<EventDto> CancelEventAsync(Guid eventId, string cancellationReason)
Parameters
Type | Name | Description |
---|---|---|
Guid | eventId | |
string | cancellationReason |
Returns
Type | Description |
---|---|
Task<EventDto> |
CancelEventRegistrationAsync(Guid, Guid)
Unregisters user from event
Declaration
public Task<bool> CancelEventRegistrationAsync(Guid userId, Guid eventId)
Parameters
Type | Name | Description |
---|---|---|
Guid | userId | user GUID |
Guid | eventId | event GUID |
Returns
Type | Description |
---|---|
Task<bool> | True/False if unregistration successfull |
CheckIfEventWithCategory(Guid, Guid)
Checks if event is associated with a category
Declaration
public Task<(bool hasAny, List<string> eventNames)> CheckIfEventWithCategory(Guid orgId, Guid categoryId)
Parameters
Type | Name | Description |
---|---|---|
Guid | orgId | |
Guid | categoryId |
Returns
Type | Description |
---|---|
Task<(bool hasAny, List<string> eventNames)> | Task of type bool if event has a category |
CreateEventAsync(CreateEventDto, Guid, Guid)
Create new event
Declaration
public Task CreateEventAsync(CreateEventDto dto, Guid organizerId, Guid organisationId)
Parameters
Type | Name | Description |
---|---|---|
CreateEventDto | dto | Create Event DTO |
Guid | organizerId | Organizer GUID |
Guid | organisationId | Organisation GUID |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
ArgumentException |
DeleteEventAsync(Guid)
Löscht ein Event.
Declaration
public Task DeleteEventAsync(Guid eventId)
Parameters
Type | Name | Description |
---|---|---|
Guid | eventId |
Returns
Type | Description |
---|---|
Task |
DeleteEventIfNoParticipantsAsync(Guid, Guid)
Deletes Event if no participants registered
Declaration
public Task<bool> DeleteEventIfNoParticipantsAsync(Guid eventId, Guid userId)
Parameters
Type | Name | Description |
---|---|---|
Guid | eventId | Event GUID |
Guid | userId | GUID of user requesting. Only Event Creator is allowed to delete |
Returns
Type | Description |
---|---|
Task<bool> |
DeleteProcessAsync(Guid, Guid)
Deletes Process from event
Declaration
public Task DeleteProcessAsync(Guid processId, Guid eventId)
Parameters
Type | Name | Description |
---|---|---|
Guid | processId | |
Guid | eventId |
Returns
Type | Description |
---|---|
Task |
DeleteProcessStepAsync(Guid, Guid)
Removes ProcessStep from process and event
Declaration
public Task DeleteProcessStepAsync(Guid processstepId, Guid eventId)
Parameters
Type | Name | Description |
---|---|---|
Guid | processstepId | processtep GUID |
Guid | eventId | event GUID |
Returns
Type | Description |
---|---|
Task |
GetAllEventsbyOrganisationAsync(Guid)
Gets all events for a given organization
Declaration
public Task<IEnumerable<EventDto>> GetAllEventsbyOrganisationAsync(Guid orgId)
Parameters
Type | Name | Description |
---|---|---|
Guid | orgId | organization GUID |
Returns
Type | Description |
---|---|
Task<IEnumerable<EventDto>> | Enumerable of EventDto, so Dashboard can navigate over attributes |
GetEventByIdAsync(Guid)
Gets Event from DB by Event GUID, with all associated data. Returns EventDTO
Declaration
public Task<EventDto> GetEventByIdAsync(Guid eventId)
Parameters
Type | Name | Description |
---|---|---|
Guid | eventId | Event GUID |
Returns
Type | Description |
---|---|
Task<EventDto> | EventDto |
Exceptions
Type | Condition |
---|---|
KeyNotFoundException |
GetEventsByOrganizationAsync(Guid)
Liefert alle Events einer Organisation.
Declaration
public Task<IEnumerable<EventDto>> GetEventsByOrganizationAsync(Guid organizationId)
Parameters
Type | Name | Description |
---|---|---|
Guid | organizationId |
Returns
Type | Description |
---|---|
Task<IEnumerable<EventDto>> |
GetEventsByStatusAsync(EventStatus)
Liefert Events nach ihrem Status.
Declaration
public Task<IEnumerable<EventDto>> GetEventsByStatusAsync(EventStatus status)
Parameters
Type | Name | Description |
---|---|---|
EventStatus | status |
Returns
Type | Description |
---|---|
Task<IEnumerable<EventDto>> |
GetEventsInDateRangeAsync(DateTime, DateTime)
Liefert Events innerhalb eines Datumsbereichs.
Declaration
public Task<IEnumerable<EventDto>> GetEventsInDateRangeAsync(DateTime from, DateTime to)
Parameters
Type | Name | Description |
---|---|---|
DateTime | from | |
DateTime | to |
Returns
Type | Description |
---|---|
Task<IEnumerable<EventDto>> |
GetParticipantsByEventIdAsync(Guid)
Gets all participants for an event
Declaration
public Task<List<EventParticipantDto>> GetParticipantsByEventIdAsync(Guid eventId)
Parameters
Type | Name | Description |
---|---|---|
Guid | eventId | event GUID |
Returns
Type | Description |
---|---|
Task<List<EventParticipantDto>> | List of type participant Dto |
GetUniqueEventCategories(List<EventDto>)
Gets event categories
Declaration
public Task<List<string>> GetUniqueEventCategories(List<EventDto> events)
Parameters
Type | Name | Description |
---|---|---|
List<EventDto> | events | List of Type Event Dto |
Returns
Type | Description |
---|---|
Task<List<string>> | Collection of Event Dto |
GetUserRegisteredEventIdsAsync(Guid, IEnumerable<Guid>)
Gets all users registered to an event
Declaration
public Task<HashSet<Guid>> GetUserRegisteredEventIdsAsync(Guid userId, IEnumerable<Guid> eventIds)
Parameters
Type | Name | Description |
---|---|---|
Guid | userId | user GUID |
IEnumerable<Guid> | eventIds | event GUID |
Returns
Type | Description |
---|---|
Task<HashSet<Guid>> | A Hash Set of user GUIDs |
InviteParticipantAsync(Guid, Guid)
Invites a single participant to an event. Checks if already registered to event, if not checks if max Number Participants reached. Else adds to event participants
Declaration
public Task InviteParticipantAsync(Guid eventId, Guid userId)
Parameters
Type | Name | Description |
---|---|---|
Guid | eventId | event GUID |
Guid | userId | user GUID |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
InvalidOperationException |
InviteParticipantsAsync(Guid, IEnumerable<Guid>)
Declaration
public Task InviteParticipantsAsync(Guid eventId, IEnumerable<Guid> userIds)
Parameters
Type | Name | Description |
---|---|---|
Guid | eventId | |
IEnumerable<Guid> | userIds |
Returns
Type | Description |
---|---|
Task |
InviteUserByEmailAsync(Guid, string)
Invites user by sending an e-mail
Declaration
public Task InviteUserByEmailAsync(Guid eventId, string email)
Parameters
Type | Name | Description |
---|---|---|
Guid | eventId | event GUID |
string | E-Mail as string |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
InvalidOperationException |
IsUserRegisteredAsync(Guid, Guid)
Checks if user is registered to event
Declaration
public Task<bool> IsUserRegisteredAsync(Guid userId, Guid eventId)
Parameters
Type | Name | Description |
---|---|---|
Guid | userId | user GUID |
Guid | eventId | event GUID |
Returns
Type | Description |
---|---|
Task<bool> | TRUE/FALSE |
RegisterUserToEventAsync(Guid, Guid)
Registers user to event, checks if max. number of participants reached
Declaration
public Task<bool> RegisterUserToEventAsync(Guid userId, Guid eventId)
Parameters
Type | Name | Description |
---|---|---|
Guid | userId | GUID user Id |
Guid | eventId | GUID event Id |
Returns
Type | Description |
---|---|
Task<bool> |
RemoveParticipantAsync(Guid, Guid)
Removes a participant from an event. Checks if already registered
Declaration
public Task RemoveParticipantAsync(Guid eventId, Guid userId)
Parameters
Type | Name | Description |
---|---|---|
Guid | eventId | event GUID |
Guid | userId | user GUID |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
InvalidOperationException |
UpdateBasicEventAsync(Guid, UpdateEventDto)
Updates Event, but only less complex attributes like title, description etc.
Declaration
public Task UpdateBasicEventAsync(Guid eventId, UpdateEventDto dto)
Parameters
Type | Name | Description |
---|---|---|
Guid | eventId | |
UpdateEventDto | dto | UpdateEventDto |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
KeyNotFoundException |
UpdateEventAsync(Guid, UpdateEventDto)
Aktualisiert ein Event inklusive seiner Prozesse und Dateiverknüpfungen.
Alle alten Prozesse/Schritte werden gelöscht und durch den Inhalt des
dto
ersetzt.
Bereits hochgeladene PDF-Dateien werden nach dem Re-Create wieder
an die neuen Schritte angehängt.
Declaration
public Task<EventDto> UpdateEventAsync(Guid eventId, UpdateEventDto dto)
Parameters
Type | Name | Description |
---|---|---|
Guid | eventId | |
UpdateEventDto | dto |
Returns
Type | Description |
---|---|
Task<EventDto> |
UpdateProcessAsync(Guid, UpdateProcessDto)
Updates a process
Declaration
public Task<ProcessDto> UpdateProcessAsync(Guid processId, UpdateProcessDto dto)
Parameters
Type | Name | Description |
---|---|---|
Guid | processId | |
UpdateProcessDto | dto | UpdateProcessDto |
Returns
Type | Description |
---|---|
Task<ProcessDto> |
Exceptions
Type | Condition |
---|---|
KeyNotFoundException |
UpdateProcessStepAsync(Guid, UpdateProcessStepDto)
Updates a process step.
Declaration
public Task<ProcessStepDto> UpdateProcessStepAsync(Guid stepId, UpdateProcessStepDto dto)
Parameters
Type | Name | Description |
---|---|---|
Guid | stepId | |
UpdateProcessStepDto | dto | UpdateProcessStepDto |
Returns
Type | Description |
---|---|
Task<ProcessStepDto> |
Exceptions
Type | Condition |
---|---|
KeyNotFoundException |