Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
2ed210e20f |
@ -8,42 +8,22 @@
|
|||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IStringLocalizer<Edit> Localizer
|
@inject IStringLocalizer<Edit> Localizer
|
||||||
|
|
||||||
<h3>Anmeldung zum Event</h3>
|
<div class="container">
|
||||||
|
<div class="row mb-1 align-items-center">
|
||||||
|
<Label Class="col-sm-3" For="name" HelpText="Enter a name" ResourceKey="Name">Name: </Label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input id="name" class="form-control" @bind="@_name" required />
|
||||||
|
</div>
|
||||||
|
|
||||||
<p>Willst du am Event (@_name) teilnehmen?</p>
|
|
||||||
<span>@_eventDate - @_location</span>
|
|
||||||
<div>
|
|
||||||
<p>@_description</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if (PageState.User != null) {
|
|
||||||
|
|
||||||
@if (Status != null)
|
|
||||||
{
|
|
||||||
<p class="mt-3"><strong>Status:</strong>
|
|
||||||
@if (Status == true)
|
|
||||||
{
|
|
||||||
@Localizer["Zusage"]
|
|
||||||
<button class="btn btn-danger" @onclick="Absage">@Localizer["Absagen"]</button>
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
@Localizer["Absage"]
|
|
||||||
<button class="btn btn-success" @onclick="Zusage">@Localizer["Zusagen"]</button>
|
|
||||||
}
|
|
||||||
</p>
|
|
||||||
} else {
|
|
||||||
<div class="buttons">
|
|
||||||
<button class="btn btn-success" @onclick="Zusage">@Localizer["Zusagen"]</button>
|
|
||||||
<button class="btn btn-danger" @onclick="Absage">@Localizer["Absagen"]</button>
|
|
||||||
</div>
|
</div>
|
||||||
}
|
</div>
|
||||||
} else
|
<button type="button" class="btn btn-success" @onclick="Save">@Localizer["Save"]</button>
|
||||||
{
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||||
<p class="mt-3">Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.</p> <Login /><Register />
|
<br /><br />
|
||||||
}
|
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.View;
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit;
|
||||||
|
|
||||||
public override string Actions => "Details";
|
public override string Actions => "Details";
|
||||||
|
|
||||||
@ -54,76 +34,29 @@
|
|||||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }
|
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }
|
||||||
};
|
};
|
||||||
|
|
||||||
// private ElementReference form;
|
private ElementReference form;
|
||||||
// private bool validated = false;
|
private bool validated = false;
|
||||||
|
|
||||||
private int _id;
|
private int _id;
|
||||||
private string _name;
|
private string _name;
|
||||||
private string _description;
|
|
||||||
private DateTime _eventDate;
|
|
||||||
private string _location;
|
|
||||||
|
|
||||||
private string _createdby;
|
private string _createdby;
|
||||||
private DateTime _createdon;
|
private DateTime _createdon;
|
||||||
private string _modifiedby;
|
private string _modifiedby;
|
||||||
private DateTime _modifiedon;
|
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()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_id = Int32.Parse(PageState.QueryString["id"]);
|
_id = Int32.Parse(PageState.QueryString["id"]);
|
||||||
|
Event EventRegistration = await EventRegistrationService.GetEventRegistrationAsync(_id, ModuleState.ModuleId);
|
||||||
Event currentEvent;
|
if (EventRegistration != null)
|
||||||
Response rsvp;
|
|
||||||
(currentEvent, rsvp) = await EventRegistrationService.GetEventDetails(_id, ModuleState.ModuleId);
|
|
||||||
if (currentEvent != null)
|
|
||||||
{
|
{
|
||||||
_name = currentEvent.Name;
|
_name = EventRegistration.Name;
|
||||||
_description = currentEvent.Description;
|
_createdby = EventRegistration.CreatedBy;
|
||||||
_eventDate = currentEvent.EventDate.ToLocalTime();
|
_createdon = EventRegistration.CreatedOn;
|
||||||
_location = currentEvent.Location;
|
_modifiedby = EventRegistration.ModifiedBy;
|
||||||
_createdby = currentEvent.CreatedBy;
|
_modifiedon = EventRegistration.ModifiedOn;
|
||||||
_createdon = currentEvent.CreatedOn.ToLocalTime();
|
|
||||||
_modifiedby = currentEvent.ModifiedBy;
|
|
||||||
_modifiedon = currentEvent.ModifiedOn.ToLocalTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(rsvp != null)
|
|
||||||
{
|
|
||||||
_response = rsvp;
|
|
||||||
Status = rsvp.ResponseType;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -132,4 +65,41 @@
|
|||||||
AddModuleMessage(Localizer["Message.LoadError"], MessageType.Error);
|
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.AddEventRegistrationAsync(EventRegistration);
|
||||||
|
await logger.LogInformation("EventRegistration Added {EventRegistration}", EventRegistration);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Event EventRegistration = await EventRegistrationService.GetEventRegistrationAsync(_id, ModuleState.ModuleId);
|
||||||
|
EventRegistration.Name = _name;
|
||||||
|
await EventRegistrationService.UpdateEventRegistrationAsync(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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,31 +16,13 @@
|
|||||||
<input id="name" class="form-control" @bind="@_name" required />
|
<input id="name" class="form-control" @bind="@_name" required />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-1 align-items-center">
|
|
||||||
<Label Class="col-sm-3" For="description" HelpText="Enter a description" ResourceKey="Description">Description: </Label>
|
|
||||||
<div class="col-sm-9">
|
|
||||||
<input id="description" class="form-control" @bind="@_description" required />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-1 align-items-center">
|
|
||||||
<Label Class="col-sm-3" For="eventdate" HelpText="Enter a Date" ResourceKey="EventDate">EventDate: </Label>
|
|
||||||
<div class="col-sm-9">
|
|
||||||
<input id="eventdate" class="form-control" @bind="@_eventDate" required />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-1 align-items-center">
|
|
||||||
<Label Class="col-sm-3" For="location" HelpText="Enter a Location" ResourceKey="Location">Location: </Label>
|
|
||||||
<div class="col-sm-9">
|
|
||||||
<input id="location" class="form-control" @bind="@_location" required />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn btn-success" @onclick="Save">@Localizer["Save"]</button>
|
<button type="button" class="btn btn-success" @onclick="Save">@Localizer["Save"]</button>
|
||||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
@if (PageState.Action == "Edit")
|
@if (PageState.Action == "Edit")
|
||||||
{
|
{
|
||||||
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
|
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
|
||||||
}
|
}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@ -61,10 +43,6 @@
|
|||||||
|
|
||||||
private int _id;
|
private int _id;
|
||||||
private string _name;
|
private string _name;
|
||||||
private string _description;
|
|
||||||
private DateTime _eventDate;
|
|
||||||
private string _location;
|
|
||||||
|
|
||||||
private string _createdby;
|
private string _createdby;
|
||||||
private DateTime _createdon;
|
private DateTime _createdon;
|
||||||
private string _modifiedby;
|
private string _modifiedby;
|
||||||
@ -77,14 +55,10 @@
|
|||||||
if (PageState.Action == "Edit")
|
if (PageState.Action == "Edit")
|
||||||
{
|
{
|
||||||
_id = Int32.Parse(PageState.QueryString["id"]);
|
_id = Int32.Parse(PageState.QueryString["id"]);
|
||||||
Event EventRegistration = await EventRegistrationService.GetEventAsync(_id, ModuleState.ModuleId);
|
Event EventRegistration = await EventRegistrationService.GetEventRegistrationAsync(_id, ModuleState.ModuleId);
|
||||||
if (EventRegistration != null)
|
if (EventRegistration != null)
|
||||||
{
|
{
|
||||||
_name = EventRegistration.Name;
|
_name = EventRegistration.Name;
|
||||||
_description = EventRegistration.Description;
|
|
||||||
_eventDate = EventRegistration.EventDate.ToLocalTime();
|
|
||||||
_location = EventRegistration.Location;
|
|
||||||
|
|
||||||
_createdby = EventRegistration.CreatedBy;
|
_createdby = EventRegistration.CreatedBy;
|
||||||
_createdon = EventRegistration.CreatedOn;
|
_createdon = EventRegistration.CreatedOn;
|
||||||
_modifiedby = EventRegistration.ModifiedBy;
|
_modifiedby = EventRegistration.ModifiedBy;
|
||||||
@ -112,20 +86,14 @@
|
|||||||
Event EventRegistration = new Event();
|
Event EventRegistration = new Event();
|
||||||
EventRegistration.ModuleId = ModuleState.ModuleId;
|
EventRegistration.ModuleId = ModuleState.ModuleId;
|
||||||
EventRegistration.Name = _name;
|
EventRegistration.Name = _name;
|
||||||
EventRegistration.Description = _description;
|
EventRegistration = await EventRegistrationService.AddEventRegistrationAsync(EventRegistration);
|
||||||
EventRegistration.EventDate = _eventDate.ToUniversalTime();
|
|
||||||
EventRegistration.Location = _location;
|
|
||||||
EventRegistration = await EventRegistrationService.AddEventAsync(EventRegistration);
|
|
||||||
await logger.LogInformation("EventRegistration Added {EventRegistration}", EventRegistration);
|
await logger.LogInformation("EventRegistration Added {EventRegistration}", EventRegistration);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Event EventRegistration = await EventRegistrationService.GetEventAsync(_id, ModuleState.ModuleId);
|
Event EventRegistration = await EventRegistrationService.GetEventRegistrationAsync(_id, ModuleState.ModuleId);
|
||||||
EventRegistration.Name = _name;
|
EventRegistration.Name = _name;
|
||||||
EventRegistration.Description = _description;
|
await EventRegistrationService.UpdateEventRegistrationAsync(EventRegistration);
|
||||||
EventRegistration.EventDate = _eventDate.ToUniversalTime();
|
|
||||||
EventRegistration.Location = _location;
|
|
||||||
await EventRegistrationService.UpdateEventAsync(EventRegistration);
|
|
||||||
await logger.LogInformation("EventRegistration Updated {EventRegistration}", EventRegistration);
|
await logger.LogInformation("EventRegistration Updated {EventRegistration}", EventRegistration);
|
||||||
}
|
}
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
@if (_EventRegistrations == null)
|
@if (_EventRegistrations == null)
|
||||||
{
|
{
|
||||||
<p><em>Loading...</em></p>
|
<p><em>Loading 234...</em></p>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -27,11 +27,13 @@ else
|
|||||||
<th style="width: 1px;"> </th>
|
<th style="width: 1px;"> </th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.EventId.ToString())" ResourceKey="Edit" /></td>
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.EventRegistrationId.ToString())" ResourceKey="Edit" /></td>
|
||||||
<td><ActionDialog Header="Delete EventRegistration" Message="Are You Sure You Wish To Delete This EventRegistration?" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" ResourceKey="Delete" Id="@context.EventId.ToString()" /></td>
|
<td><ActionDialog Header="Delete EventRegistration" Message="Are You Sure You Wish To Delete This EventRegistration?" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" ResourceKey="Delete" Id="@context.EventRegistrationId.ToString()" /></td>
|
||||||
<td>@context.Name</td>
|
<td>@context.Name</td>
|
||||||
|
|
||||||
<td><ActionLink Action="Details" Parameters="@($"id=" + context.EventId.ToString())" ResourceKey="Details"/></td>
|
@* @if(UserSecurity.IsAuthorized(PageState.User, PermissionNames.Utilize)) { *@
|
||||||
|
<td><ActionLink Action="Details" Parameters="@($"id=" + context.EventRegistrationId.ToString())" ResourceKey="Details"/></td>
|
||||||
|
@* } *@
|
||||||
</Row>
|
</Row>
|
||||||
</Pager>
|
</Pager>
|
||||||
}
|
}
|
||||||
@ -56,7 +58,7 @@ else
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_EventRegistrations = await EventRegistrationService.GetEventsAsync(ModuleState.ModuleId);
|
_EventRegistrations = await EventRegistrationService.GetEventRegistrationsAsync(ModuleState.ModuleId);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -69,9 +71,9 @@ else
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await EventRegistrationService.DeleteEventAsync(EventRegistration.EventId, ModuleState.ModuleId);
|
await EventRegistrationService.DeleteEventRegistrationAsync(EventRegistration.EventRegistrationId, ModuleState.ModuleId);
|
||||||
await logger.LogInformation("EventRegistration Deleted {EventRegistration}", EventRegistration);
|
await logger.LogInformation("EventRegistration Deleted {EventRegistration}", EventRegistration);
|
||||||
_EventRegistrations = await EventRegistrationService.GetEventsAsync(ModuleState.ModuleId);
|
_EventRegistrations = await EventRegistrationService.GetEventRegistrationsAsync(ModuleState.ModuleId);
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -9,9 +9,9 @@ namespace SZUAbsolventenverein.Module.EventRegistration
|
|||||||
{
|
{
|
||||||
Name = "EventRegistration",
|
Name = "EventRegistration",
|
||||||
Description = "A module to manage registration for events",
|
Description = "A module to manage registration for events",
|
||||||
Version = "1.0.5",
|
Version = "1.0.0",
|
||||||
ServerManagerType = "SZUAbsolventenverein.Module.EventRegistration.Manager.EventRegistrationManager, SZUAbsolventenverein.Module.EventRegistration.Server.Oqtane",
|
ServerManagerType = "SZUAbsolventenverein.Module.EventRegistration.Manager.EventRegistrationManager, SZUAbsolventenverein.Module.EventRegistration.Server.Oqtane",
|
||||||
ReleaseVersions = "1.0.0,1.0.5",
|
ReleaseVersions = "1.0.0",
|
||||||
Dependencies = "SZUAbsolventenverein.Module.EventRegistration.Shared.Oqtane",
|
Dependencies = "SZUAbsolventenverein.Module.EventRegistration.Shared.Oqtane",
|
||||||
PackageName = "SZUAbsolventenverein.Module.EventRegistration"
|
PackageName = "SZUAbsolventenverein.Module.EventRegistration"
|
||||||
};
|
};
|
||||||
|
@ -1,132 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<data name="Absage" xml:space="preserve">
|
|
||||||
<value>Du hast abgesagt. Schade, vielleicht nächstes Mal!</value>
|
|
||||||
</data>
|
|
||||||
<data name="Absagen" xml:space="preserve">
|
|
||||||
<value>Absagen</value>
|
|
||||||
</data>
|
|
||||||
<data name="Zusage" xml:space="preserve">
|
|
||||||
<value>Du hast zugesagt. Wir freuen uns auf dich!</value>
|
|
||||||
</data>
|
|
||||||
<data name="Zusagen" xml:space="preserve">
|
|
||||||
<value>Zusagen</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
@ -13,8 +13,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.3" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="9.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="9.0.3" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.3" />
|
<PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.3" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.3" />
|
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.3" />
|
||||||
<PackageReference Include="System.Net.Http.Json" Version="9.0.3" />
|
<PackageReference Include="System.Net.Http.Json" Version="9.0.3" />
|
||||||
|
@ -2,10 +2,8 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Oqtane.Services;
|
using Oqtane.Services;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using SZUAbsolventenverein.Module.EventRegistration.Models;
|
|
||||||
|
|
||||||
namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
||||||
{
|
{
|
||||||
@ -15,7 +13,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
|||||||
|
|
||||||
private string Apiurl => CreateApiUrl("EventRegistration");
|
private string Apiurl => CreateApiUrl("EventRegistration");
|
||||||
|
|
||||||
/*public async Task<List<Models.Event>> GetEventRegistrationsAsync(int ModuleId)
|
public async Task<List<Models.Event>> GetEventRegistrationsAsync(int ModuleId)
|
||||||
{
|
{
|
||||||
List<Models.Event> EventRegistrations = await GetJsonAsync<List<Models.Event>>(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", EntityNames.Module, ModuleId), Enumerable.Empty<Models.Event>().ToList());
|
List<Models.Event> EventRegistrations = await GetJsonAsync<List<Models.Event>>(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", EntityNames.Module, ModuleId), Enumerable.Empty<Models.Event>().ToList());
|
||||||
return EventRegistrations.OrderBy(item => item.Name).ToList();
|
return EventRegistrations.OrderBy(item => item.Name).ToList();
|
||||||
@ -34,51 +32,11 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
|||||||
public async Task<Models.Event> UpdateEventRegistrationAsync(Models.Event EventRegistration)
|
public async Task<Models.Event> UpdateEventRegistrationAsync(Models.Event EventRegistration)
|
||||||
{
|
{
|
||||||
return await PutJsonAsync<Models.Event>(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventRegistration.EventRegistrationId}", EntityNames.Module, EventRegistration.ModuleId), EventRegistration);
|
return await PutJsonAsync<Models.Event>(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventRegistration.EventRegistrationId}", EntityNames.Module, EventRegistration.ModuleId), EventRegistration);
|
||||||
}*/
|
|
||||||
|
|
||||||
public async Task<List<Event>> GetEventsAsync(int ModuleId)
|
|
||||||
{
|
|
||||||
List<Event> EventRegistrations = await GetJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", EntityNames.Module, ModuleId), Enumerable.Empty<Event>().ToList());
|
|
||||||
return EventRegistrations.OrderBy(item => item.Name).ToList();
|
|
||||||
}
|
|
||||||
public async Task<Event> GetEventAsync(int EventId, int ModuleId)
|
|
||||||
{
|
|
||||||
return await GetJsonAsync<Event>(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventId}/{ModuleId}", EntityNames.Module, ModuleId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Event> AddEventAsync(Event NewEvent)
|
public async Task DeleteEventRegistrationAsync(int EventRegistrationId, int ModuleId)
|
||||||
{
|
{
|
||||||
return await PostJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}", EntityNames.Module, NewEvent.ModuleId), NewEvent);
|
await DeleteAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventRegistrationId}/{ModuleId}", EntityNames.Module, ModuleId));
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Event> UpdateEventAsync(Event NewEvent)
|
|
||||||
{
|
|
||||||
return await PutJsonAsync<Event>(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<Response> AddResponseAsync(Response response)
|
|
||||||
{
|
|
||||||
return await PostJsonAsync<Response>(CreateAuthorizationPolicyUrl($"{Apiurl}/response/{response.EventRegistrationId}/{response.ModuleId}", EntityNames.Module, response.ModuleId), response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Response> UpdateResponseAsync(Response response)
|
|
||||||
{
|
|
||||||
return await PutJsonAsync<Response>(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<List<Response>> GetEventResponses(int EventId, int ModuleId)
|
|
||||||
{
|
|
||||||
throw new System.NotImplementedException();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Controllers
|
|||||||
int ModuleId;
|
int ModuleId;
|
||||||
if (int.TryParse(moduleid, out ModuleId) && IsAuthorizedEntityId(EntityNames.Module, ModuleId))
|
if (int.TryParse(moduleid, out ModuleId) && IsAuthorizedEntityId(EntityNames.Module, ModuleId))
|
||||||
{
|
{
|
||||||
return await _EventRegistrationService.GetEventsAsync(ModuleId);
|
return await _EventRegistrationService.GetEventRegistrationsAsync(ModuleId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -45,7 +45,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Controllers
|
|||||||
[Authorize(Policy = PolicyNames.ViewModule)]
|
[Authorize(Policy = PolicyNames.ViewModule)]
|
||||||
public async Task<Models.Event> Get(int id, int moduleid)
|
public async Task<Models.Event> Get(int id, int moduleid)
|
||||||
{
|
{
|
||||||
Models.Event EventRegistration = await _EventRegistrationService.GetEventAsync(id, moduleid);
|
Models.Event EventRegistration = await _EventRegistrationService.GetEventRegistrationAsync(id, moduleid);
|
||||||
if (EventRegistration != null && IsAuthorizedEntityId(EntityNames.Module, EventRegistration.ModuleId))
|
if (EventRegistration != null && IsAuthorizedEntityId(EntityNames.Module, EventRegistration.ModuleId))
|
||||||
{
|
{
|
||||||
return EventRegistration;
|
return EventRegistration;
|
||||||
@ -65,7 +65,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Controllers
|
|||||||
{
|
{
|
||||||
if (ModelState.IsValid && IsAuthorizedEntityId(EntityNames.Module, EventRegistration.ModuleId))
|
if (ModelState.IsValid && IsAuthorizedEntityId(EntityNames.Module, EventRegistration.ModuleId))
|
||||||
{
|
{
|
||||||
EventRegistration = await _EventRegistrationService.AddEventAsync(EventRegistration);
|
EventRegistration = await _EventRegistrationService.AddEventRegistrationAsync(EventRegistration);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -81,9 +81,9 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Controllers
|
|||||||
[Authorize(Policy = PolicyNames.EditModule)]
|
[Authorize(Policy = PolicyNames.EditModule)]
|
||||||
public async Task<Models.Event> Put(int id, [FromBody] Models.Event EventRegistration)
|
public async Task<Models.Event> Put(int id, [FromBody] Models.Event EventRegistration)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && EventRegistration.EventId == id && IsAuthorizedEntityId(EntityNames.Module, EventRegistration.ModuleId))
|
if (ModelState.IsValid && EventRegistration.EventRegistrationId == id && IsAuthorizedEntityId(EntityNames.Module, EventRegistration.ModuleId))
|
||||||
{
|
{
|
||||||
EventRegistration = await _EventRegistrationService.UpdateEventAsync(EventRegistration);
|
EventRegistration = await _EventRegistrationService.UpdateEventRegistrationAsync(EventRegistration);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -99,10 +99,10 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Controllers
|
|||||||
[Authorize(Policy = PolicyNames.EditModule)]
|
[Authorize(Policy = PolicyNames.EditModule)]
|
||||||
public async Task Delete(int id, int moduleid)
|
public async Task Delete(int id, int moduleid)
|
||||||
{
|
{
|
||||||
Models.Event EventRegistration = await _EventRegistrationService.GetEventAsync(id, moduleid);
|
Models.Event EventRegistration = await _EventRegistrationService.GetEventRegistrationAsync(id, moduleid);
|
||||||
if (EventRegistration != null && IsAuthorizedEntityId(EntityNames.Module, EventRegistration.ModuleId))
|
if (EventRegistration != null && IsAuthorizedEntityId(EntityNames.Module, EventRegistration.ModuleId))
|
||||||
{
|
{
|
||||||
await _EventRegistrationService.DeleteEventAsync(id, EventRegistration.ModuleId);
|
await _EventRegistrationService.DeleteEventRegistrationAsync(id, EventRegistration.ModuleId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -110,27 +110,5 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Controllers
|
|||||||
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET api/<controller>/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.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,12 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager
|
|||||||
{
|
{
|
||||||
public class EventRegistrationManager : MigratableModuleBase, IInstallable, IPortable, ISearchable
|
public class EventRegistrationManager : MigratableModuleBase, IInstallable, IPortable, ISearchable
|
||||||
{
|
{
|
||||||
private readonly IEventRepository _EventRepository;
|
private readonly IEventRegistrationRepository _EventRegistrationRepository;
|
||||||
private readonly IResponseRepository _ResponseRepository;
|
|
||||||
private readonly IDBContextDependencies _DBContextDependencies;
|
private readonly IDBContextDependencies _DBContextDependencies;
|
||||||
|
|
||||||
public EventRegistrationManager(IEventRepository EventRegistrationRepository, IResponseRepository ResponseRepository, IDBContextDependencies DBContextDependencies)
|
public EventRegistrationManager(IEventRegistrationRepository EventRegistrationRepository, IDBContextDependencies DBContextDependencies)
|
||||||
{
|
{
|
||||||
_EventRepository = EventRegistrationRepository;
|
_EventRegistrationRepository = EventRegistrationRepository;
|
||||||
_ResponseRepository = ResponseRepository;
|
|
||||||
_DBContextDependencies = DBContextDependencies;
|
_DBContextDependencies = DBContextDependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,28 +36,17 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager
|
|||||||
|
|
||||||
public string ExportModule(Oqtane.Models.Module module)
|
public string ExportModule(Oqtane.Models.Module module)
|
||||||
{
|
{
|
||||||
// TODO: Export event Responses as well.
|
|
||||||
string content = "";
|
string content = "";
|
||||||
List<object> exportData = new List<object>();
|
List<Models.Event> EventRegistrations = _EventRegistrationRepository.GetEventRegistrations(module.ModuleId).ToList();
|
||||||
foreach (var events in _EventRepository.GetEvents(module.ModuleId))
|
if (EventRegistrations != null)
|
||||||
{
|
{
|
||||||
var responses = _ResponseRepository.GetResponses(events.EventId, module.ModuleId);
|
content = JsonSerializer.Serialize(EventRegistrations);
|
||||||
exportData.Add(new
|
|
||||||
{
|
|
||||||
Event = events,
|
|
||||||
Responses = responses.ToList()
|
|
||||||
});
|
|
||||||
};
|
|
||||||
if (exportData != null)
|
|
||||||
{
|
|
||||||
content = JsonSerializer.Serialize(exportData);
|
|
||||||
}
|
}
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ImportModule(Oqtane.Models.Module module, string content, string version)
|
public void ImportModule(Oqtane.Models.Module module, string content, string version)
|
||||||
{
|
{
|
||||||
// TODO: Import event Responses as well.
|
|
||||||
List<Models.Event> EventRegistrations = null;
|
List<Models.Event> EventRegistrations = null;
|
||||||
if (!string.IsNullOrEmpty(content))
|
if (!string.IsNullOrEmpty(content))
|
||||||
{
|
{
|
||||||
@ -69,7 +56,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager
|
|||||||
{
|
{
|
||||||
foreach(var EventRegistration in EventRegistrations)
|
foreach(var EventRegistration in EventRegistrations)
|
||||||
{
|
{
|
||||||
_EventRepository.AddEvent(new Models.Event { ModuleId = module.ModuleId, Name = EventRegistration.Name });
|
_EventRegistrationRepository.AddEventRegistration(new Models.Event { ModuleId = module.ModuleId, Name = EventRegistration.Name });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,14 +65,14 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Manager
|
|||||||
{
|
{
|
||||||
var searchContentList = new List<SearchContent>();
|
var searchContentList = new List<SearchContent>();
|
||||||
|
|
||||||
foreach (var EventRegistration in _EventRepository.GetEvents(pageModule.ModuleId))
|
foreach (var EventRegistration in _EventRegistrationRepository.GetEventRegistrations(pageModule.ModuleId))
|
||||||
{
|
{
|
||||||
if (EventRegistration.ModifiedOn >= lastIndexedOn)
|
if (EventRegistration.ModifiedOn >= lastIndexedOn)
|
||||||
{
|
{
|
||||||
searchContentList.Add(new SearchContent
|
searchContentList.Add(new SearchContent
|
||||||
{
|
{
|
||||||
EntityName = "SZUAbsolventenvereinEventRegistration",
|
EntityName = "SZUAbsolventenvereinEventRegistration",
|
||||||
EntityId = EventRegistration.EventId.ToString(),
|
EntityId = EventRegistration.EventRegistrationId.ToString(),
|
||||||
Title = EventRegistration.Name,
|
Title = EventRegistration.Name,
|
||||||
Body = EventRegistration.Name,
|
Body = EventRegistration.Name,
|
||||||
ContentModifiedBy = EventRegistration.ModifiedBy,
|
ContentModifiedBy = EventRegistration.ModifiedBy,
|
||||||
|
@ -17,7 +17,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Migrations
|
|||||||
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
var entityBuilder = new EventEntityBuilder(migrationBuilder, ActiveDatabase);
|
var entityBuilder = new EventRegistrationEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
entityBuilder.Create();
|
entityBuilder.Create();
|
||||||
|
|
||||||
var entityBuilder2 = new EventResponseEntityBuilder(migrationBuilder, ActiveDatabase);
|
var entityBuilder2 = new EventResponseEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
@ -26,10 +26,10 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Migrations
|
|||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
var responseEB = new EventResponseEntityBuilder(migrationBuilder, ActiveDatabase);
|
var entityBuilder = new EventRegistrationEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
responseEB.Drop();
|
entityBuilder.Drop();
|
||||||
var eventEB = new EventEntityBuilder(migrationBuilder, ActiveDatabase);
|
var entityBuilder2 = new EventResponseEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
eventEB.Drop();
|
entityBuilder2.Drop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
var entityBuilder = new EventEntityBuilder(migrationBuilder, ActiveDatabase);
|
|
||||||
entityBuilder.DropColumn("Description"); // RichTextEditor
|
|
||||||
entityBuilder.DropColumn("EventDate"); // DateTime
|
|
||||||
entityBuilder.DropColumn("Location"); // Location 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,29 +7,29 @@ using Oqtane.Migrations.EntityBuilders;
|
|||||||
|
|
||||||
namespace SZUAbsolventenverein.Module.EventRegistration.Migrations.EntityBuilders
|
namespace SZUAbsolventenverein.Module.EventRegistration.Migrations.EntityBuilders
|
||||||
{
|
{
|
||||||
public class EventEntityBuilder : AuditableBaseEntityBuilder<EventEntityBuilder>
|
public class EventRegistrationEntityBuilder : AuditableBaseEntityBuilder<EventRegistrationEntityBuilder>
|
||||||
{
|
{
|
||||||
private const string _entityTableName = "SZUAbsolventenvereinEvent";
|
private const string _entityTableName = "SZUAbsolventenvereinEvent";
|
||||||
private readonly PrimaryKey<EventEntityBuilder> _primaryKey = new("PK_SZUAbsolventenvereinEvent", x => x.EventId);
|
private readonly PrimaryKey<EventRegistrationEntityBuilder> _primaryKey = new("PK_SZUAbsolventenvereinEvent", x => x.EventRegistrationId);
|
||||||
private readonly ForeignKey<EventEntityBuilder> _moduleForeignKey = new("FK_SZUAbsolventenvereinEvent_Module", x => x.ModuleId, "Module", "ModuleId", ReferentialAction.Cascade);
|
private readonly ForeignKey<EventRegistrationEntityBuilder> _moduleForeignKey = new("FK_SZUAbsolventenvereinEvent_Module", x => x.ModuleId, "Module", "ModuleId", ReferentialAction.Cascade);
|
||||||
|
|
||||||
public EventEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
public EventRegistrationEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||||
{
|
{
|
||||||
EntityTableName = _entityTableName;
|
EntityTableName = _entityTableName;
|
||||||
PrimaryKey = _primaryKey;
|
PrimaryKey = _primaryKey;
|
||||||
ForeignKeys.Add(_moduleForeignKey);
|
ForeignKeys.Add(_moduleForeignKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override EventEntityBuilder BuildTable(ColumnsBuilder table)
|
protected override EventRegistrationEntityBuilder BuildTable(ColumnsBuilder table)
|
||||||
{
|
{
|
||||||
EventId = AddAutoIncrementColumn(table,"EventId");
|
EventRegistrationId = AddAutoIncrementColumn(table,"EventRegistrationId");
|
||||||
ModuleId = AddIntegerColumn(table,"ModuleId");
|
ModuleId = AddIntegerColumn(table,"ModuleId");
|
||||||
Name = AddMaxStringColumn(table,"Name");
|
Name = AddMaxStringColumn(table,"Name");
|
||||||
AddAuditableColumns(table);
|
AddAuditableColumns(table);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> EventId { get; set; }
|
public OperationBuilder<AddColumnOperation> EventRegistrationId { get; set; }
|
||||||
public OperationBuilder<AddColumnOperation> ModuleId { get; set; }
|
public OperationBuilder<AddColumnOperation> ModuleId { get; set; }
|
||||||
public OperationBuilder<AddColumnOperation> Name { get; set; }
|
public OperationBuilder<AddColumnOperation> Name { get; set; }
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Migrations.EntityBuilder
|
|||||||
private const string _entityTableName = "SZUAbsolventenvereinEventResponse";
|
private const string _entityTableName = "SZUAbsolventenvereinEventResponse";
|
||||||
private readonly PrimaryKey<EventResponseEntityBuilder> _primaryKey = new("PK_SZUAbsolventenvereinEventResponse", x => x.EventResponseId);
|
private readonly PrimaryKey<EventResponseEntityBuilder> _primaryKey = new("PK_SZUAbsolventenvereinEventResponse", x => x.EventResponseId);
|
||||||
private readonly ForeignKey<EventResponseEntityBuilder> _moduleForeignKey = new("FK_SZUAbsolventenvereinEventResponse_Module", x => x.ModuleId, "Module", "ModuleId", ReferentialAction.Cascade);
|
private readonly ForeignKey<EventResponseEntityBuilder> _moduleForeignKey = new("FK_SZUAbsolventenvereinEventResponse_Module", x => x.ModuleId, "Module", "ModuleId", ReferentialAction.Cascade);
|
||||||
private readonly ForeignKey<EventResponseEntityBuilder> _eventForeignKey = new("FK_SZUAbsolventenvereinEventResponse_Event", x => x.EventRegistrationId, "SZUAbsolventenvereinEvent", "EventId", ReferentialAction.Cascade);
|
private readonly ForeignKey<EventResponseEntityBuilder> _eventForeignKey = new("FK_SZUAbsolventenvereinEventResponse_Event", x => x.EventRegistrationId, "SZUAbsolventenvereinEvent", "EventRegistrationId", ReferentialAction.Cascade);
|
||||||
private readonly ForeignKey<EventResponseEntityBuilder> _ownerForeignKey = new("FK_SZUAbsolventenvereinEventResponse_User_Owner", x => x.OwnerId, "User", "UserId", ReferentialAction.Cascade);
|
private readonly ForeignKey<EventResponseEntityBuilder> _ownerForeignKey = new("FK_SZUAbsolventenvereinEventResponse_User_Owner", x => x.OwnerId, "User", "UserId", ReferentialAction.Cascade);
|
||||||
|
|
||||||
public EventResponseEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
public EventResponseEntityBuilder(MigrationBuilder migrationBuilder, IDatabase database) : base(migrationBuilder, database)
|
||||||
|
@ -5,27 +5,27 @@ using Oqtane.Modules;
|
|||||||
|
|
||||||
namespace SZUAbsolventenverein.Module.EventRegistration.Repository
|
namespace SZUAbsolventenverein.Module.EventRegistration.Repository
|
||||||
{
|
{
|
||||||
public class EventRepository : IEventRepository, ITransientService
|
public class EventRegistrationRepository : IEventRegistrationRepository, ITransientService
|
||||||
{
|
{
|
||||||
private readonly IDbContextFactory<EventRegistrationContext> _factory;
|
private readonly IDbContextFactory<EventRegistrationContext> _factory;
|
||||||
|
|
||||||
public EventRepository(IDbContextFactory<EventRegistrationContext> factory)
|
public EventRegistrationRepository(IDbContextFactory<EventRegistrationContext> factory)
|
||||||
{
|
{
|
||||||
_factory = factory;
|
_factory = factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Models.Event> GetEvents(int ModuleId)
|
public IEnumerable<Models.Event> GetEventRegistrations(int ModuleId)
|
||||||
{
|
{
|
||||||
using var db = _factory.CreateDbContext();
|
using var db = _factory.CreateDbContext();
|
||||||
return db.Event.Where(item => item.ModuleId == ModuleId).ToList();
|
return db.Event.Where(item => item.ModuleId == ModuleId).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Models.Event GetEvent(int EventRegistrationId)
|
public Models.Event GetEventRegistration(int EventRegistrationId)
|
||||||
{
|
{
|
||||||
return GetEvent(EventRegistrationId, true);
|
return GetEventRegistration(EventRegistrationId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Models.Event GetEvent(int EventRegistrationId, bool tracking)
|
public Models.Event GetEventRegistration(int EventRegistrationId, bool tracking)
|
||||||
{
|
{
|
||||||
using var db = _factory.CreateDbContext();
|
using var db = _factory.CreateDbContext();
|
||||||
if (tracking)
|
if (tracking)
|
||||||
@ -34,11 +34,11 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Repository
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return db.Event.AsNoTracking().FirstOrDefault(item => item.EventId == EventRegistrationId);
|
return db.Event.AsNoTracking().FirstOrDefault(item => item.EventRegistrationId == EventRegistrationId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Models.Event AddEvent(Models.Event EventRegistration)
|
public Models.Event AddEventRegistration(Models.Event EventRegistration)
|
||||||
{
|
{
|
||||||
using var db = _factory.CreateDbContext();
|
using var db = _factory.CreateDbContext();
|
||||||
db.Event.Add(EventRegistration);
|
db.Event.Add(EventRegistration);
|
||||||
@ -46,7 +46,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Repository
|
|||||||
return EventRegistration;
|
return EventRegistration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Models.Event UpdateEvent(Models.Event EventRegistration)
|
public Models.Event UpdateEventRegistration(Models.Event EventRegistration)
|
||||||
{
|
{
|
||||||
using var db = _factory.CreateDbContext();
|
using var db = _factory.CreateDbContext();
|
||||||
db.Entry(EventRegistration).State = EntityState.Modified;
|
db.Entry(EventRegistration).State = EntityState.Modified;
|
||||||
@ -54,7 +54,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Repository
|
|||||||
return EventRegistration;
|
return EventRegistration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteEvent(int EventRegistrationId)
|
public void DeleteEventRegistration(int EventRegistrationId)
|
||||||
{
|
{
|
||||||
using var db = _factory.CreateDbContext();
|
using var db = _factory.CreateDbContext();
|
||||||
Models.Event EventRegistration = db.Event.Find(EventRegistrationId);
|
Models.Event EventRegistration = db.Event.Find(EventRegistrationId);
|
15
Server/Repository/IEventRegistrationRepository.cs
Normal file
15
Server/Repository/IEventRegistrationRepository.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SZUAbsolventenverein.Module.EventRegistration.Repository
|
||||||
|
{
|
||||||
|
public interface IEventRegistrationRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Models.Event> 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);
|
||||||
|
}
|
||||||
|
}
|
@ -1,15 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace SZUAbsolventenverein.Module.EventRegistration.Repository
|
|
||||||
{
|
|
||||||
public interface IEventRepository
|
|
||||||
{
|
|
||||||
IEnumerable<Models.Event> 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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using SZUAbsolventenverein.Module.EventRegistration.Models;
|
|
||||||
|
|
||||||
namespace SZUAbsolventenverein.Module.EventRegistration.Repository
|
|
||||||
{
|
|
||||||
public interface IResponseRepository
|
|
||||||
{
|
|
||||||
IEnumerable<Response> GetResponses(int ModuleId);
|
|
||||||
IEnumerable<Response> 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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,89 +0,0 @@
|
|||||||
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<EventRegistrationContext> _factory;
|
|
||||||
|
|
||||||
public ResponseRepository(IDbContextFactory<EventRegistrationContext> factory)
|
|
||||||
{
|
|
||||||
_factory = factory;
|
|
||||||
}
|
|
||||||
public IEnumerable<Response> GetResponses(int ModuleId)
|
|
||||||
{
|
|
||||||
using var db = _factory.CreateDbContext();
|
|
||||||
return db.Response.Where(item => item.ModuleId == ModuleId).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Response> 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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,10 +19,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.3" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.3" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.3" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.5" />
|
<PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -3,186 +3,44 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Oqtane.Enums;
|
using Oqtane.Enums;
|
||||||
using Oqtane.Extensions;
|
|
||||||
using Oqtane.Infrastructure;
|
using Oqtane.Infrastructure;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
using Oqtane.Repository;
|
|
||||||
using Oqtane.Security;
|
using Oqtane.Security;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using SZUAbsolventenverein.Module.EventRegistration.Models;
|
|
||||||
using SZUAbsolventenverein.Module.EventRegistration.Repository;
|
using SZUAbsolventenverein.Module.EventRegistration.Repository;
|
||||||
|
|
||||||
namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
||||||
{
|
{
|
||||||
public class ServerEventRegistrationService : IEventRegistrationService
|
public class ServerEventRegistrationService : IEventRegistrationService
|
||||||
{
|
{
|
||||||
private readonly IEventRepository _EventRepository;
|
private readonly IEventRegistrationRepository _EventRegistrationRepository;
|
||||||
private readonly IResponseRepository _ResponseRepository;
|
|
||||||
private readonly INotificationRepository _NotificationRepository;
|
|
||||||
private readonly IUserRepository _UserRepository;
|
|
||||||
private readonly IUserPermissions _userPermissions;
|
private readonly IUserPermissions _userPermissions;
|
||||||
private readonly ILogManager _logger;
|
private readonly ILogManager _logger;
|
||||||
private readonly IHttpContextAccessor _accessor;
|
private readonly IHttpContextAccessor _accessor;
|
||||||
private readonly Alias _alias;
|
private readonly Alias _alias;
|
||||||
|
|
||||||
public ServerEventRegistrationService(IEventRepository EventRepository, IResponseRepository ResponseRepository, INotificationRepository NotificationRepository, IUserRepository UserRepository, IUserPermissions userPermissions, ITenantManager tenantManager, ILogManager logger, IHttpContextAccessor accessor)
|
public ServerEventRegistrationService(IEventRegistrationRepository EventRegistrationRepository, IUserPermissions userPermissions, ITenantManager tenantManager, ILogManager logger, IHttpContextAccessor accessor)
|
||||||
{
|
{
|
||||||
_EventRepository = EventRepository;
|
_EventRegistrationRepository = EventRegistrationRepository;
|
||||||
_ResponseRepository = ResponseRepository;
|
|
||||||
_NotificationRepository = NotificationRepository;
|
|
||||||
_UserRepository = UserRepository;
|
|
||||||
_userPermissions = userPermissions;
|
_userPermissions = userPermissions;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_accessor = accessor;
|
_accessor = accessor;
|
||||||
_alias = tenantManager.GetAlias();
|
_alias = tenantManager.GetAlias();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<Event> AddEventAsync(Event NewEvent)
|
public Task<List<Models.Event>> GetEventRegistrationsAsync(int ModuleId)
|
||||||
{
|
|
||||||
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, NewEvent.ModuleId, PermissionNames.Edit))
|
|
||||||
{
|
|
||||||
NewEvent = _EventRepository.AddEvent(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<Response> AddResponseAsync(Response Response)
|
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
|
||||||
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Add Attempt {NewEvent}", Response);
|
|
||||||
Response = null;
|
|
||||||
}
|
|
||||||
return Task.FromResult(Response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<Response> UpdateResponseAsync(Response Response)
|
|
||||||
{
|
|
||||||
|
|
||||||
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
|
|
||||||
{
|
|
||||||
_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))
|
|
||||||
{
|
|
||||||
_EventRepository.DeleteEvent(EventId);
|
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Event Deleted {EventId}", EventId);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Event Delete Attempt {EventId} {ModuleId}", EventId, ModuleId);
|
|
||||||
}
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<Event> GetEventAsync(int EventId, int ModuleId)
|
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View))
|
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View))
|
||||||
{
|
{
|
||||||
return Task.FromResult(_EventRepository.GetEvent(EventId, true));
|
return Task.FromResult(_EventRegistrationRepository.GetEventRegistrations(ModuleId).ToList());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Event Get Attempt {ModuleId}", ModuleId);
|
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Get Attempt {ModuleId}", ModuleId);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<(Event, Response)> GetEventDetails(int EventId, int ModuleId)
|
|
||||||
{
|
|
||||||
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<List<Response>> 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();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<List<Event>> GetEventsAsync(int ModuleId)
|
|
||||||
{
|
|
||||||
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View))
|
|
||||||
{
|
|
||||||
return Task.FromResult(_EventRepository.GetEvents(ModuleId).ToList());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Events Get Attempt {ModuleId}", ModuleId);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<Event> UpdateEventAsync(Event NewEvent)
|
|
||||||
{
|
|
||||||
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, NewEvent.ModuleId, PermissionNames.Edit))
|
|
||||||
{
|
|
||||||
NewEvent = _EventRepository.UpdateEvent(NewEvent);
|
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Event Updated {NewEvent}", NewEvent);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_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<Models.Event> GetEventRegistrationAsync(int EventRegistrationId, int ModuleId)
|
public Task<Models.Event> GetEventRegistrationAsync(int EventRegistrationId, int ModuleId)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View))
|
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View))
|
||||||
@ -226,13 +84,18 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
|||||||
return Task.FromResult(EventRegistration);
|
return Task.FromResult(EventRegistration);
|
||||||
}
|
}
|
||||||
|
|
||||||
}*/
|
public Task DeleteEventRegistrationAsync(int EventRegistrationId, int ModuleId)
|
||||||
|
|
||||||
private void SendEventResponseNotification(string subject, string body)
|
|
||||||
{
|
{
|
||||||
User user = _UserRepository.GetUser(_accessor.HttpContext.User.UserId());
|
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.Edit))
|
||||||
Notification notification = new Notification(_alias.SiteId, user, subject, body);
|
{
|
||||||
_NotificationRepository.AddNotification(notification);
|
_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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,18 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SZUAbsolventenverein.Module.EventRegistration.Models;
|
|
||||||
|
|
||||||
namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
||||||
{
|
{
|
||||||
public interface IEventRegistrationService
|
public interface IEventRegistrationService
|
||||||
{
|
{
|
||||||
/* Reine Events */
|
Task<List<Models.Event>> GetEventRegistrationsAsync(int ModuleId);
|
||||||
Task<List<Event>> GetEventsAsync(int ModuleId);
|
|
||||||
Task<Event> GetEventAsync(int EventId, int ModuleId);
|
|
||||||
|
|
||||||
Task<Event> AddEventAsync(Event NewEvent);
|
Task<Models.Event> GetEventRegistrationAsync(int EventRegistrationId, int ModuleId);
|
||||||
|
|
||||||
Task<Event> UpdateEventAsync(Event NewEvent);
|
Task<Models.Event> AddEventRegistrationAsync(Models.Event EventRegistration);
|
||||||
|
|
||||||
Task DeleteEventAsync(int EventId, int ModuleId);
|
Task<Models.Event> UpdateEventRegistrationAsync(Models.Event EventRegistration);
|
||||||
|
|
||||||
|
Task DeleteEventRegistrationAsync(int EventRegistrationId, int ModuleId);
|
||||||
/* Events & Responses */
|
|
||||||
Task<Response> AddResponseAsync(Response Response);
|
|
||||||
|
|
||||||
Task<Response> UpdateResponseAsync(Response Response);
|
|
||||||
|
|
||||||
Task<(Event, Response)> GetEventDetails(int EventId, int ModuleId);
|
|
||||||
|
|
||||||
Task<List<Response>> GetEventResponses(int EventId, int ModuleId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,10 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Models
|
|||||||
public class Event : IAuditable
|
public class Event : IAuditable
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
public int EventId { get; set; }
|
public int EventRegistrationId { get; set; }
|
||||||
public int ModuleId { get; set; }
|
public int ModuleId { get; set; }
|
||||||
public string Name { 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 string CreatedBy { get; set; }
|
||||||
public DateTime CreatedOn { get; set; }
|
public DateTime CreatedOn { get; set; }
|
||||||
public string ModifiedBy { get; set; }
|
public string ModifiedBy { get; set; }
|
||||||
|
@ -14,6 +14,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Models
|
|||||||
public int OwnerId { get; set; }
|
public int OwnerId { get; set; }
|
||||||
public int EventRegistrationId { get; set; }
|
public int EventRegistrationId { get; set; }
|
||||||
public int ModuleId { get; set; }
|
public int ModuleId { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
public string CreatedBy { get; set; }
|
public string CreatedBy { get; set; }
|
||||||
public DateTime CreatedOn { get; set; }
|
public DateTime CreatedOn { get; set; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user