From 6e8f14d11d42cb27ac7b1e755a4f95a5900a3793 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Mon, 12 May 2025 09:34:55 +0200 Subject: [PATCH 01/34] NEW: IEventRegistrationService Initial Interface Definition --- Shared/Interfaces/IEventRegistrationService.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Shared/Interfaces/IEventRegistrationService.cs b/Shared/Interfaces/IEventRegistrationService.cs index 28fa34e..769409f 100644 --- a/Shared/Interfaces/IEventRegistrationService.cs +++ b/Shared/Interfaces/IEventRegistrationService.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -5,14 +6,21 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services { public interface IEventRegistrationService { - Task> GetEventRegistrationsAsync(int ModuleId); + /* Reine Events */ + Task> GetEventsAsync(int ModuleId); - Task GetEventRegistrationAsync(int EventRegistrationId, int ModuleId); + Task AddEventAsync(Models.Event NewEvent); - Task AddEventRegistrationAsync(Models.Event EventRegistration); + Task UpdateEventAsync(Models.Event NewEvent); - Task UpdateEventRegistrationAsync(Models.Event EventRegistration); + Task DeleteEventAsync(int EventId, int ModuleId); - Task DeleteEventRegistrationAsync(int EventRegistrationId, int ModuleId); + + /* Events & Responses */ + Task AddOrUpdateResponseAsync(int EventId, int ModuleId, bool ResponseType); + + Task<(Models.Event, Models.Response)> GetEventDetails(int EventId, int ModuleId); + + Task> GetEventResponses(int EventId, int ModuleId); } } From 467d11c97bf3b8b5ae80f8fa95a6abf5a137cd3d Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Mon, 12 May 2025 10:54:57 +0200 Subject: [PATCH 02/34] NEW: EventRegistrationService: generated methods to implement --- Server/Services/EventRegistrationService.cs | 40 +++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/Server/Services/EventRegistrationService.cs b/Server/Services/EventRegistrationService.cs index 3d2f62a..a7a964f 100644 --- a/Server/Services/EventRegistrationService.cs +++ b/Server/Services/EventRegistrationService.cs @@ -7,6 +7,7 @@ using Oqtane.Infrastructure; using Oqtane.Models; using Oqtane.Security; using Oqtane.Shared; +using SZUAbsolventenverein.Module.EventRegistration.Models; using SZUAbsolventenverein.Module.EventRegistration.Repository; namespace SZUAbsolventenverein.Module.EventRegistration.Services @@ -28,7 +29,42 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services _alias = tenantManager.GetAlias(); } - public Task> GetEventRegistrationsAsync(int ModuleId) + public Task AddEventAsync(Event NewEvent) + { + throw new System.NotImplementedException(); + } + + public Task AddOrUpdateResponseAsync(int EventId, int ModuleId, bool ResponseType) + { + throw new System.NotImplementedException(); + } + + public Task DeleteEventAsync(int EventId, int ModuleId) + { + throw new System.NotImplementedException(); + } + + public Task<(Event, Response)> GetEventDetails(int EventId, int ModuleId) + { + throw new System.NotImplementedException(); + } + + public Task> GetEventResponses(int EventId, int ModuleId) + { + throw new System.NotImplementedException(); + } + + public Task> GetEventsAsync(int ModuleId) + { + throw new System.NotImplementedException(); + } + + public Task UpdateEventAsync(Event NewEvent) + { + throw new System.NotImplementedException(); + } + + /*public Task> GetEventRegistrationsAsync(int ModuleId) { if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View)) { @@ -96,6 +132,6 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Delete Attempt {EventRegistrationId} {ModuleId}", EventRegistrationId, ModuleId); } return Task.CompletedTask; - } + }*/ } } From fe75ba6fedc2a55a3db9ef332370bd9cbc124c9f Mon Sep 17 00:00:00 2001 From: Julian Kargl Date: Mon, 12 May 2025 11:38:15 +0200 Subject: [PATCH 03/34] Implemented EventRegistrationService Event Methods --- Server/Services/EventRegistrationService.cs | 62 +++++++++++++-------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/Server/Services/EventRegistrationService.cs b/Server/Services/EventRegistrationService.cs index a7a964f..79a4e8f 100644 --- a/Server/Services/EventRegistrationService.cs +++ b/Server/Services/EventRegistrationService.cs @@ -31,7 +31,17 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services public Task AddEventAsync(Event NewEvent) { - throw new System.NotImplementedException(); + if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, NewEvent.ModuleId, PermissionNames.Edit)) + { + NewEvent = _EventRegistrationRepository.AddEventRegistration(NewEvent); + _logger.Log(LogLevel.Information, this, LogFunction.Create, "EventRegistration Added {NewEvent}", NewEvent); + } + else + { + _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Add Attempt {NewEvent}", NewEvent); + NewEvent = null; + } + return Task.FromResult(NewEvent); } public Task AddOrUpdateResponseAsync(int EventId, int ModuleId, bool ResponseType) @@ -41,7 +51,16 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services public Task DeleteEventAsync(int EventId, int ModuleId) { - throw new System.NotImplementedException(); + if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.Edit)) + { + _EventRegistrationRepository.DeleteEventRegistration(EventId); + _logger.Log(LogLevel.Information, this, LogFunction.Delete, "EventRegistration Deleted {EventId}", EventId); + } + else + { + _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Delete Attempt {EventId} {ModuleId}", EventId, ModuleId); + } + return Task.CompletedTask; } public Task<(Event, Response)> GetEventDetails(int EventId, int ModuleId) @@ -55,16 +74,6 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services } public Task> GetEventsAsync(int ModuleId) - { - throw new System.NotImplementedException(); - } - - public Task UpdateEventAsync(Event NewEvent) - { - throw new System.NotImplementedException(); - } - - /*public Task> GetEventRegistrationsAsync(int ModuleId) { if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View)) { @@ -77,6 +86,23 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services } } + public Task UpdateEventAsync(Event NewEvent) + { + if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, NewEvent.ModuleId, PermissionNames.Edit)) + { + NewEvent = _EventRegistrationRepository.UpdateEventRegistration(NewEvent); + _logger.Log(LogLevel.Information, this, LogFunction.Update, "EventRegistration Updated {NewEvent}", NewEvent); + } + else + { + _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Update Attempt {NewEvent}", NewEvent); + NewEvent = null; + } + return Task.FromResult(NewEvent); + } + + /* + public Task GetEventRegistrationAsync(int EventRegistrationId, int ModuleId) { if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View)) @@ -120,18 +146,6 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services return Task.FromResult(EventRegistration); } - public Task DeleteEventRegistrationAsync(int EventRegistrationId, int ModuleId) - { - if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.Edit)) - { - _EventRegistrationRepository.DeleteEventRegistration(EventRegistrationId); - _logger.Log(LogLevel.Information, this, LogFunction.Delete, "EventRegistration Deleted {EventRegistrationId}", EventRegistrationId); - } - else - { - _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Delete Attempt {EventRegistrationId} {ModuleId}", EventRegistrationId, ModuleId); - } - return Task.CompletedTask; }*/ } } From 7977f92a063badaee8312df05302d4b643830969 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Mon, 12 May 2025 11:47:25 +0200 Subject: [PATCH 04/34] COSMETIC: rename EventRepository --- Server/Manager/EventRegistrationManager.cs | 10 +++++----- ...trationRepository.cs => EventRepository.cs} | 18 +++++++++--------- .../Repository/IEventRegistrationRepository.cs | 15 --------------- Server/Repository/IEventRepository.cs | 15 +++++++++++++++ Server/Services/EventRegistrationService.cs | 4 ++-- 5 files changed, 31 insertions(+), 31 deletions(-) rename Server/Repository/{EventRegistrationRepository.cs => EventRepository.cs} (67%) delete mode 100644 Server/Repository/IEventRegistrationRepository.cs create mode 100644 Server/Repository/IEventRepository.cs diff --git a/Server/Manager/EventRegistrationManager.cs b/Server/Manager/EventRegistrationManager.cs index b23c74f..049eae5 100644 --- a/Server/Manager/EventRegistrationManager.cs +++ b/Server/Manager/EventRegistrationManager.cs @@ -15,10 +15,10 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager { public class EventRegistrationManager : MigratableModuleBase, IInstallable, IPortable, ISearchable { - private readonly IEventRegistrationRepository _EventRegistrationRepository; + private readonly IEventRepository _EventRegistrationRepository; private readonly IDBContextDependencies _DBContextDependencies; - public EventRegistrationManager(IEventRegistrationRepository EventRegistrationRepository, IDBContextDependencies DBContextDependencies) + public EventRegistrationManager(IEventRepository EventRegistrationRepository, IDBContextDependencies DBContextDependencies) { _EventRegistrationRepository = EventRegistrationRepository; _DBContextDependencies = DBContextDependencies; @@ -37,7 +37,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager public string ExportModule(Oqtane.Models.Module module) { string content = ""; - List EventRegistrations = _EventRegistrationRepository.GetEventRegistrations(module.ModuleId).ToList(); + List EventRegistrations = _EventRegistrationRepository.GetEvents(module.ModuleId).ToList(); if (EventRegistrations != null) { content = JsonSerializer.Serialize(EventRegistrations); @@ -56,7 +56,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager { foreach(var EventRegistration in EventRegistrations) { - _EventRegistrationRepository.AddEventRegistration(new Models.Event { ModuleId = module.ModuleId, Name = EventRegistration.Name }); + _EventRegistrationRepository.AddEvent(new Models.Event { ModuleId = module.ModuleId, Name = EventRegistration.Name }); } } } @@ -65,7 +65,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager { var searchContentList = new List(); - foreach (var EventRegistration in _EventRegistrationRepository.GetEventRegistrations(pageModule.ModuleId)) + foreach (var EventRegistration in _EventRegistrationRepository.GetEvents(pageModule.ModuleId)) { if (EventRegistration.ModifiedOn >= lastIndexedOn) { diff --git a/Server/Repository/EventRegistrationRepository.cs b/Server/Repository/EventRepository.cs similarity index 67% rename from Server/Repository/EventRegistrationRepository.cs rename to Server/Repository/EventRepository.cs index ac23c55..fc09db2 100644 --- a/Server/Repository/EventRegistrationRepository.cs +++ b/Server/Repository/EventRepository.cs @@ -5,27 +5,27 @@ using Oqtane.Modules; namespace SZUAbsolventenverein.Module.EventRegistration.Repository { - public class EventRegistrationRepository : IEventRegistrationRepository, ITransientService + public class EventRepository : IEventRepository, ITransientService { private readonly IDbContextFactory _factory; - public EventRegistrationRepository(IDbContextFactory factory) + public EventRepository(IDbContextFactory factory) { _factory = factory; } - public IEnumerable GetEventRegistrations(int ModuleId) + public IEnumerable GetEvents(int ModuleId) { using var db = _factory.CreateDbContext(); return db.Event.Where(item => item.ModuleId == ModuleId).ToList(); } - public Models.Event GetEventRegistration(int EventRegistrationId) + public Models.Event GetEvent(int EventRegistrationId) { - return GetEventRegistration(EventRegistrationId, true); + return GetEvent(EventRegistrationId, true); } - public Models.Event GetEventRegistration(int EventRegistrationId, bool tracking) + public Models.Event GetEvent(int EventRegistrationId, bool tracking) { using var db = _factory.CreateDbContext(); if (tracking) @@ -38,7 +38,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Repository } } - public Models.Event AddEventRegistration(Models.Event EventRegistration) + public Models.Event AddEvent(Models.Event EventRegistration) { using var db = _factory.CreateDbContext(); db.Event.Add(EventRegistration); @@ -46,7 +46,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Repository return EventRegistration; } - public Models.Event UpdateEventRegistration(Models.Event EventRegistration) + public Models.Event UpdateEvent(Models.Event EventRegistration) { using var db = _factory.CreateDbContext(); db.Entry(EventRegistration).State = EntityState.Modified; @@ -54,7 +54,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Repository return EventRegistration; } - public void DeleteEventRegistration(int EventRegistrationId) + public void DeleteEvent(int EventRegistrationId) { using var db = _factory.CreateDbContext(); Models.Event EventRegistration = db.Event.Find(EventRegistrationId); diff --git a/Server/Repository/IEventRegistrationRepository.cs b/Server/Repository/IEventRegistrationRepository.cs deleted file mode 100644 index c674d93..0000000 --- a/Server/Repository/IEventRegistrationRepository.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace SZUAbsolventenverein.Module.EventRegistration.Repository -{ - public interface IEventRegistrationRepository - { - IEnumerable GetEventRegistrations(int ModuleId); - Models.Event GetEventRegistration(int EventRegistrationId); - Models.Event GetEventRegistration(int EventRegistrationId, bool tracking); - Models.Event AddEventRegistration(Models.Event EventRegistration); - Models.Event UpdateEventRegistration(Models.Event EventRegistration); - void DeleteEventRegistration(int EventRegistrationId); - } -} diff --git a/Server/Repository/IEventRepository.cs b/Server/Repository/IEventRepository.cs new file mode 100644 index 0000000..8b383b7 --- /dev/null +++ b/Server/Repository/IEventRepository.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace SZUAbsolventenverein.Module.EventRegistration.Repository +{ + public interface IEventRepository + { + IEnumerable GetEvents(int ModuleId); + Models.Event GetEvent(int EventRegistrationId); + Models.Event GetEvent(int EventRegistrationId, bool tracking); + Models.Event AddEvent(Models.Event EventRegistration); + Models.Event UpdateEvent(Models.Event EventRegistration); + void DeleteEvent(int EventRegistrationId); + } +} diff --git a/Server/Services/EventRegistrationService.cs b/Server/Services/EventRegistrationService.cs index a7a964f..32ff250 100644 --- a/Server/Services/EventRegistrationService.cs +++ b/Server/Services/EventRegistrationService.cs @@ -14,13 +14,13 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services { public class ServerEventRegistrationService : IEventRegistrationService { - private readonly IEventRegistrationRepository _EventRegistrationRepository; + private readonly IEventRepository _EventRegistrationRepository; private readonly IUserPermissions _userPermissions; private readonly ILogManager _logger; private readonly IHttpContextAccessor _accessor; private readonly Alias _alias; - public ServerEventRegistrationService(IEventRegistrationRepository EventRegistrationRepository, IUserPermissions userPermissions, ITenantManager tenantManager, ILogManager logger, IHttpContextAccessor accessor) + public ServerEventRegistrationService(IEventRepository EventRegistrationRepository, IUserPermissions userPermissions, ITenantManager tenantManager, ILogManager logger, IHttpContextAccessor accessor) { _EventRegistrationRepository = EventRegistrationRepository; _userPermissions = userPermissions; From e45fce2e650c9d8af52131ad24122cc17f894a29 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Mon, 12 May 2025 11:53:39 +0200 Subject: [PATCH 05/34] NEW: IResponseRepository and finish renaming --- Server/Repository/IResponseRepository.cs | 15 +++++++++++++++ Server/Services/EventRegistrationService.cs | 8 ++++---- 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 Server/Repository/IResponseRepository.cs diff --git a/Server/Repository/IResponseRepository.cs b/Server/Repository/IResponseRepository.cs new file mode 100644 index 0000000..983f429 --- /dev/null +++ b/Server/Repository/IResponseRepository.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace SZUAbsolventenverein.Module.EventRegistration.Repository +{ + public interface IResponseRepository + { + IEnumerable GetResponses(int ModuleId); + Models.Response GetResponse(int EventRegistrationId); + Models.Response GetResponse(int EventRegistrationId, bool tracking); + Models.Response AddResponse(Models.Event EventRegistration); + Models.Response UpdateResponse(Models.Event EventRegistration); + void DeleteResponse(int EventRegistrationId); + } +} diff --git a/Server/Services/EventRegistrationService.cs b/Server/Services/EventRegistrationService.cs index 78730bf..7c5d3fe 100644 --- a/Server/Services/EventRegistrationService.cs +++ b/Server/Services/EventRegistrationService.cs @@ -33,7 +33,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services { if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, NewEvent.ModuleId, PermissionNames.Edit)) { - NewEvent = _EventRegistrationRepository.AddEventRegistration(NewEvent); + NewEvent = _EventRegistrationRepository.AddEvent(NewEvent); _logger.Log(LogLevel.Information, this, LogFunction.Create, "EventRegistration Added {NewEvent}", NewEvent); } else @@ -53,7 +53,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services { if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.Edit)) { - _EventRegistrationRepository.DeleteEventRegistration(EventId); + _EventRegistrationRepository.DeleteEvent(EventId); _logger.Log(LogLevel.Information, this, LogFunction.Delete, "EventRegistration Deleted {EventId}", EventId); } else @@ -77,7 +77,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services { if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View)) { - return Task.FromResult(_EventRegistrationRepository.GetEventRegistrations(ModuleId).ToList()); + return Task.FromResult(_EventRegistrationRepository.GetEvents(ModuleId).ToList()); } else { @@ -90,7 +90,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services { if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, NewEvent.ModuleId, PermissionNames.Edit)) { - NewEvent = _EventRegistrationRepository.UpdateEventRegistration(NewEvent); + NewEvent = _EventRegistrationRepository.UpdateEvent(NewEvent); _logger.Log(LogLevel.Information, this, LogFunction.Update, "EventRegistration Updated {NewEvent}", NewEvent); } else From 38c5bef225d868f394ff075496b8913592bd5743 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Wed, 14 May 2025 20:40:10 +0200 Subject: [PATCH 06/34] Bulk-Commit: Darft: Anmeldetool. Interface Definition: done Server-Side-Implementation: partly done (CR missing, potential Refactor, ...) Client-Side-Implementation: started: (UI: done, Service: started, but works with SSR) Missing: Permissions / Roles to restrict access to an event. Missing: Fields on Event. Missing: Good Styling Time-Took: about 12 Hours. Learning: Commit in smaller packets, rest will be discussed at CR --- .../Details.razor | 102 +++++++++++--- .../Edit.razor | 8 +- .../Index.razor | 14 +- .../Details.resx | 132 ++++++++++++++++++ Client/Services/EventRegistrationService.cs | 48 ++++++- .../EventRegistrationController.cs | 36 ++++- Server/Manager/EventRegistrationManager.cs | 18 ++- .../Migrations/01000000_InitializeModule.cs | 4 +- ...EntityBuilder.cs => EventEntityBuilder.cs} | 14 +- .../EventResponseEntityBuilder.cs | 2 +- Server/Repository/EventRepository.cs | 2 +- Server/Repository/IResponseRepository.cs | 16 ++- Server/Repository/ResponseRepository.cs | 89 ++++++++++++ Server/Services/EventRegistrationService.cs | 96 +++++++++++-- .../Interfaces/IEventRegistrationService.cs | 16 ++- Shared/Models/Event.cs | 2 +- Shared/Models/Response.cs | 1 - 17 files changed, 508 insertions(+), 92 deletions(-) create mode 100644 Client/Resources/SZUAbsolventenverein.Module.EventRegistration/Details.resx rename Server/Migrations/EntityBuilders/{EventRegistrationEntityBuilder.cs => EventEntityBuilder.cs} (52%) create mode 100644 Server/Repository/ResponseRepository.cs diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor index 5d4064e..eda60dc 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor @@ -8,22 +8,38 @@ @inject NavigationManager NavigationManager @inject IStringLocalizer Localizer -
-
- -
- -
- +

Anmeldung zum Event

+ +

Willst du am Event (@_name) teilnehmen?

+ +@if (PageState.User != null) { + + @if (Status != null) + { +

Status: + @if (Status == true) + { + @Localizer["Zusage"] + + } else + { + @Localizer["Absage"] + + } +

+ } else { +
+ +
-
- - @Localizer["Cancel"] -

- + } +} else +{ +

Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.

+} @code { - public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit; + public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.View; public override string Actions => "Details"; @@ -44,19 +60,59 @@ private string _modifiedby; private DateTime _modifiedon; + private Response _response; + private bool? Status; + + private async Task SendResponse(bool response) + { + if(_response == null) + { + _response = new Response(); + _response.EventRegistrationId = _id; + _response.OwnerId = PageState.User.UserId; + _response.ModuleId = ModuleState.ModuleId; + _response.ResponseType = response; + _response = await EventRegistrationService.AddResponseAsync(_response); + } else + { + _response.ResponseType = response; + _response = await EventRegistrationService.UpdateResponseAsync(_response); + } + if(_response != null) Status = _response.ResponseType; + } + + private async void Zusage() + { + await SendResponse(true); + } + + private async void Absage() + { + await SendResponse(false); + } + protected override async Task OnInitializedAsync() { try { _id = Int32.Parse(PageState.QueryString["id"]); - Event EventRegistration = await EventRegistrationService.GetEventRegistrationAsync(_id, ModuleState.ModuleId); - if (EventRegistration != null) + + Event currentEvent; + Response rsvp; + (currentEvent, rsvp) = await EventRegistrationService.GetEventDetails(_id, ModuleState.ModuleId); + if (currentEvent != null) { - _name = EventRegistration.Name; - _createdby = EventRegistration.CreatedBy; - _createdon = EventRegistration.CreatedOn; - _modifiedby = EventRegistration.ModifiedBy; - _modifiedon = EventRegistration.ModifiedOn; + _name = currentEvent.Name; + _createdby = currentEvent.CreatedBy; + _createdon = currentEvent.CreatedOn; + _modifiedby = currentEvent.ModifiedBy; + _modifiedon = currentEvent.ModifiedOn; + } + + if(rsvp != null) + { + _response = rsvp; + Status = rsvp.ResponseType; } } catch (Exception ex) @@ -79,14 +135,14 @@ Event EventRegistration = new Event(); EventRegistration.ModuleId = ModuleState.ModuleId; EventRegistration.Name = _name; - EventRegistration = await EventRegistrationService.AddEventRegistrationAsync(EventRegistration); + EventRegistration = await EventRegistrationService.AddEventAsync(EventRegistration); await logger.LogInformation("EventRegistration Added {EventRegistration}", EventRegistration); } else { - Event EventRegistration = await EventRegistrationService.GetEventRegistrationAsync(_id, ModuleState.ModuleId); + Event EventRegistration = await EventRegistrationService.GetEventAsync(_id, ModuleState.ModuleId); EventRegistration.Name = _name; - await EventRegistrationService.UpdateEventRegistrationAsync(EventRegistration); + await EventRegistrationService.UpdateEventAsync(EventRegistration); await logger.LogInformation("EventRegistration Updated {EventRegistration}", EventRegistration); } NavigationManager.NavigateTo(NavigateUrl()); diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor index 706958f..63723c4 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor @@ -55,7 +55,7 @@ if (PageState.Action == "Edit") { _id = Int32.Parse(PageState.QueryString["id"]); - Event EventRegistration = await EventRegistrationService.GetEventRegistrationAsync(_id, ModuleState.ModuleId); + Event EventRegistration = await EventRegistrationService.GetEventAsync(_id, ModuleState.ModuleId); if (EventRegistration != null) { _name = EventRegistration.Name; @@ -86,14 +86,14 @@ Event EventRegistration = new Event(); EventRegistration.ModuleId = ModuleState.ModuleId; EventRegistration.Name = _name; - EventRegistration = await EventRegistrationService.AddEventRegistrationAsync(EventRegistration); + EventRegistration = await EventRegistrationService.AddEventAsync(EventRegistration); await logger.LogInformation("EventRegistration Added {EventRegistration}", EventRegistration); } else { - Event EventRegistration = await EventRegistrationService.GetEventRegistrationAsync(_id, ModuleState.ModuleId); + Event EventRegistration = await EventRegistrationService.GetEventAsync(_id, ModuleState.ModuleId); EventRegistration.Name = _name; - await EventRegistrationService.UpdateEventRegistrationAsync(EventRegistration); + await EventRegistrationService.UpdateEventAsync(EventRegistration); await logger.LogInformation("EventRegistration Updated {EventRegistration}", EventRegistration); } NavigationManager.NavigateTo(NavigateUrl()); diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor index 7fc0df4..c4034a7 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor @@ -27,13 +27,11 @@ else   - - + + @context.Name - @* @if(UserSecurity.IsAuthorized(PageState.User, PermissionNames.Utilize)) { *@ - - @* } *@ + } @@ -58,7 +56,7 @@ else { try { - _EventRegistrations = await EventRegistrationService.GetEventRegistrationsAsync(ModuleState.ModuleId); + _EventRegistrations = await EventRegistrationService.GetEventsAsync(ModuleState.ModuleId); } catch (Exception ex) { @@ -71,9 +69,9 @@ else { try { - await EventRegistrationService.DeleteEventRegistrationAsync(EventRegistration.EventRegistrationId, ModuleState.ModuleId); + await EventRegistrationService.DeleteEventAsync(EventRegistration.EventId, ModuleState.ModuleId); await logger.LogInformation("EventRegistration Deleted {EventRegistration}", EventRegistration); - _EventRegistrations = await EventRegistrationService.GetEventRegistrationsAsync(ModuleState.ModuleId); + _EventRegistrations = await EventRegistrationService.GetEventsAsync(ModuleState.ModuleId); StateHasChanged(); } catch (Exception ex) diff --git a/Client/Resources/SZUAbsolventenverein.Module.EventRegistration/Details.resx b/Client/Resources/SZUAbsolventenverein.Module.EventRegistration/Details.resx new file mode 100644 index 0000000..a998b24 --- /dev/null +++ b/Client/Resources/SZUAbsolventenverein.Module.EventRegistration/Details.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Du hast abgesagt. Schade, vielleicht nächstes Mal! + + + Absagen + + + Du hast zugesagt. Wir freuen uns auf dich! + + + Zusagen + + \ No newline at end of file diff --git a/Client/Services/EventRegistrationService.cs b/Client/Services/EventRegistrationService.cs index 899fd0d..6e45618 100644 --- a/Client/Services/EventRegistrationService.cs +++ b/Client/Services/EventRegistrationService.cs @@ -2,8 +2,10 @@ using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; using Oqtane.Services; using Oqtane.Shared; +using SZUAbsolventenverein.Module.EventRegistration.Models; namespace SZUAbsolventenverein.Module.EventRegistration.Services { @@ -13,7 +15,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services private string Apiurl => CreateApiUrl("EventRegistration"); - public async Task> GetEventRegistrationsAsync(int ModuleId) + /*public async Task> GetEventRegistrationsAsync(int ModuleId) { List EventRegistrations = await GetJsonAsync>(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", EntityNames.Module, ModuleId), Enumerable.Empty().ToList()); return EventRegistrations.OrderBy(item => item.Name).ToList(); @@ -32,11 +34,51 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services public async Task UpdateEventRegistrationAsync(Models.Event EventRegistration) { return await PutJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventRegistration.EventRegistrationId}", EntityNames.Module, EventRegistration.ModuleId), EventRegistration); + }*/ + + public async Task> GetEventsAsync(int ModuleId) + { + List EventRegistrations = await GetJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", EntityNames.Module, ModuleId), Enumerable.Empty().ToList()); + return EventRegistrations.OrderBy(item => item.Name).ToList(); + } + public async Task GetEventAsync(int EventId, int ModuleId) + { + return await GetJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventId}/{ModuleId}", EntityNames.Module, ModuleId)); } - public async Task DeleteEventRegistrationAsync(int EventRegistrationId, int ModuleId) + public async Task AddEventAsync(Event NewEvent) { - await DeleteAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventRegistrationId}/{ModuleId}", EntityNames.Module, ModuleId)); + return await PostJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}", EntityNames.Module, NewEvent.ModuleId), NewEvent); + } + + public async Task UpdateEventAsync(Event NewEvent) + { + return await PutJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{NewEvent.EventId}", EntityNames.Module, NewEvent.ModuleId), NewEvent); + } + + public async Task DeleteEventAsync(int EventId, int ModuleId) + { + await DeleteAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventId}/{ModuleId}", EntityNames.Module, ModuleId)); + } + + public async Task AddResponseAsync(Response response) + { + return await PostJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/response/{response.EventRegistrationId}/{response.ModuleId}", EntityNames.Module, response.ModuleId), response); + } + + public async Task UpdateResponseAsync(Response response) + { + return await PutJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/response/{response.EventRegistrationId}/{response.ModuleId}", EntityNames.Module, response.ModuleId), response); + } + + public async Task<(Event, Response)> GetEventDetails(int EventId, int ModuleId) + { + return await GetJsonAsync<(Event, Response)>(CreateAuthorizationPolicyUrl($"{Apiurl}/details/{EventId}/{ModuleId}", EntityNames.Module, ModuleId)); + } + + public Task> GetEventResponses(int EventId, int ModuleId) + { + throw new System.NotImplementedException(); } } } diff --git a/Server/Controllers/EventRegistrationController.cs b/Server/Controllers/EventRegistrationController.cs index 7fe00e6..c8fb682 100644 --- a/Server/Controllers/EventRegistrationController.cs +++ b/Server/Controllers/EventRegistrationController.cs @@ -30,7 +30,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Controllers int ModuleId; if (int.TryParse(moduleid, out ModuleId) && IsAuthorizedEntityId(EntityNames.Module, ModuleId)) { - return await _EventRegistrationService.GetEventRegistrationsAsync(ModuleId); + return await _EventRegistrationService.GetEventsAsync(ModuleId); } else { @@ -45,7 +45,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Controllers [Authorize(Policy = PolicyNames.ViewModule)] public async Task Get(int id, int moduleid) { - Models.Event EventRegistration = await _EventRegistrationService.GetEventRegistrationAsync(id, moduleid); + Models.Event EventRegistration = await _EventRegistrationService.GetEventAsync(id, moduleid); if (EventRegistration != null && IsAuthorizedEntityId(EntityNames.Module, EventRegistration.ModuleId)) { return EventRegistration; @@ -65,7 +65,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Controllers { if (ModelState.IsValid && IsAuthorizedEntityId(EntityNames.Module, EventRegistration.ModuleId)) { - EventRegistration = await _EventRegistrationService.AddEventRegistrationAsync(EventRegistration); + EventRegistration = await _EventRegistrationService.AddEventAsync(EventRegistration); } else { @@ -81,9 +81,9 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Controllers [Authorize(Policy = PolicyNames.EditModule)] public async Task Put(int id, [FromBody] Models.Event EventRegistration) { - if (ModelState.IsValid && EventRegistration.EventRegistrationId == id && IsAuthorizedEntityId(EntityNames.Module, EventRegistration.ModuleId)) + if (ModelState.IsValid && EventRegistration.EventId == id && IsAuthorizedEntityId(EntityNames.Module, EventRegistration.ModuleId)) { - EventRegistration = await _EventRegistrationService.UpdateEventRegistrationAsync(EventRegistration); + EventRegistration = await _EventRegistrationService.UpdateEventAsync(EventRegistration); } else { @@ -99,10 +99,10 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Controllers [Authorize(Policy = PolicyNames.EditModule)] public async Task Delete(int id, int moduleid) { - Models.Event EventRegistration = await _EventRegistrationService.GetEventRegistrationAsync(id, moduleid); + Models.Event EventRegistration = await _EventRegistrationService.GetEventAsync(id, moduleid); if (EventRegistration != null && IsAuthorizedEntityId(EntityNames.Module, EventRegistration.ModuleId)) { - await _EventRegistrationService.DeleteEventRegistrationAsync(id, EventRegistration.ModuleId); + await _EventRegistrationService.DeleteEventAsync(id, EventRegistration.ModuleId); } else { @@ -110,5 +110,27 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Controllers HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden; } } + + // GET api//5 + [HttpGet("details/{id}/{moduleid}")] + [Authorize(Policy = PolicyNames.ViewModule)] + public async Task<(Models.Event, Models.Response)> GetDetails(int id, int moduleid) + { + Models.Event EventRegistration; + Models.Response EventResponse; + (EventRegistration, EventResponse) = await _EventRegistrationService.GetEventDetails(id, moduleid); + if (EventRegistration != null && EventResponse != null && IsAuthorizedEntityId(EntityNames.Module, EventRegistration.ModuleId)) + { + return (EventRegistration, EventResponse); + } + else + { + _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Get Attempt {EventRegistrationId} {ModuleId}", id, moduleid); + HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden; + return (null, null); + } + } + + // TODO: Add Event Response Endpoints. } } diff --git a/Server/Manager/EventRegistrationManager.cs b/Server/Manager/EventRegistrationManager.cs index 049eae5..3505f97 100644 --- a/Server/Manager/EventRegistrationManager.cs +++ b/Server/Manager/EventRegistrationManager.cs @@ -15,12 +15,14 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager { public class EventRegistrationManager : MigratableModuleBase, IInstallable, IPortable, ISearchable { - private readonly IEventRepository _EventRegistrationRepository; + private readonly IEventRepository _EventRepository; + private readonly IResponseRepository _ResponseRepository; private readonly IDBContextDependencies _DBContextDependencies; - public EventRegistrationManager(IEventRepository EventRegistrationRepository, IDBContextDependencies DBContextDependencies) + public EventRegistrationManager(IEventRepository EventRegistrationRepository, IResponseRepository ResponseRepository, IDBContextDependencies DBContextDependencies) { - _EventRegistrationRepository = EventRegistrationRepository; + _EventRepository = EventRegistrationRepository; + _ResponseRepository = ResponseRepository; _DBContextDependencies = DBContextDependencies; } @@ -36,8 +38,9 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager public string ExportModule(Oqtane.Models.Module module) { + // TODO: Export event Responses as well. string content = ""; - List EventRegistrations = _EventRegistrationRepository.GetEvents(module.ModuleId).ToList(); + List EventRegistrations = _EventRepository.GetEvents(module.ModuleId).ToList(); if (EventRegistrations != null) { content = JsonSerializer.Serialize(EventRegistrations); @@ -47,6 +50,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager public void ImportModule(Oqtane.Models.Module module, string content, string version) { + // TODO: Import event Responses as well. List EventRegistrations = null; if (!string.IsNullOrEmpty(content)) { @@ -56,7 +60,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager { foreach(var EventRegistration in EventRegistrations) { - _EventRegistrationRepository.AddEvent(new Models.Event { ModuleId = module.ModuleId, Name = EventRegistration.Name }); + _EventRepository.AddEvent(new Models.Event { ModuleId = module.ModuleId, Name = EventRegistration.Name }); } } } @@ -65,14 +69,14 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager { var searchContentList = new List(); - foreach (var EventRegistration in _EventRegistrationRepository.GetEvents(pageModule.ModuleId)) + foreach (var EventRegistration in _EventRepository.GetEvents(pageModule.ModuleId)) { if (EventRegistration.ModifiedOn >= lastIndexedOn) { searchContentList.Add(new SearchContent { EntityName = "SZUAbsolventenvereinEventRegistration", - EntityId = EventRegistration.EventRegistrationId.ToString(), + EntityId = EventRegistration.EventId.ToString(), Title = EventRegistration.Name, Body = EventRegistration.Name, ContentModifiedBy = EventRegistration.ModifiedBy, diff --git a/Server/Migrations/01000000_InitializeModule.cs b/Server/Migrations/01000000_InitializeModule.cs index 83ff7b7..68c9401 100644 --- a/Server/Migrations/01000000_InitializeModule.cs +++ b/Server/Migrations/01000000_InitializeModule.cs @@ -17,7 +17,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Migrations protected override void Up(MigrationBuilder migrationBuilder) { - var entityBuilder = new EventRegistrationEntityBuilder(migrationBuilder, ActiveDatabase); + var entityBuilder = new EventEntityBuilder(migrationBuilder, ActiveDatabase); entityBuilder.Create(); var entityBuilder2 = new EventResponseEntityBuilder(migrationBuilder, ActiveDatabase); @@ -26,7 +26,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Migrations protected override void Down(MigrationBuilder migrationBuilder) { - var entityBuilder = new EventRegistrationEntityBuilder(migrationBuilder, ActiveDatabase); + var entityBuilder = new EventEntityBuilder(migrationBuilder, ActiveDatabase); entityBuilder.Drop(); var entityBuilder2 = new EventResponseEntityBuilder(migrationBuilder, ActiveDatabase); entityBuilder2.Drop(); diff --git a/Server/Migrations/EntityBuilders/EventRegistrationEntityBuilder.cs b/Server/Migrations/EntityBuilders/EventEntityBuilder.cs similarity index 52% rename from Server/Migrations/EntityBuilders/EventRegistrationEntityBuilder.cs rename to Server/Migrations/EntityBuilders/EventEntityBuilder.cs index c6f4f2f..54e4deb 100644 --- a/Server/Migrations/EntityBuilders/EventRegistrationEntityBuilder.cs +++ b/Server/Migrations/EntityBuilders/EventEntityBuilder.cs @@ -7,29 +7,29 @@ using Oqtane.Migrations.EntityBuilders; namespace SZUAbsolventenverein.Module.EventRegistration.Migrations.EntityBuilders { - public class EventRegistrationEntityBuilder : AuditableBaseEntityBuilder + public class EventEntityBuilder : AuditableBaseEntityBuilder { private const string _entityTableName = "SZUAbsolventenvereinEvent"; - private readonly PrimaryKey _primaryKey = new("PK_SZUAbsolventenvereinEvent", x => x.EventRegistrationId); - private readonly ForeignKey _moduleForeignKey = new("FK_SZUAbsolventenvereinEvent_Module", x => x.ModuleId, "Module", "ModuleId", ReferentialAction.Cascade); + private readonly PrimaryKey _primaryKey = new("PK_SZUAbsolventenvereinEvent", x => x.EventId); + private readonly ForeignKey _moduleForeignKey = new("FK_SZUAbsolventenvereinEvent_Module", x => x.ModuleId, "Module", "ModuleId", ReferentialAction.Cascade); - public EventRegistrationEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database) + public EventEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database) { EntityTableName = _entityTableName; PrimaryKey = _primaryKey; ForeignKeys.Add(_moduleForeignKey); } - protected override EventRegistrationEntityBuilder BuildTable(ColumnsBuilder table) + protected override EventEntityBuilder BuildTable(ColumnsBuilder table) { - EventRegistrationId = AddAutoIncrementColumn(table,"EventRegistrationId"); + EventId = AddAutoIncrementColumn(table,"EventId"); ModuleId = AddIntegerColumn(table,"ModuleId"); Name = AddMaxStringColumn(table,"Name"); AddAuditableColumns(table); return this; } - public OperationBuilder EventRegistrationId { get; set; } + public OperationBuilder EventId { get; set; } public OperationBuilder ModuleId { get; set; } public OperationBuilder Name { get; set; } } diff --git a/Server/Migrations/EntityBuilders/EventResponseEntityBuilder.cs b/Server/Migrations/EntityBuilders/EventResponseEntityBuilder.cs index 9d26e53..91f52a5 100644 --- a/Server/Migrations/EntityBuilders/EventResponseEntityBuilder.cs +++ b/Server/Migrations/EntityBuilders/EventResponseEntityBuilder.cs @@ -13,7 +13,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Migrations.EntityBuilder private const string _entityTableName = "SZUAbsolventenvereinEventResponse"; private readonly PrimaryKey _primaryKey = new("PK_SZUAbsolventenvereinEventResponse", x => x.EventResponseId); private readonly ForeignKey _moduleForeignKey = new("FK_SZUAbsolventenvereinEventResponse_Module", x => x.ModuleId, "Module", "ModuleId", ReferentialAction.Cascade); - private readonly ForeignKey _eventForeignKey = new("FK_SZUAbsolventenvereinEventResponse_Event", x => x.EventRegistrationId, "SZUAbsolventenvereinEvent", "EventRegistrationId", ReferentialAction.Cascade); + private readonly ForeignKey _eventForeignKey = new("FK_SZUAbsolventenvereinEventResponse_Event", x => x.EventRegistrationId, "SZUAbsolventenvereinEvent", "EventId", ReferentialAction.Cascade); private readonly ForeignKey _ownerForeignKey = new("FK_SZUAbsolventenvereinEventResponse_User_Owner", x => x.OwnerId, "User", "UserId", ReferentialAction.Cascade); public EventResponseEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database) diff --git a/Server/Repository/EventRepository.cs b/Server/Repository/EventRepository.cs index fc09db2..e6a5510 100644 --- a/Server/Repository/EventRepository.cs +++ b/Server/Repository/EventRepository.cs @@ -34,7 +34,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Repository } else { - return db.Event.AsNoTracking().FirstOrDefault(item => item.EventRegistrationId == EventRegistrationId); + return db.Event.AsNoTracking().FirstOrDefault(item => item.EventId == EventRegistrationId); } } diff --git a/Server/Repository/IResponseRepository.cs b/Server/Repository/IResponseRepository.cs index 983f429..0a51e72 100644 --- a/Server/Repository/IResponseRepository.cs +++ b/Server/Repository/IResponseRepository.cs @@ -1,15 +1,19 @@ using System.Collections.Generic; using System.Threading.Tasks; +using SZUAbsolventenverein.Module.EventRegistration.Models; namespace SZUAbsolventenverein.Module.EventRegistration.Repository { public interface IResponseRepository { - IEnumerable GetResponses(int ModuleId); - Models.Response GetResponse(int EventRegistrationId); - Models.Response GetResponse(int EventRegistrationId, bool tracking); - Models.Response AddResponse(Models.Event EventRegistration); - Models.Response UpdateResponse(Models.Event EventRegistration); - void DeleteResponse(int EventRegistrationId); + IEnumerable GetResponses(int ModuleId); + IEnumerable GetResponses(int EventId, int ModuleId); + Response GetResponse(int EventRegistrationId); + Response GetResponse(int EventRegistrationId, bool tracking); + Response GetResponse(int EventId, int OwnerId); + Response GetResponse(int EventId, int OwnerId, bool tracking); + Response AddResponse(Response EventResponse); + Response UpdateResponse(Response EventResponse); + void DeleteResponse(int EventResponseId); } } diff --git a/Server/Repository/ResponseRepository.cs b/Server/Repository/ResponseRepository.cs new file mode 100644 index 0000000..5facecf --- /dev/null +++ b/Server/Repository/ResponseRepository.cs @@ -0,0 +1,89 @@ +using Microsoft.EntityFrameworkCore; +using System.Linq; +using System.Collections.Generic; +using Oqtane.Modules; +using SZUAbsolventenverein.Module.EventRegistration.Models; + +namespace SZUAbsolventenverein.Module.EventRegistration.Repository +{ + public class ResponseRepository : IResponseRepository, ITransientService + { + private readonly IDbContextFactory _factory; + + public ResponseRepository(IDbContextFactory factory) + { + _factory = factory; + } + public IEnumerable GetResponses(int ModuleId) + { + using var db = _factory.CreateDbContext(); + return db.Response.Where(item => item.ModuleId == ModuleId).ToList(); + } + + public IEnumerable GetResponses(int EventId, int ModuleId) + { + using var db = _factory.CreateDbContext(); + return db.Response.Where(item => item.ModuleId == ModuleId && item.EventRegistrationId == EventId).ToList(); + } + + public Response GetResponse(int EventRegistrationId) + { + return GetResponse(EventRegistrationId, true); + } + + public Response GetResponse(int EventRegistrationId, bool tracking) + { + using var db = _factory.CreateDbContext(); + if (tracking) + { + return db.Response.Find(EventRegistrationId); + } + else + { + return db.Response.AsNoTracking().FirstOrDefault(item => item.EventRegistrationId == EventRegistrationId); + } + } + + public Response GetResponse(int EventId, int OwnerId) + { + return GetResponse(EventId, OwnerId, true); + } + + public Response GetResponse(int EventId, int OwnerId, bool tracking) + { + using var db = _factory.CreateDbContext(); + if (tracking) + { + return db.Response.FirstOrDefault(item => item.EventRegistrationId == EventId && item.OwnerId == OwnerId); + } + else + { + return db.Response.AsNoTracking().FirstOrDefault(item => item.EventRegistrationId == EventId && item.OwnerId == OwnerId); + } + } + + public Response AddResponse(Response EventResponse) + { + using var db = _factory.CreateDbContext(); + db.Response.Add(EventResponse); + db.SaveChanges(); + return EventResponse; + } + + public Response UpdateResponse(Response EventResponse) + { + using var db = _factory.CreateDbContext(); + db.Entry(EventResponse).State = EntityState.Modified; + db.SaveChanges(); + return EventResponse; + } + + public void DeleteResponse(int EventRegistrationId) + { + using var db = _factory.CreateDbContext(); + Response EventResponse = db.Response.Find(EventRegistrationId); + db.Response.Remove(EventResponse); + db.SaveChanges(); + } + } +} diff --git a/Server/Services/EventRegistrationService.cs b/Server/Services/EventRegistrationService.cs index 7c5d3fe..54c9934 100644 --- a/Server/Services/EventRegistrationService.cs +++ b/Server/Services/EventRegistrationService.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Oqtane.Enums; +using Oqtane.Extensions; using Oqtane.Infrastructure; using Oqtane.Models; using Oqtane.Security; @@ -14,15 +15,17 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services { public class ServerEventRegistrationService : IEventRegistrationService { - private readonly IEventRepository _EventRegistrationRepository; + private readonly IEventRepository _EventRepository; + private readonly IResponseRepository _ResponseRepository; private readonly IUserPermissions _userPermissions; private readonly ILogManager _logger; private readonly IHttpContextAccessor _accessor; private readonly Alias _alias; - public ServerEventRegistrationService(IEventRepository EventRegistrationRepository, IUserPermissions userPermissions, ITenantManager tenantManager, ILogManager logger, IHttpContextAccessor accessor) + public ServerEventRegistrationService(IEventRepository EventRepository, IResponseRepository ResponseRepository, IUserPermissions userPermissions, ITenantManager tenantManager, ILogManager logger, IHttpContextAccessor accessor) { - _EventRegistrationRepository = EventRegistrationRepository; + _EventRepository = EventRepository; + _ResponseRepository = ResponseRepository; _userPermissions = userPermissions; _logger = logger; _accessor = accessor; @@ -33,7 +36,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services { if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, NewEvent.ModuleId, PermissionNames.Edit)) { - NewEvent = _EventRegistrationRepository.AddEvent(NewEvent); + NewEvent = _EventRepository.AddEvent(NewEvent); _logger.Log(LogLevel.Information, this, LogFunction.Create, "EventRegistration Added {NewEvent}", NewEvent); } else @@ -44,32 +47,90 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services return Task.FromResult(NewEvent); } - public Task AddOrUpdateResponseAsync(int EventId, int ModuleId, bool ResponseType) + public Task AddResponseAsync(Response Response) { - throw new System.NotImplementedException(); + if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, Response.ModuleId, PermissionNames.View)) + { + Response = _ResponseRepository.AddResponse(Response); + _logger.Log(LogLevel.Information, this, LogFunction.Create, "EventRegistration Added {NewEvent}", Response); + } + else + { + _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Add Attempt {NewEvent}", Response); + Response = null; + } + return Task.FromResult(Response); + } + + public Task UpdateResponseAsync(Response Response) + { + + if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, Response.ModuleId, PermissionNames.View)) + { + Response = _ResponseRepository.UpdateResponse(Response); + _logger.Log(LogLevel.Information, this, LogFunction.Create, "EventRegistration Added {NewEvent}", Response); + } + else + { + _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Add Attempt {NewEvent}", Response); + Response = null; + } + return Task.FromResult(Response); } public Task DeleteEventAsync(int EventId, int ModuleId) { if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.Edit)) { - _EventRegistrationRepository.DeleteEvent(EventId); - _logger.Log(LogLevel.Information, this, LogFunction.Delete, "EventRegistration Deleted {EventId}", EventId); + _EventRepository.DeleteEvent(EventId); + _logger.Log(LogLevel.Information, this, LogFunction.Delete, "Event Deleted {EventId}", EventId); } else { - _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Delete Attempt {EventId} {ModuleId}", EventId, ModuleId); + _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Event Delete Attempt {EventId} {ModuleId}", EventId, ModuleId); } return Task.CompletedTask; } + public Task GetEventAsync(int EventId, int ModuleId) + { + if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View)) + { + return Task.FromResult(_EventRepository.GetEvent(EventId, true)); + } + else + { + _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Event Get Attempt {ModuleId}", ModuleId); + return null; + } + } + public Task<(Event, Response)> GetEventDetails(int EventId, int ModuleId) { - throw new System.NotImplementedException(); + if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View)) + { + Event currentEvent = _EventRepository.GetEvent(EventId); + Response rsvp = _ResponseRepository.GetResponse(EventId, _accessor.HttpContext.User.UserId()); + return Task.FromResult((currentEvent, rsvp)); + } + else + { + _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Event Get Attempt {ModuleId}", ModuleId); + return null; + } } public Task> GetEventResponses(int EventId, int ModuleId) { + if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.Edit)) + { + return Task.FromResult(_ResponseRepository.GetResponses(EventId, ModuleId).ToList()); + } + else + { + _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Event Response Get Attempt {ModuleId}", ModuleId); + return null; + } throw new System.NotImplementedException(); } @@ -77,11 +138,11 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services { if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View)) { - return Task.FromResult(_EventRegistrationRepository.GetEvents(ModuleId).ToList()); + return Task.FromResult(_EventRepository.GetEvents(ModuleId).ToList()); } else { - _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Get Attempt {ModuleId}", ModuleId); + _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Events Get Attempt {ModuleId}", ModuleId); return null; } } @@ -90,17 +151,19 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services { if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, NewEvent.ModuleId, PermissionNames.Edit)) { - NewEvent = _EventRegistrationRepository.UpdateEvent(NewEvent); - _logger.Log(LogLevel.Information, this, LogFunction.Update, "EventRegistration Updated {NewEvent}", NewEvent); + NewEvent = _EventRepository.UpdateEvent(NewEvent); + _logger.Log(LogLevel.Information, this, LogFunction.Update, "Event Updated {NewEvent}", NewEvent); } else { - _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Update Attempt {NewEvent}", NewEvent); + _logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Event Update Attempt {NewEvent}", NewEvent); NewEvent = null; } return Task.FromResult(NewEvent); } + // TODO: Implement the methods for EventResponses + /* public Task GetEventRegistrationAsync(int EventRegistrationId, int ModuleId) @@ -147,5 +210,8 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services } }*/ + + + } } diff --git a/Shared/Interfaces/IEventRegistrationService.cs b/Shared/Interfaces/IEventRegistrationService.cs index 769409f..864b30f 100644 --- a/Shared/Interfaces/IEventRegistrationService.cs +++ b/Shared/Interfaces/IEventRegistrationService.cs @@ -1,26 +1,30 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using SZUAbsolventenverein.Module.EventRegistration.Models; namespace SZUAbsolventenverein.Module.EventRegistration.Services { public interface IEventRegistrationService { /* Reine Events */ - Task> GetEventsAsync(int ModuleId); + Task> GetEventsAsync(int ModuleId); + Task GetEventAsync(int EventId, int ModuleId); - Task AddEventAsync(Models.Event NewEvent); + Task AddEventAsync(Event NewEvent); - Task UpdateEventAsync(Models.Event NewEvent); + Task UpdateEventAsync(Event NewEvent); Task DeleteEventAsync(int EventId, int ModuleId); /* Events & Responses */ - Task AddOrUpdateResponseAsync(int EventId, int ModuleId, bool ResponseType); + Task AddResponseAsync(Response Response); + + Task UpdateResponseAsync(Response Response); - Task<(Models.Event, Models.Response)> GetEventDetails(int EventId, int ModuleId); + Task<(Event, Response)> GetEventDetails(int EventId, int ModuleId); - Task> GetEventResponses(int EventId, int ModuleId); + Task> GetEventResponses(int EventId, int ModuleId); } } diff --git a/Shared/Models/Event.cs b/Shared/Models/Event.cs index 200cf42..ea5aae5 100644 --- a/Shared/Models/Event.cs +++ b/Shared/Models/Event.cs @@ -9,7 +9,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Models public class Event : IAuditable { [Key] - public int EventRegistrationId { get; set; } + public int EventId { get; set; } public int ModuleId { get; set; } public string Name { get; set; } diff --git a/Shared/Models/Response.cs b/Shared/Models/Response.cs index d75814f..01c84d7 100644 --- a/Shared/Models/Response.cs +++ b/Shared/Models/Response.cs @@ -14,7 +14,6 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Models public int OwnerId { get; set; } public int EventRegistrationId { get; set; } public int ModuleId { get; set; } - public string Name { get; set; } public string CreatedBy { get; set; } public DateTime CreatedOn { get; set; } From 287b932444a63dd87b93167dd3874629aed38f93 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Fri, 30 May 2025 08:35:06 +0200 Subject: [PATCH 07/34] Event: Add Description, Date and Location Column. Changed: 01000005_AddDescriptionDateTimeLocation.cs Co-Author: Florian Edlmayer --- ...01000005_AddDescriptionDateTimeLocation.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Server/Migrations/01000005_AddDescriptionDateTimeLocation.cs diff --git a/Server/Migrations/01000005_AddDescriptionDateTimeLocation.cs b/Server/Migrations/01000005_AddDescriptionDateTimeLocation.cs new file mode 100644 index 0000000..b79f601 --- /dev/null +++ b/Server/Migrations/01000005_AddDescriptionDateTimeLocation.cs @@ -0,0 +1,27 @@ +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Oqtane.Databases.Interfaces; +using Oqtane.Migrations; +using System; +using SZUAbsolventenverein.Module.EventRegistration.Migrations.EntityBuilders; +using SZUAbsolventenverein.Module.EventRegistration.Repository; + +namespace SZUAbsolventenverein.Module.EventRegistration.Migrations +{ + [DbContext(typeof(EventRegistrationContext))] + [Migration("SZUAbsolventenverein.Module.EventRegistration.01.00.00.05")] + public class AddDescriptionDateTimeLocation : MultiDatabaseMigration + { + public AddDescriptionDateTimeLocation(IDatabase database) : base(database) + { + } + + protected override void Up(MigrationBuilder migrationBuilder) + { + var entityBuilder = new EventEntityBuilder(migrationBuilder, ActiveDatabase); + entityBuilder.AddMaxStringColumn("Description", false, true, ""); // Contents for RichTextEditor + entityBuilder.AddDateTimeColumn("EventDate", false, new DateTime()); // DateTime for the event + entityBuilder.AddStringColumn("Location", 100, false, true, ""); // Location of the event + } + } +} From 527f9aadc617b0ba94ad8dd3145f8f77b57516a7 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Fri, 30 May 2025 09:38:09 +0200 Subject: [PATCH 08/34] EventRegistrationService: Add Notifications on subscribe/unsubscribe. Changed: EventRegistrationService.cs Co-Author: Florian Edlmayer --- Server/Services/EventRegistrationService.cs | 26 ++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/Server/Services/EventRegistrationService.cs b/Server/Services/EventRegistrationService.cs index 54c9934..8f1112e 100644 --- a/Server/Services/EventRegistrationService.cs +++ b/Server/Services/EventRegistrationService.cs @@ -17,15 +17,19 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services { private readonly IEventRepository _EventRepository; private readonly IResponseRepository _ResponseRepository; + private readonly INotificationRepository _NotificationRepository; + private readonly IUserRepository _UserRepository; private readonly IUserPermissions _userPermissions; private readonly ILogManager _logger; private readonly IHttpContextAccessor _accessor; private readonly Alias _alias; - public ServerEventRegistrationService(IEventRepository EventRepository, IResponseRepository ResponseRepository, IUserPermissions userPermissions, ITenantManager tenantManager, ILogManager logger, IHttpContextAccessor accessor) + public ServerEventRegistrationService(IEventRepository EventRepository, IResponseRepository ResponseRepository, INotificationRepository NotificationRepository, IUserRepository UserRepository, IUserPermissions userPermissions, ITenantManager tenantManager, ILogManager logger, IHttpContextAccessor accessor) { _EventRepository = EventRepository; _ResponseRepository = ResponseRepository; + _NotificationRepository = NotificationRepository; + _UserRepository = UserRepository; _userPermissions = userPermissions; _logger = logger; _accessor = accessor; @@ -52,6 +56,12 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, Response.ModuleId, PermissionNames.View)) { Response = _ResponseRepository.AddResponse(Response); + + Event currentEvent = _EventRepository.GetEvent(Response.EventRegistrationId); + string subject = Response.ResponseType ? $"Du bist erfolgreich für '{currentEvent.Name}' Registriert worden." : $"Du hast erfolgreich für '{currentEvent.Name}' abgesagt."; + string body = "Hier kann man die Infos des Events hineinpacken (HTML ist erlaubt)"; + SendEventResponseNotification(subject, body); + _logger.Log(LogLevel.Information, this, LogFunction.Create, "EventRegistration Added {NewEvent}", Response); } else @@ -68,6 +78,12 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, Response.ModuleId, PermissionNames.View)) { Response = _ResponseRepository.UpdateResponse(Response); + + Event currentEvent = _EventRepository.GetEvent(Response.EventRegistrationId); + string subject = Response.ResponseType ? $"Du bist erfolgreich für '{currentEvent.Name}' Registriert worden." : $"Du hast erfolgreich für '{currentEvent.Name}' abgesagt."; + string body = "Hier kann man die Infos des Events hineinpacken (HTML ist erlaubt)"; + SendEventResponseNotification(subject, body); + _logger.Log(LogLevel.Information, this, LogFunction.Create, "EventRegistration Added {NewEvent}", Response); } else @@ -211,7 +227,11 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services }*/ - - + private void SendEventResponseNotification(string subject, string body) + { + User user = _UserRepository.GetUser(_accessor.HttpContext.User.UserId()); + Notification notification = new Notification(_alias.SiteId, user, subject, body); + _NotificationRepository.AddNotification(notification); + } } } From f280e49d965178e9465fd6935766f1343087cc45 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Fri, 30 May 2025 23:39:32 +0200 Subject: [PATCH 09/34] Event: Add description, date and location. Changed Files: Model >Event.cs & Client > Module > Edit.razor & Detail.razor --- .../Details.razor | 52 +++++-------------- .../Edit.razor | 34 +++++++++++- .../ModuleInfo.cs | 4 +- Shared/Models/Event.cs | 4 ++ 4 files changed, 53 insertions(+), 41 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor index eda60dc..6cd31a2 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor @@ -11,6 +11,12 @@

Anmeldung zum Event

Willst du am Event (@_name) teilnehmen?

+@_eventDate - @_location +
+

@_description

+

Erstellt von: @_createdby am @_createdon

+

Zuletzt aktualisiert von: @_modifiedby am @_modifiedon

+
@if (PageState.User != null) { @@ -35,7 +41,7 @@ } } else { -

Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.

+

Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.

} @code { @@ -55,6 +61,10 @@ private int _id; private string _name; + private string _description; + private DateTime _eventDate; + private string _location; + private string _createdby; private DateTime _createdon; private string _modifiedby; @@ -103,6 +113,9 @@ if (currentEvent != null) { _name = currentEvent.Name; + _description = currentEvent.Description; + _eventDate = currentEvent.EventDate; + _location = currentEvent.Location; _createdby = currentEvent.CreatedBy; _createdon = currentEvent.CreatedOn; _modifiedby = currentEvent.ModifiedBy; @@ -121,41 +134,4 @@ AddModuleMessage(Localizer["Message.LoadError"], MessageType.Error); } } - - private async Task Save() - { - try - { - validated = true; - var interop = new Oqtane.UI.Interop(JSRuntime); - if (await interop.FormValid(form)) - { - if (PageState.Action == "Add") - { - Event EventRegistration = new Event(); - EventRegistration.ModuleId = ModuleState.ModuleId; - EventRegistration.Name = _name; - EventRegistration = await EventRegistrationService.AddEventAsync(EventRegistration); - await logger.LogInformation("EventRegistration Added {EventRegistration}", EventRegistration); - } - else - { - Event EventRegistration = await EventRegistrationService.GetEventAsync(_id, ModuleState.ModuleId); - EventRegistration.Name = _name; - await EventRegistrationService.UpdateEventAsync(EventRegistration); - await logger.LogInformation("EventRegistration Updated {EventRegistration}", EventRegistration); - } - NavigationManager.NavigateTo(NavigateUrl()); - } - else - { - AddModuleMessage(Localizer["Message.SaveValidation"], MessageType.Warning); - } - } - catch (Exception ex) - { - await logger.LogError(ex, "Error Saving EventRegistration {Error}", ex.Message); - AddModuleMessage(Localizer["Message.SaveError"], MessageType.Error); - } - } } diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor index 63723c4..1b8da3d 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor @@ -16,13 +16,31 @@
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
@Localizer["Cancel"]

@if (PageState.Action == "Edit") { - + } @@ -43,6 +61,10 @@ private int _id; private string _name; + private string _description; + private DateTime _eventDate; + private string _location; + private string _createdby; private DateTime _createdon; private string _modifiedby; @@ -59,6 +81,10 @@ if (EventRegistration != null) { _name = EventRegistration.Name; + _description = EventRegistration.Description; + _eventDate = EventRegistration.EventDate; + _location = EventRegistration.Location; + _createdby = EventRegistration.CreatedBy; _createdon = EventRegistration.CreatedOn; _modifiedby = EventRegistration.ModifiedBy; @@ -86,6 +112,9 @@ Event EventRegistration = new Event(); EventRegistration.ModuleId = ModuleState.ModuleId; EventRegistration.Name = _name; + EventRegistration.Description = _description; + EventRegistration.EventDate = _eventDate; + EventRegistration.Location = _location; EventRegistration = await EventRegistrationService.AddEventAsync(EventRegistration); await logger.LogInformation("EventRegistration Added {EventRegistration}", EventRegistration); } @@ -93,6 +122,9 @@ { Event EventRegistration = await EventRegistrationService.GetEventAsync(_id, ModuleState.ModuleId); EventRegistration.Name = _name; + EventRegistration.Description = _description; + EventRegistration.EventDate = _eventDate; + EventRegistration.Location = _location; await EventRegistrationService.UpdateEventAsync(EventRegistration); await logger.LogInformation("EventRegistration Updated {EventRegistration}", EventRegistration); } diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs index 775c53e..8d40bd9 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs @@ -9,9 +9,9 @@ namespace SZUAbsolventenverein.Module.EventRegistration { Name = "EventRegistration", Description = "A module to manage registration for events", - Version = "1.0.0", + Version = "1.0.5", ServerManagerType = "SZUAbsolventenverein.Module.EventRegistration.Manager.EventRegistrationManager, SZUAbsolventenverein.Module.EventRegistration.Server.Oqtane", - ReleaseVersions = "1.0.0", + ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,1.0.5", Dependencies = "SZUAbsolventenverein.Module.EventRegistration.Shared.Oqtane", PackageName = "SZUAbsolventenverein.Module.EventRegistration" }; diff --git a/Shared/Models/Event.cs b/Shared/Models/Event.cs index ea5aae5..316fdfa 100644 --- a/Shared/Models/Event.cs +++ b/Shared/Models/Event.cs @@ -13,6 +13,10 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Models public int ModuleId { get; set; } public string Name { get; set; } + public string Description { get; set; } + public DateTime EventDate { get; set; } + public string Location { get; set; } + public string CreatedBy { get; set; } public DateTime CreatedOn { get; set; } public string ModifiedBy { get; set; } From f63681bce5ad5b669458f6039670be89946c85fd Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Fri, 30 May 2025 23:54:11 +0200 Subject: [PATCH 10/34] Update: Save DateTime's as UTC and parse to LocalTime at the client. --- .../Details.razor | 6 +++--- .../Edit.razor | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor index 6cd31a2..3ea4212 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor @@ -114,12 +114,12 @@ { _name = currentEvent.Name; _description = currentEvent.Description; - _eventDate = currentEvent.EventDate; + _eventDate = currentEvent.EventDate.ToLocalTime(); _location = currentEvent.Location; _createdby = currentEvent.CreatedBy; - _createdon = currentEvent.CreatedOn; + _createdon = currentEvent.CreatedOn.ToLocalTime(); _modifiedby = currentEvent.ModifiedBy; - _modifiedon = currentEvent.ModifiedOn; + _modifiedon = currentEvent.ModifiedOn.ToLocalTime(); } if(rsvp != null) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor index 1b8da3d..624afb0 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor @@ -82,7 +82,7 @@ { _name = EventRegistration.Name; _description = EventRegistration.Description; - _eventDate = EventRegistration.EventDate; + _eventDate = EventRegistration.EventDate.ToLocalTime(); _location = EventRegistration.Location; _createdby = EventRegistration.CreatedBy; @@ -113,7 +113,7 @@ EventRegistration.ModuleId = ModuleState.ModuleId; EventRegistration.Name = _name; EventRegistration.Description = _description; - EventRegistration.EventDate = _eventDate; + EventRegistration.EventDate = _eventDate.ToUniversalTime(); EventRegistration.Location = _location; EventRegistration = await EventRegistrationService.AddEventAsync(EventRegistration); await logger.LogInformation("EventRegistration Added {EventRegistration}", EventRegistration); @@ -123,7 +123,7 @@ Event EventRegistration = await EventRegistrationService.GetEventAsync(_id, ModuleState.ModuleId); EventRegistration.Name = _name; EventRegistration.Description = _description; - EventRegistration.EventDate = _eventDate; + EventRegistration.EventDate = _eventDate.ToUniversalTime(); EventRegistration.Location = _location; await EventRegistrationService.UpdateEventAsync(EventRegistration); await logger.LogInformation("EventRegistration Updated {EventRegistration}", EventRegistration); From 4f7e84666142a1b87fe47b1bb0f251cc0a02c225 Mon Sep 17 00:00:00 2001 From: Florian Edlmayer Date: Mon, 2 Jun 2025 11:52:37 +0200 Subject: [PATCH 11/34] New: Event und Response Export Methode Changed: EventRegistrationManager.cs Co-Author: Konstantin Hintermayer --- Server/Manager/EventRegistrationManager.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Server/Manager/EventRegistrationManager.cs b/Server/Manager/EventRegistrationManager.cs index 3505f97..cc5ac18 100644 --- a/Server/Manager/EventRegistrationManager.cs +++ b/Server/Manager/EventRegistrationManager.cs @@ -40,10 +40,19 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager { // TODO: Export event Responses as well. string content = ""; - List EventRegistrations = _EventRepository.GetEvents(module.ModuleId).ToList(); - if (EventRegistrations != null) + List exportData = new List(); + foreach (var events in _EventRepository.GetEvents(module.ModuleId)) { - content = JsonSerializer.Serialize(EventRegistrations); + var responses = _ResponseRepository.GetResponses(events.EventId, module.ModuleId); + exportData.Add(new + { + Event = events, + Responses = responses.ToList() + }); + }; + if (exportData != null) + { + content = JsonSerializer.Serialize(exportData); } return content; } From 29c93baa6d9911b9cdcd6328c50c6c3702ec2ee1 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Mon, 2 Jun 2025 12:45:46 +0000 Subject: [PATCH 12/34] =?UTF-8?q?Event-Details:=20Erstellt=20von=20und=20b?= =?UTF-8?q?earbeitet=20von=20Felder=20gel=C3=B6scht.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: #12 Changed-Files: Details.razor --- .../SZUAbsolventenverein.Module.EventRegistration/Details.razor | 2 -- 1 file changed, 2 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor index 3ea4212..bbc5cad 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor @@ -14,8 +14,6 @@ @_eventDate - @_location

@_description

-

Erstellt von: @_createdby am @_createdon

-

Zuletzt aktualisiert von: @_modifiedby am @_modifiedon

@if (PageState.User != null) { From 396e531b5659c89c3793c0600c13aa8857b8d770 Mon Sep 17 00:00:00 2001 From: Florian Edlmayer Date: Mon, 16 Jun 2025 09:09:22 +0200 Subject: [PATCH 13/34] =?UTF-8?q?Migrations=20Down=20Skript=20repariert,?= =?UTF-8?q?=20Eventregistrationservice=20import=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/Migrations/01000000_InitializeModule.cs | 8 ++++---- Server/Services/EventRegistrationService.cs | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Server/Migrations/01000000_InitializeModule.cs b/Server/Migrations/01000000_InitializeModule.cs index 68c9401..6d7050d 100644 --- a/Server/Migrations/01000000_InitializeModule.cs +++ b/Server/Migrations/01000000_InitializeModule.cs @@ -26,10 +26,10 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Migrations protected override void Down(MigrationBuilder migrationBuilder) { - var entityBuilder = new EventEntityBuilder(migrationBuilder, ActiveDatabase); - entityBuilder.Drop(); - var entityBuilder2 = new EventResponseEntityBuilder(migrationBuilder, ActiveDatabase); - entityBuilder2.Drop(); + var responseEB = new EventResponseEntityBuilder(migrationBuilder, ActiveDatabase); + responseEB.Drop(); + var eventEB = new EventEntityBuilder(migrationBuilder, ActiveDatabase); + eventEB.Drop(); } } } diff --git a/Server/Services/EventRegistrationService.cs b/Server/Services/EventRegistrationService.cs index 8f1112e..df4f243 100644 --- a/Server/Services/EventRegistrationService.cs +++ b/Server/Services/EventRegistrationService.cs @@ -6,6 +6,7 @@ using Oqtane.Enums; using Oqtane.Extensions; using Oqtane.Infrastructure; using Oqtane.Models; +using Oqtane.Repository; using Oqtane.Security; using Oqtane.Shared; using SZUAbsolventenverein.Module.EventRegistration.Models; From 5f4794e42fa6f90cf116fa59220e4180283fc9e6 Mon Sep 17 00:00:00 2001 From: Florian Edlmayer Date: Mon, 16 Jun 2025 10:59:54 +0200 Subject: [PATCH 14/34] =?UTF-8?q?Down=20Methode=20geschreiben=20f=C3=BCr?= =?UTF-8?q?=20DropClumn=20von=203=20Spalten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Migrations/01000005_AddDescriptionDateTimeLocation.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Server/Migrations/01000005_AddDescriptionDateTimeLocation.cs b/Server/Migrations/01000005_AddDescriptionDateTimeLocation.cs index b79f601..2907d16 100644 --- a/Server/Migrations/01000005_AddDescriptionDateTimeLocation.cs +++ b/Server/Migrations/01000005_AddDescriptionDateTimeLocation.cs @@ -23,5 +23,13 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Migrations entityBuilder.AddDateTimeColumn("EventDate", false, new DateTime()); // DateTime for the event entityBuilder.AddStringColumn("Location", 100, false, true, ""); // Location of the event } + + protected override void Down(MigrationBuilder migrationBuilder) + { + var entityBuilder = new EventEntityBuilder(migrationBuilder, ActiveDatabase); + entityBuilder.DropColumn("Description"); // RichTextEditor + entityBuilder.DropColumn("EventDate"); // DateTime + entityBuilder.DropColumn("Location"); // Location + } } } From 106851fe94ace0284ec9fa3026ad654181c11bcd Mon Sep 17 00:00:00 2001 From: Florian Edlmayer Date: Sat, 21 Jun 2025 00:31:32 +0200 Subject: [PATCH 15/34] =?UTF-8?q?Migrations=20Down=20Skript=20repariert,?= =?UTF-8?q?=20Eventregistrationservice=20import=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/Migrations/01000005_AddDescriptionDateTimeLocation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/Migrations/01000005_AddDescriptionDateTimeLocation.cs b/Server/Migrations/01000005_AddDescriptionDateTimeLocation.cs index 2907d16..9f0c73a 100644 --- a/Server/Migrations/01000005_AddDescriptionDateTimeLocation.cs +++ b/Server/Migrations/01000005_AddDescriptionDateTimeLocation.cs @@ -29,7 +29,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Migrations var entityBuilder = new EventEntityBuilder(migrationBuilder, ActiveDatabase); entityBuilder.DropColumn("Description"); // RichTextEditor entityBuilder.DropColumn("EventDate"); // DateTime - entityBuilder.DropColumn("Location"); // Location + entityBuilder.DropColumn("Location"); // Location 0 } } } From f92c163e2cb2be85ea1197cd1cf6548eaf6608b2 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Sat, 21 Jun 2025 14:44:25 -0700 Subject: [PATCH 16/34] COSMETIC: Comment out unused vars, remove not released versions and update dependencies --- .../Details.razor | 4 ++-- .../ModuleInfo.cs | 2 +- ...solventenverein.Module.EventRegistration.Client.csproj | 4 ++-- ...solventenverein.Module.EventRegistration.Server.csproj | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor index bbc5cad..c75921b 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor @@ -54,8 +54,8 @@ new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" } }; - private ElementReference form; - private bool validated = false; + // private ElementReference form; + // private bool validated = false; private int _id; private string _name; diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs index 8d40bd9..a0cc69e 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs @@ -11,7 +11,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration Description = "A module to manage registration for events", Version = "1.0.5", ServerManagerType = "SZUAbsolventenverein.Module.EventRegistration.Manager.EventRegistrationManager, SZUAbsolventenverein.Module.EventRegistration.Server.Oqtane", - ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,1.0.5", + ReleaseVersions = "1.0.0,1.0.5", Dependencies = "SZUAbsolventenverein.Module.EventRegistration.Shared.Oqtane", PackageName = "SZUAbsolventenverein.Module.EventRegistration" }; diff --git a/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj b/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj index e9bcc47..3dbd876 100644 --- a/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj +++ b/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj @@ -13,8 +13,8 @@ - - + + diff --git a/Server/SZUAbsolventenverein.Module.EventRegistration.Server.csproj b/Server/SZUAbsolventenverein.Module.EventRegistration.Server.csproj index 7813ab4..431ac56 100644 --- a/Server/SZUAbsolventenverein.Module.EventRegistration.Server.csproj +++ b/Server/SZUAbsolventenverein.Module.EventRegistration.Server.csproj @@ -19,10 +19,10 @@ - - - - + + + + From 16cfe54fedf37df212ae6849918258d5bca8e1dc Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Sun, 22 Jun 2025 11:58:41 +0200 Subject: [PATCH 17/34] Tabelle auf der Index Seite & Dialog Message bearbeitet. Changed-Files: Index.razor & Index.resx --- .../Index.razor | 18 +++++------------- .../Index.resx | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor index c4034a7..da93d71 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor @@ -24,13 +24,16 @@ else     @Localizer["Name"] + @Localizer["Date"] + @Localizer["Locataion"]   - + @context.Name - + @context.EventDate.ToLocalTime() + @context.Location @@ -80,15 +83,4 @@ else AddModuleMessage(Localizer["Message.DeleteError"], MessageType.Error); } } - - private async Task Accept(Event eventRegistration) - { - Status = ("EventRegistration Accepted " + eventRegistration.Name); - await logger.LogInformation("EventRegistration Accepted {EventRegistration}", eventRegistration); - } - - private void Reject() - { - Status = "EventRegistration Rejected 1"; - } } \ No newline at end of file diff --git a/Client/Resources/SZUAbsolventenverein.Module.EventRegistration/Index.resx b/Client/Resources/SZUAbsolventenverein.Module.EventRegistration/Index.resx index efb43f4..dcb896d 100644 --- a/Client/Resources/SZUAbsolventenverein.Module.EventRegistration/Index.resx +++ b/Client/Resources/SZUAbsolventenverein.Module.EventRegistration/Index.resx @@ -127,10 +127,10 @@ Delete - Delete Event + Delete - Are You Sure You Wish To Delete This Event? + Are You Sure You Wish To Delete This Event? If you delete an event, all existing registrations will be deleted as well. No Events To Display @@ -142,6 +142,15 @@ Error Deleting Event - Reject + Details + + + Name + + + Date + + + Location \ No newline at end of file From 939b42a90d429850fbc0d0ab972aac13ac193cc0 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Sun, 22 Jun 2025 12:00:13 +0200 Subject: [PATCH 18/34] Event status styling & render description as MarkupString --- .../Details.razor | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor index c75921b..7a15cd6 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor @@ -11,9 +11,9 @@

Anmeldung zum Event

Willst du am Event (@_name) teilnehmen?

-@_eventDate - @_location +@_eventDate.ToLocalTime() - @_location
-

@_description

+ @((MarkupString)_description)
@if (PageState.User != null) { @@ -23,11 +23,11 @@

Status: @if (Status == true) { - @Localizer["Zusage"] + @Localizer["Zusage"]
} else { - @Localizer["Absage"] + @Localizer["Absage"]
}

@@ -63,11 +63,6 @@ private DateTime _eventDate; private string _location; - private string _createdby; - private DateTime _createdon; - private string _modifiedby; - private DateTime _modifiedon; - private Response _response; private bool? Status; @@ -112,12 +107,8 @@ { _name = currentEvent.Name; _description = currentEvent.Description; - _eventDate = currentEvent.EventDate.ToLocalTime(); + _eventDate = currentEvent.EventDate; _location = currentEvent.Location; - _createdby = currentEvent.CreatedBy; - _createdon = currentEvent.CreatedOn.ToLocalTime(); - _modifiedby = currentEvent.ModifiedBy; - _modifiedon = currentEvent.ModifiedOn.ToLocalTime(); } if(rsvp != null) From e5d955370a6a7797e3969c2f09243340d8971c88 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Sun, 22 Jun 2025 12:01:10 +0200 Subject: [PATCH 19/34] Edit Form: Move description to the bottom. Add RichTextEditor and AspNetCore.InputDate instead of HTML Input. --- .../Edit.razor | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor index 624afb0..6edc5af 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor @@ -1,6 +1,7 @@ @using Oqtane.Modules.Controls @using SZUAbsolventenverein.Module.EventRegistration.Services @using SZUAbsolventenverein.Module.EventRegistration.Models +@using Microsoft.AspNetCore.Components.Forms @namespace SZUAbsolventenverein.Module.EventRegistration @inherits ModuleBase @@ -17,22 +18,21 @@
- +
- +
- + +
-
- -
- -
+
+ +
@@ -56,13 +56,15 @@ new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" } }; + + private RichTextEditor RichTextEditorHtml; private ElementReference form; private bool validated = false; private int _id; private string _name; private string _description; - private DateTime _eventDate; + private DateTime _eventDate = DateTime.Now; private string _location; private string _createdby; @@ -105,6 +107,10 @@ { validated = true; var interop = new Oqtane.UI.Interop(JSRuntime); + + string content = await RichTextEditorHtml.GetHtml(); + content = Utilities.FormatContent(content, PageState.Alias, "save"); + if (await interop.FormValid(form)) { if (PageState.Action == "Add") @@ -112,7 +118,7 @@ Event EventRegistration = new Event(); EventRegistration.ModuleId = ModuleState.ModuleId; EventRegistration.Name = _name; - EventRegistration.Description = _description; + EventRegistration.Description = content; EventRegistration.EventDate = _eventDate.ToUniversalTime(); EventRegistration.Location = _location; EventRegistration = await EventRegistrationService.AddEventAsync(EventRegistration); @@ -122,7 +128,7 @@ { Event EventRegistration = await EventRegistrationService.GetEventAsync(_id, ModuleState.ModuleId); EventRegistration.Name = _name; - EventRegistration.Description = _description; + EventRegistration.Description = content; EventRegistration.EventDate = _eventDate.ToUniversalTime(); EventRegistration.Location = _location; await EventRegistrationService.UpdateEventAsync(EventRegistration); From 1c13c72a5375b5aae08680a1558769c495217db0 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Sun, 22 Jun 2025 12:01:57 +0200 Subject: [PATCH 20/34] Module-Styling mb-6 & mt-3 classes. --- .../Module.css | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css b/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css index 0856a26..ca6c9e9 100644 --- a/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css +++ b/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css @@ -1 +1,8 @@ -/* Module Custom Styles */ \ No newline at end of file +/* Module Custom Styles */ +.mb-6 { + margin-bottom: 6rem; +} + +.mt-3 { + margin-top: 3rem; +} \ No newline at end of file From 7ca97bcb9b4628ea9a93684496964f5f9071e65b Mon Sep 17 00:00:00 2001 From: Adam Gaiswinkler Date: Tue, 14 Oct 2025 11:00:11 +0200 Subject: [PATCH 21/34] =?UTF-8?q?=C3=84nderung=20der=20Version=20und=20Anp?= =?UTF-8?q?assen=20der=20Anzeige=20der=20events=20f=C3=BCr=20mobil=20und?= =?UTF-8?q?=20pcs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Index.razor | 34 ++++++++++++++++- ...ein.Module.EventRegistration.Client.csproj | 6 +-- ...ein.Module.EventRegistration.Server.csproj | 8 ++-- .../Module.css | 38 +++++++++++++++++++ 4 files changed, 77 insertions(+), 9 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor index da93d71..31d51b0 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor @@ -19,7 +19,37 @@ else

@Status

@if (@_EventRegistrations.Count != 0) { - + +
+
+ @foreach (var context in _EventRegistrations) + { +
+

@context.Name

+

@Localizer["Date"]: @context.EventDate.ToLocalTime()

+

@Localizer["Location"]: @context.Location

+ +
+ + + + + +
+
+ } +
+
+ /*
    @@ -36,7 +66,7 @@ else @context.Location - + */ } else { diff --git a/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj b/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj index 3dbd876..ed7135f 100644 --- a/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj +++ b/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj @@ -15,9 +15,9 @@ - - - + + + diff --git a/Server/SZUAbsolventenverein.Module.EventRegistration.Server.csproj b/Server/SZUAbsolventenverein.Module.EventRegistration.Server.csproj index 431ac56..7a138e9 100644 --- a/Server/SZUAbsolventenverein.Module.EventRegistration.Server.csproj +++ b/Server/SZUAbsolventenverein.Module.EventRegistration.Server.csproj @@ -19,10 +19,10 @@ - - - - + + + + diff --git a/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css b/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css index ca6c9e9..40d1dd7 100644 --- a/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css +++ b/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css @@ -5,4 +5,42 @@ .mt-3 { margin-top: 3rem; +} +.event-list { + display: flex; + flex-wrap: wrap; + gap: 1.5rem; + justify-content: center; +} + +.event-card { + /*background-color: var(--bs-gray-dark); */ + border: 2px solid rgb(var(--bs-primary-rgb)); /* Umrandung */ + border-radius: 12px; + box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); + padding: 1.5rem; + width: 280px; + /* color: #ddd; */ + transition: all 0.3s ease; +} + + .event-card:hover { + border-color: #66ccff; /* Heller beim Hover */ + transform: translateY(-4px); + box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5); + } + + .event-card h3 { + margin-top: 0; + margin-bottom: 0.5rem; + } + + .event-card p { + margin: 0.2rem 0; + } + +.event-actions { + margin-top: 1rem; + display: flex; + justify-content: space-between; } \ No newline at end of file From 97cf2a0b83ca9bcc86dcad206a8539754ac152d6 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Thu, 16 Oct 2025 14:17:31 +0200 Subject: [PATCH 22/34] Fix: Versions 9.0.8 im Client --- ...ventenverein.Module.EventRegistration.Client.csproj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj b/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj index ed7135f..e4378c7 100644 --- a/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj +++ b/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj @@ -13,11 +13,11 @@ - - - - - + + + + + From bdf4563e0d13d0fe691ef5a9ab58b4f896333386 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Thu, 16 Oct 2025 19:12:54 +0200 Subject: [PATCH 23/34] =?UTF-8?q?Fix:=20EventRegistration=20Tool=20(CERS?= =?UTF-8?q?=20=C3=BCberschreibt=20SERS)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit idea/source: https://github.com/oqtane/oqtane.framework/discussions/5541 --- Client/Startup/ClientStartup.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Client/Startup/ClientStartup.cs b/Client/Startup/ClientStartup.cs index 5fb721b..0ad161d 100644 --- a/Client/Startup/ClientStartup.cs +++ b/Client/Startup/ClientStartup.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Oqtane.Services; +using System.Linq; using SZUAbsolventenverein.Module.EventRegistration.Services; namespace SZUAbsolventenverein.Module.EventRegistration.Startup @@ -8,7 +9,10 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Startup { public void ConfigureServices(IServiceCollection services) { - services.AddScoped(); + if (!services.Any(s => s.ServiceType == typeof(IEventRegistrationService))) + { + services.AddScoped(); + } } } } From 45f203a8d49edcbc06c4f70b38bc712e0129e31a Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Thu, 23 Oct 2025 20:02:51 +0200 Subject: [PATCH 24/34] Anmeldetool cannot import Register Control Needs-Future-Attention https://git.kocoder.xyz/Diplomarbeit-Absolventenverein/Module.EventRegistration/issues/17 Removal of unset Fields and comments --- .../Details.razor | 7 +++++- .../Index.razor | 23 +------------------ .../ModuleInfo.cs | 4 ++-- ...ntenverein.Module.EventRegistration.nuspec | 4 ++-- 4 files changed, 11 insertions(+), 27 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor index 7a15cd6..8bb388f 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor @@ -39,7 +39,12 @@ } } else { -

Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.

+

Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.

+ + @* @if(PageState.Site.AllowRegistration) + { + + } *@ } @code { diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor index 31d51b0..b250f41 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Index.razor @@ -16,7 +16,6 @@ else

-

@Status

@if (@_EventRegistrations.Count != 0) { @@ -37,7 +36,7 @@ else @@ -49,24 +48,6 @@ else } - /* -
-   -   - @Localizer["Name"] - @Localizer["Date"] - @Localizer["Locataion"] -   -
- - - - @context.Name - @context.EventDate.ToLocalTime() - @context.Location - - -
*/ } else { @@ -75,8 +56,6 @@ else } @code { - private string Status; - public override List Resources => new List() { new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }, diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs index a0cc69e..f48e1c2 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs @@ -9,9 +9,9 @@ namespace SZUAbsolventenverein.Module.EventRegistration { Name = "EventRegistration", Description = "A module to manage registration for events", - Version = "1.0.5", + Version = "1.0.14", ServerManagerType = "SZUAbsolventenverein.Module.EventRegistration.Manager.EventRegistrationManager, SZUAbsolventenverein.Module.EventRegistration.Server.Oqtane", - ReleaseVersions = "1.0.0,1.0.5", + ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,1.0.5,1.0.6,1.0.7,1.0.8,1.0.9,1.0.10,1.0.11,1.0.12,1.0.13,1.0.14", Dependencies = "SZUAbsolventenverein.Module.EventRegistration.Shared.Oqtane", PackageName = "SZUAbsolventenverein.Module.EventRegistration" }; diff --git a/Package/SZUAbsolventenverein.Module.EventRegistration.nuspec b/Package/SZUAbsolventenverein.Module.EventRegistration.nuspec index 03495c4..5f2ccb9 100644 --- a/Package/SZUAbsolventenverein.Module.EventRegistration.nuspec +++ b/Package/SZUAbsolventenverein.Module.EventRegistration.nuspec @@ -2,7 +2,7 @@ $projectname$ - 1.0.0 + 1.0.14 SZUAbsolventenverein SZUAbsolventenverein EventRegistration @@ -16,7 +16,7 @@ - + From a1d863e8055230143e30bdbd193a24d0fcdec164 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Tue, 4 Nov 2025 10:30:20 +0100 Subject: [PATCH 25/34] Set Event Description as EMail Body. Fix: Typo in Subject Line --- Server/Services/EventRegistrationService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Server/Services/EventRegistrationService.cs b/Server/Services/EventRegistrationService.cs index df4f243..2a6f537 100644 --- a/Server/Services/EventRegistrationService.cs +++ b/Server/Services/EventRegistrationService.cs @@ -81,8 +81,8 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services Response = _ResponseRepository.UpdateResponse(Response); Event currentEvent = _EventRepository.GetEvent(Response.EventRegistrationId); - string subject = Response.ResponseType ? $"Du bist erfolgreich für '{currentEvent.Name}' Registriert worden." : $"Du hast erfolgreich für '{currentEvent.Name}' abgesagt."; - string body = "Hier kann man die Infos des Events hineinpacken (HTML ist erlaubt)"; + string subject = Response.ResponseType ? $"Du bist erfolgreich für '{currentEvent.Name}' registriert." : $"Du hast erfolgreich für '{currentEvent.Name}' abgesagt."; + string body = currentEvent.Description; SendEventResponseNotification(subject, body); _logger.Log(LogLevel.Information, this, LogFunction.Create, "EventRegistration Added {NewEvent}", Response); From d93b29a3248b21db79defbe08ead023f017aefcc Mon Sep 17 00:00:00 2001 From: Adam Gaiswinkler Date: Tue, 4 Nov 2025 20:18:26 +0100 Subject: [PATCH 26/34] bug fixes( mobile ansicht delele overlay fixed) wartet auf testing. Status offensichtlicher gemacht --- .../Details.razor | 10 +- .../Module.css | 167 +++++++++++++++++- 2 files changed, 168 insertions(+), 9 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor index 7a15cd6..5d84749 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor @@ -20,14 +20,18 @@ @if (Status != null) { -

Status: +

Status: @if (Status == true) { - @Localizer["Zusage"]
+ @Localizer["Zugesagt"] + +
} else { - @Localizer["Absage"]
+ @Localizer["Abgesagt"] + +
}

diff --git a/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css b/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css index 40d1dd7..0bcd26f 100644 --- a/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css +++ b/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css @@ -6,6 +6,13 @@ .mt-3 { margin-top: 3rem; } +.mt-2 strong { + font-size: 1.4rem; /* Textgröße – Standard ist ca. 1rem */ + font-weight: 700; +} +.fontsizeInf { + font-size: 1.4rem; /* Textgröße – Standard ist ca. 1rem */ +} .event-list { display: flex; flex-wrap: wrap; @@ -15,7 +22,7 @@ .event-card { /*background-color: var(--bs-gray-dark); */ - border: 2px solid rgb(var(--bs-primary-rgb)); /* Umrandung */ + border: 2px solid rgb(128 128 128); /* Umrandung */ border-radius: 12px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); padding: 1.5rem; @@ -24,11 +31,6 @@ transition: all 0.3s ease; } - .event-card:hover { - border-color: #66ccff; /* Heller beim Hover */ - transform: translateY(-4px); - box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5); - } .event-card h3 { margin-top: 0; @@ -43,4 +45,157 @@ margin-top: 1rem; display: flex; justify-content: space-between; +} +/* vorher: +.event-card:hover { + border-color: #66ccff; + transform: translateY(-4px); <-- das ist der Übeltäter + box-shadow: 0 6px 14px rgba(0,0,0,0.5); +} +*/ + +/* nachher – kein transform mehr */ +.event-card:hover { + border-color: #66ccff; + /* statt transform die Karte minimal "anheben" */ + margin-top: -4px; /* optischer Lift */ + box-shadow: 0 6px 14px rgba(0,0,0,0.5); +} + +/* sicherheitshalber: Overlay darf nicht abgeschnitten werden */ +.event-card { + overflow: visible; +} +/* ---------- A) Hover nur auf Geräten mit Maus ---------- */ +@media (hover: hover) and (pointer: fine) { + .event-card:hover { + border-color: #66ccff; + transform: translateY(-4px); + box-shadow: 0 6px 14px rgba(0,0,0,.5); + } +} + +/* Auf Touch-Geräten kein transform (verhindert Modal-Probleme) */ +@media (hover: none), (pointer: coarse) { + .event-card:hover { + transform: none; + box-shadow: 0 6px 14px rgba(0,0,0,.5); + } +} + +/* Sicherheitshalber: nichts abschneiden */ +.event-card { + overflow: visible; +} + + +/* ---------- B) Overlay/Modal (Desktop-Basis) ---------- */ +/* Falls schon vorhanden, kannst du diese Werte als Override nutzen */ +.overlay { + position: fixed; + inset: 0; + background: rgba(0,0,0,.45); + display: flex; + align-items: center; + justify-content: center; + padding: 2rem; + z-index: 2000; + overscroll-behavior: contain; +} + +.modal { + background: #fff; + border-radius: 10px; + box-shadow: 0 20px 60px rgba(0,0,0,.35); + width: min(92vw, 720px); + max-height: 85vh; + display: flex; + flex-direction: column; + overflow: hidden; /* für sticky header/footer */ +} + +.modal-header, +.modal-footer { + padding: 1rem 1.25rem; + background: #fff; +} + +.modal-header { + border-bottom: 1px solid rgba(0,0,0,.1); +} + +.modal-footer { + border-top: 1px solid rgba(0,0,0,.1); + display: flex; + gap: .75rem; + justify-content: flex-end; +} + +.modal-body { + padding: 1rem 1.25rem; + overflow: auto; + -webkit-overflow-scrolling: touch; +} + + /* Medien responsiv im Detail-Dialog */ + .modal-body img, + .modal-body video, + .modal-body canvas, + .modal-body iframe { + max-width: 100% !important; + height: auto !important; + display: block; + } + + +/* ---------- C) Mobile-Vollbild & Sticky-Header/Footer ---------- */ +@supports (height: 100dvh) { + .modal { + max-height: 100dvh; + } +} + +@media (max-width: 768px) { + .overlay { + padding: 0; + } + + .modal { + width: 100vw; + height: 100vh; /* nutzt auf modernen Browsern 100dvh (s.o.) */ + max-height: 100vh; + border-radius: 0; + } + + .modal-header { + position: sticky; + top: 0; + z-index: 1; + } + + .modal-footer { + position: sticky; + bottom: 0; + z-index: 1; + } + + .modal-body { + padding: 1rem; + } + + /* Lesbare Überschriften auf Mobile */ + .modal-body h1 { + font-size: clamp(1.25rem, 5.5vw, 2rem); + } + + .modal-body h2 { + font-size: clamp(1.125rem, 5vw, 1.5rem); + } +} + +/* iOS Safe-Area (Notch) */ +@supports (padding: max(0px)) { + .modal { + padding-bottom: max(0px, env(safe-area-inset-bottom)); + } } \ No newline at end of file From e12e4c532549e37e71c2ca631d66375b26ff2773 Mon Sep 17 00:00:00 2001 From: Adam Gaiswinkler Date: Tue, 4 Nov 2025 20:30:05 +0100 Subject: [PATCH 27/34] noch ein kleiner fix bei den buttons --- .../Details.razor | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor index 7e5f920..9030036 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor @@ -23,16 +23,12 @@

Status: @if (Status == true) { - @Localizer["Zugesagt"] - -
- + @Localizer["Zugesagt"]
+

} else { - @Localizer["Abgesagt"] - -
- + @Localizer["Abgesagt"]
+

}

} else { From 835795f5264fbe6180e0ea689993a69cdf74cdb7 Mon Sep 17 00:00:00 2001 From: Adam Gaiswinkler Date: Wed, 5 Nov 2025 09:40:36 +0100 Subject: [PATCH 28/34] =?UTF-8?q?ein=20fehler=20ist=20wieder=20zur=C3=BCck?= =?UTF-8?q?gekommen=20aber=20ist=20jetzt=20wieder=20gefixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SZUAbsolventenverein.Module.EventRegistration/Module.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css b/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css index 0bcd26f..3e58f0f 100644 --- a/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css +++ b/Server/wwwroot/Modules/SZUAbsolventenverein.Module.EventRegistration/Module.css @@ -70,7 +70,7 @@ @media (hover: hover) and (pointer: fine) { .event-card:hover { border-color: #66ccff; - transform: translateY(-4px); + box-shadow: 0 6px 14px rgba(0,0,0,.5); } } From 7694fc1e088af4d6b03412273f80b0c922a9e1f3 Mon Sep 17 00:00:00 2001 From: Florian Edlmayer Date: Thu, 6 Nov 2025 14:39:45 +0100 Subject: [PATCH 29/34] =?UTF-8?q?ValidateProfiles=20gemacht,=20Link=20zu?= =?UTF-8?q?=20Profiles=20wenn=20Jahrgang=20und=20fachrichtung=20fehlt=20un?= =?UTF-8?q?d=20bei=20save=20wieder=20zur=C3=BCck=20zum=20Event=20gemacht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Details.razor | 84 ++++++++++++++++++- 1 file changed, 81 insertions(+), 3 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor index 9030036..17d5051 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor @@ -1,12 +1,18 @@ -@using Oqtane.Modules.Controls +@using Oqtane +@using Oqtane.Modules.Controls @using SZUAbsolventenverein.Module.EventRegistration.Services @using SZUAbsolventenverein.Module.EventRegistration.Models +@using System.Text.RegularExpressions @namespace SZUAbsolventenverein.Module.EventRegistration @inherits ModuleBase @inject IEventRegistrationService EventRegistrationService @inject NavigationManager NavigationManager @inject IStringLocalizer Localizer +@inject IStringLocalizer SharedLocalizer +@inject IUserService UserService +@inject IProfileService ProfileService +@inject ISettingService SettingService

Anmeldung zum Event

@@ -71,6 +77,9 @@ private Response _response; private bool? Status; + private List _profiles = new List(); + private Dictionary _settings; + private async Task SendResponse(bool response) { if(_response == null) @@ -91,18 +100,45 @@ private async void Zusage() { - await SendResponse(true); + if(ValidateProfiles()) + { + await SendResponse(true); + } else + { + var currentPathAndQuery = new Uri(NavigationManager.Uri).PathAndQuery; + var encodedReturnUrl = Uri.EscapeDataString(currentPathAndQuery); + var link = $"/profile?tab=Profile&returnurl={encodedReturnUrl}"; + + AddModuleMessage(string.Format(SharedLocalizer["ProfileRequired"], $"Vervollständige hier dein Profil mit deinem Jahrgang und deiner Fachrichtung: Link zum Profil"), MessageType.Warning); + } } private async void Absage() { - await SendResponse(false); + if(ValidateProfiles()) + { + await SendResponse(false); + } else + { + var currentPathAndQuery = new Uri(NavigationManager.Uri).PathAndQuery; + var encodedReturnUrl = Uri.EscapeDataString(currentPathAndQuery); + var link = $"/profile?tab=profile&returnurl={encodedReturnUrl}"; + + AddModuleMessage(string.Format(SharedLocalizer["ProfileRequired"], $"Vervollständige hier dein Profil mit deinem Jahrgang und deiner Fachrichtung: {link}"), MessageType.Warning); + } } protected override async Task OnInitializedAsync() { try { + _profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId); + var user = await UserService.GetUserAsync(PageState.User.UserId, PageState.Site.SiteId); + if (user != null) + { + _settings = user.Settings; + } + _id = Int32.Parse(PageState.QueryString["id"]); Event currentEvent; @@ -128,4 +164,46 @@ AddModuleMessage(Localizer["Message.LoadError"], MessageType.Error); } } + + + private bool ValidateProfiles() + { + foreach (Profile profile in _profiles) + { + var value = GetProfileValue(profile.Name, string.Empty); + if (string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(profile.DefaultValue)) + { + _settings = SettingService.SetSetting(_settings, profile.Name, profile.DefaultValue); + } + if (!profile.IsPrivate || UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin)) + { + if (profile.IsRequired && string.IsNullOrEmpty(value)) + { + AddModuleMessage(string.Format(SharedLocalizer["ProfileRequired"], profile.Title), MessageType.Warning); + return false; + } + if (!string.IsNullOrEmpty(profile.Validation)) + { + Regex regex = new Regex(profile.Validation); + bool valid = regex.Match(value).Success; + if (!valid) + { + AddModuleMessage(string.Format(SharedLocalizer["ProfileInvalid"], profile.Title), MessageType.Warning); + return false; + } + } + } + } + return true; + } + + private string GetProfileValue(string SettingName, string DefaultValue) + { + string value = SettingService.GetSetting(_settings, SettingName, DefaultValue); + if (value.Contains("]")) + { + value = value.Substring(value.IndexOf("]") + 1); + } + return value; + } } From 669cc79678f985ae839801f1865797d56d0e45fc Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Thu, 20 Nov 2025 11:26:22 +0100 Subject: [PATCH 30/34] Oqtane 6.2.1 Dependency Bump --- ...ventenverein.Module.EventRegistration.Client.csproj | 10 +++++----- ...ventenverein.Module.EventRegistration.Server.csproj | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj b/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj index e4378c7..04e9f12 100644 --- a/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj +++ b/Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj @@ -13,11 +13,11 @@ - - - - - + + + + + diff --git a/Server/SZUAbsolventenverein.Module.EventRegistration.Server.csproj b/Server/SZUAbsolventenverein.Module.EventRegistration.Server.csproj index 7a138e9..6bf517f 100644 --- a/Server/SZUAbsolventenverein.Module.EventRegistration.Server.csproj +++ b/Server/SZUAbsolventenverein.Module.EventRegistration.Server.csproj @@ -19,10 +19,10 @@ - - - - + + + + From f86287783c9a2c18865dda0b16c4afa0e32c752f Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Thu, 20 Nov 2025 11:29:26 +0100 Subject: [PATCH 31/34] Bug: Loading Userprofile while not signed in interrupts Loading of the event --- .../SZUAbsolventenverein.Module.EventRegistration/Details.razor | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor index 17d5051..43049ae 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor @@ -132,12 +132,14 @@ { try { + if(PageState.User != null) { _profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId); var user = await UserService.GetUserAsync(PageState.User.UserId, PageState.Site.SiteId); if (user != null) { _settings = user.Settings; } + } _id = Int32.Parse(PageState.QueryString["id"]); From 7929f0bed660c3309162aef192b897e1bf18e147 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Thu, 20 Nov 2025 11:32:01 +0100 Subject: [PATCH 32/34] Reintroduce the Register Button --- .../Details.razor | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor index 43049ae..9804a8a 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor @@ -1,5 +1,6 @@ @using Oqtane @using Oqtane.Modules.Controls +@using Oqtane.Themes.Controls @using SZUAbsolventenverein.Module.EventRegistration.Services @using SZUAbsolventenverein.Module.EventRegistration.Models @using System.Text.RegularExpressions @@ -19,7 +20,7 @@

Willst du am Event (@_name) teilnehmen?

@_eventDate.ToLocalTime() - @_location
- @((MarkupString)_description) + @((MarkupString) _description)
@if (PageState.User != null) { @@ -46,11 +47,10 @@ } else {

Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.

+
- @* @if(PageState.Site.AllowRegistration) - { - - } *@ + +
} @code { From 1359aee2b195a40b35610b620bb157e67e97f9f1 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Thu, 20 Nov 2025 11:34:24 +0100 Subject: [PATCH 33/34] Code-Style: DRO: Validate Profile erst in SendResponse machen --- .../Details.razor | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor index 9804a8a..a1a5450 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor @@ -82,6 +82,7 @@ private async Task SendResponse(bool response) { + if(ValidateProfiles()) { if(_response == null) { _response = new Response(); @@ -96,13 +97,6 @@ _response = await EventRegistrationService.UpdateResponseAsync(_response); } if(_response != null) Status = _response.ResponseType; - } - - private async void Zusage() - { - if(ValidateProfiles()) - { - await SendResponse(true); } else { var currentPathAndQuery = new Uri(NavigationManager.Uri).PathAndQuery; @@ -113,19 +107,14 @@ } } + private async void Zusage() + { + await SendResponse(true); + } + private async void Absage() { - if(ValidateProfiles()) - { await SendResponse(false); - } else - { - var currentPathAndQuery = new Uri(NavigationManager.Uri).PathAndQuery; - var encodedReturnUrl = Uri.EscapeDataString(currentPathAndQuery); - var link = $"/profile?tab=profile&returnurl={encodedReturnUrl}"; - - AddModuleMessage(string.Format(SharedLocalizer["ProfileRequired"], $"Vervollständige hier dein Profil mit deinem Jahrgang und deiner Fachrichtung: {link}"), MessageType.Warning); - } } protected override async Task OnInitializedAsync() From ce68c5eb1dca372190d857bc08064562cc7166a1 Mon Sep 17 00:00:00 2001 From: Konstantin Hintermayer Date: Thu, 20 Nov 2025 11:36:52 +0100 Subject: [PATCH 34/34] Bump Version --- .../Details.razor | 48 +++++++++---------- .../ModuleInfo.cs | 4 +- ...ntenverein.Module.EventRegistration.nuspec | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor index a1a5450..6fdccf0 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Details.razor @@ -24,7 +24,7 @@ @if (PageState.User != null) { - + @if (Status != null) {

Status: @@ -48,8 +48,8 @@ {

Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.

- - + +
} @@ -83,20 +83,20 @@ private async Task SendResponse(bool response) { if(ValidateProfiles()) { - if(_response == null) - { - _response = new Response(); - _response.EventRegistrationId = _id; - _response.OwnerId = PageState.User.UserId; - _response.ModuleId = ModuleState.ModuleId; - _response.ResponseType = response; - _response = await EventRegistrationService.AddResponseAsync(_response); - } else - { - _response.ResponseType = response; - _response = await EventRegistrationService.UpdateResponseAsync(_response); - } - if(_response != null) Status = _response.ResponseType; + if(_response == null) + { + _response = new Response(); + _response.EventRegistrationId = _id; + _response.OwnerId = PageState.User.UserId; + _response.ModuleId = ModuleState.ModuleId; + _response.ResponseType = response; + _response = await EventRegistrationService.AddResponseAsync(_response); + } else + { + _response.ResponseType = response; + _response = await EventRegistrationService.UpdateResponseAsync(_response); + } + if(_response != null) Status = _response.ResponseType; } else { var currentPathAndQuery = new Uri(NavigationManager.Uri).PathAndQuery; @@ -114,7 +114,7 @@ private async void Absage() { - await SendResponse(false); + await SendResponse(false); } protected override async Task OnInitializedAsync() @@ -122,12 +122,12 @@ try { if(PageState.User != null) { - _profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId); - var user = await UserService.GetUserAsync(PageState.User.UserId, PageState.Site.SiteId); - if (user != null) - { - _settings = user.Settings; - } + _profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId); + var user = await UserService.GetUserAsync(PageState.User.UserId, PageState.Site.SiteId); + if (user != null) + { + _settings = user.Settings; + } } _id = Int32.Parse(PageState.QueryString["id"]); diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs index f48e1c2..3beb41f 100644 --- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs +++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/ModuleInfo.cs @@ -9,9 +9,9 @@ namespace SZUAbsolventenverein.Module.EventRegistration { Name = "EventRegistration", Description = "A module to manage registration for events", - Version = "1.0.14", + Version = "1.0.17", ServerManagerType = "SZUAbsolventenverein.Module.EventRegistration.Manager.EventRegistrationManager, SZUAbsolventenverein.Module.EventRegistration.Server.Oqtane", - ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,1.0.5,1.0.6,1.0.7,1.0.8,1.0.9,1.0.10,1.0.11,1.0.12,1.0.13,1.0.14", + ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,1.0.5,1.0.6,1.0.7,1.0.8,1.0.9,1.0.10,1.0.11,1.0.12,1.0.13,1.0.14,1.0.15,1.0.16,1.0.17", Dependencies = "SZUAbsolventenverein.Module.EventRegistration.Shared.Oqtane", PackageName = "SZUAbsolventenverein.Module.EventRegistration" }; diff --git a/Package/SZUAbsolventenverein.Module.EventRegistration.nuspec b/Package/SZUAbsolventenverein.Module.EventRegistration.nuspec index 5f2ccb9..1bf415d 100644 --- a/Package/SZUAbsolventenverein.Module.EventRegistration.nuspec +++ b/Package/SZUAbsolventenverein.Module.EventRegistration.nuspec @@ -2,7 +2,7 @@ $projectname$ - 1.0.14 + 1.0.17 SZUAbsolventenverein SZUAbsolventenverein EventRegistration