Compare commits
4 Commits
ten-recomm
...
e22d360425
| Author | SHA1 | Date | |
|---|---|---|---|
| e22d360425 | |||
| 1c32640c78 | |||
| cb1c94f43c | |||
| bbcc755b82 |
@@ -1,23 +0,0 @@
|
|||||||
@inject FileService fileService
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<img src=@profilePictureUrl />
|
|
||||||
<h4>@user.DisplayName</h4>
|
|
||||||
<p>@user.Settings["Jahrgang"] - @user.Settings["Fachrichtung"]</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@code {
|
|
||||||
[Parameter]
|
|
||||||
public User user { get; set; }
|
|
||||||
|
|
||||||
private string profilePictureUrl = "";
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
if(user.PhotoFileId != null)
|
|
||||||
{
|
|
||||||
File f = await fileService.GetFileAsync(user.PhotoFileId);
|
|
||||||
profilePictureUrl = f.Url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
@using SZUAbsolventenverein.Module.EventRegistration.Services
|
@using SZUAbsolventenverein.Module.EventRegistration.Services
|
||||||
@using SZUAbsolventenverein.Module.EventRegistration.Models
|
@using SZUAbsolventenverein.Module.EventRegistration.Models
|
||||||
@using System.Text.RegularExpressions
|
@using System.Text.RegularExpressions
|
||||||
@using SZUAbsolventenverein.Module.EventRegistration.Client.Components
|
|
||||||
|
|
||||||
@namespace SZUAbsolventenverein.Module.EventRegistration
|
@namespace SZUAbsolventenverein.Module.EventRegistration
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@@ -32,23 +31,19 @@
|
|||||||
@if (Status == true)
|
@if (Status == true)
|
||||||
{
|
{
|
||||||
<span class ="fontsizeInf">@Localizer["Zugesagt"]</span><br />
|
<span class ="fontsizeInf">@Localizer["Zugesagt"]</span><br />
|
||||||
<p><button class="btn btn-danger" @onclick="Reject">@Localizer["Absagen"]</button></p>
|
<p><button class="btn btn-danger" @onclick="Absage">@Localizer["Absagen"]</button></p>
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
<span class="fontsizeInf"> @Localizer["Abgesagt"]</span><br />
|
<span class="fontsizeInf"> @Localizer["Abgesagt"]</span><br />
|
||||||
<p><button class="btn btn-success" @onclick="Accept">@Localizer["Zusagen"]</button></p>
|
<p><button class="btn btn-success" @onclick="Zusage">@Localizer["Zusagen"]</button></p>
|
||||||
}
|
}
|
||||||
</p>
|
</p>
|
||||||
} else {
|
} else {
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<button class="btn btn-success" @onclick="Accept">@Localizer["Zusagen"]</button>
|
<button class="btn btn-success" @onclick="Zusage">@Localizer["Zusagen"]</button>
|
||||||
<button class="btn btn-danger" @onclick="Reject">@Localizer["Absagen"]</button>
|
<button class="btn btn-danger" @onclick="Absage">@Localizer["Absagen"]</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@foreach (User u in _users)
|
|
||||||
{
|
|
||||||
<UserComponent user="u" />
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
<p class="mt-3">Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.</p>
|
<p class="mt-3">Um dich für dieses Event zu registrieren, muss man sich zuerst anmelden.</p>
|
||||||
@@ -70,6 +65,9 @@
|
|||||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }
|
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// private ElementReference form;
|
||||||
|
// private bool validated = false;
|
||||||
|
|
||||||
private int _id;
|
private int _id;
|
||||||
private string _name;
|
private string _name;
|
||||||
private string _description;
|
private string _description;
|
||||||
@@ -82,8 +80,6 @@
|
|||||||
private List<Profile> _profiles = new List<Profile>();
|
private List<Profile> _profiles = new List<Profile>();
|
||||||
private Dictionary<string, string> _settings;
|
private Dictionary<string, string> _settings;
|
||||||
|
|
||||||
private List<User> _users = new List<User>();
|
|
||||||
|
|
||||||
private async Task SendResponse(bool response)
|
private async Task SendResponse(bool response)
|
||||||
{
|
{
|
||||||
if(ValidateProfiles()) {
|
if(ValidateProfiles()) {
|
||||||
@@ -111,12 +107,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Accept()
|
private async void Zusage()
|
||||||
{
|
{
|
||||||
await SendResponse(true);
|
await SendResponse(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Reject()
|
private async void Absage()
|
||||||
{
|
{
|
||||||
await SendResponse(false);
|
await SendResponse(false);
|
||||||
}
|
}
|
||||||
@@ -125,8 +121,6 @@
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_id = Int32.Parse(PageState.QueryString["id"]);
|
|
||||||
|
|
||||||
if(PageState.User != null) {
|
if(PageState.User != null) {
|
||||||
_profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId);
|
_profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId);
|
||||||
var user = await UserService.GetUserAsync(PageState.User.UserId, PageState.Site.SiteId);
|
var user = await UserService.GetUserAsync(PageState.User.UserId, PageState.Site.SiteId);
|
||||||
@@ -134,10 +128,10 @@
|
|||||||
{
|
{
|
||||||
_settings = user.Settings;
|
_settings = user.Settings;
|
||||||
}
|
}
|
||||||
_users = await EventRegistrationService.GetRecommendedResponses(_id, ModuleState.ModuleId);
|
|
||||||
_users.ForEach(u => Console.WriteLine(u.UserId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_id = Int32.Parse(PageState.QueryString["id"]);
|
||||||
|
|
||||||
Event currentEvent;
|
Event currentEvent;
|
||||||
Response rsvp;
|
Response rsvp;
|
||||||
(currentEvent, rsvp) = await EventRegistrationService.GetEventDetails(_id, ModuleState.ModuleId);
|
(currentEvent, rsvp) = await EventRegistrationService.GetEventDetails(_id, ModuleState.ModuleId);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.0</Version>
|
||||||
<Authors>SZUAbsolventenverein</Authors>
|
<Authors>SZUAbsolventenverein</Authors>
|
||||||
<Company>SZUAbsolventenverein</Company>
|
<Company>SZUAbsolventenverein</Company>
|
||||||
@@ -13,11 +13,11 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="9.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.9" />
|
<PackageReference Include="Microsoft.Extensions.Localization" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.9" />
|
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.1" />
|
||||||
<PackageReference Include="System.Net.Http.Json" Version="9.0.9" />
|
<PackageReference Include="System.Net.Http.Json" Version="10.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System.Linq;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Oqtane.Models;
|
|
||||||
using Oqtane.Services;
|
using Oqtane.Services;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using SZUAbsolventenverein.Module.EventRegistration.Models;
|
using SZUAbsolventenverein.Module.EventRegistration.Models;
|
||||||
@@ -16,6 +15,27 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
|||||||
|
|
||||||
private string Apiurl => CreateApiUrl("EventRegistration");
|
private string Apiurl => CreateApiUrl("EventRegistration");
|
||||||
|
|
||||||
|
/*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());
|
||||||
|
return EventRegistrations.OrderBy(item => item.Name).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Models.Event> GetEventRegistrationAsync(int EventRegistrationId, int ModuleId)
|
||||||
|
{
|
||||||
|
return await GetJsonAsync<Models.Event>(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventRegistrationId}/{ModuleId}", EntityNames.Module, ModuleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Models.Event> AddEventRegistrationAsync(Models.Event EventRegistration)
|
||||||
|
{
|
||||||
|
return await PostJsonAsync<Models.Event>(CreateAuthorizationPolicyUrl($"{Apiurl}", EntityNames.Module, EventRegistration.ModuleId), EventRegistration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Models.Event> UpdateEventRegistrationAsync(Models.Event EventRegistration)
|
||||||
|
{
|
||||||
|
return await PutJsonAsync<Models.Event>(CreateAuthorizationPolicyUrl($"{Apiurl}/{EventRegistration.EventRegistrationId}", EntityNames.Module, EventRegistration.ModuleId), EventRegistration);
|
||||||
|
}*/
|
||||||
|
|
||||||
public async Task<List<Event>> GetEventsAsync(int ModuleId)
|
public async Task<List<Event>> GetEventsAsync(int ModuleId)
|
||||||
{
|
{
|
||||||
List<Event> EventRegistrations = await GetJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", EntityNames.Module, ModuleId), Enumerable.Empty<Event>().ToList());
|
List<Event> EventRegistrations = await GetJsonAsync(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", EntityNames.Module, ModuleId), Enumerable.Empty<Event>().ToList());
|
||||||
@@ -60,10 +80,5 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
|||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<List<User>> GetRecommendedResponses(int EventId, int ModuleId)
|
|
||||||
{
|
|
||||||
throw new System.NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||||
<AccelerateBuildsInVisualStudio>false</AccelerateBuildsInVisualStudio>
|
<AccelerateBuildsInVisualStudio>false</AccelerateBuildsInVisualStudio>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
TargetFramework=$1
|
TargetFramework=$1
|
||||||
ProjectName=$2
|
ProjectName=$2
|
||||||
|
|
||||||
cp -f "../Client/bin/Debug/$TargetFramework/$ProjectName.Client.Oqtane.dll" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/"
|
cp -f "../Client/bin/Debug/$TargetFramework/$ProjectName$.Client.Oqtane.dll" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/"
|
||||||
cp -f "../Client/bin/Debug/$TargetFramework/$ProjectName.Client.Oqtane.pdb" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/"
|
cp -f "../Client/bin/Debug/$TargetFramework/$ProjectName$.Client.Oqtane.pdb" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/"
|
||||||
cp -f "../Server/bin/Debug/$TargetFramework/$ProjectName.Server.Oqtane.dll" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/"
|
cp -f "../Server/bin/Debug/$TargetFramework/$ProjectName$.Server.Oqtane.dll" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/"
|
||||||
cp -f "../Server/bin/Debug/$TargetFramework/$ProjectName.Server.Oqtane.pdb" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/"
|
cp -f "../Server/bin/Debug/$TargetFramework/$ProjectName$.Server.Oqtane.pdb" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/"
|
||||||
cp -f "../Shared/bin/Debug/$TargetFramework/$ProjectName.Shared.Oqtane.dll" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/"
|
cp -f "../Shared/bin/Debug/$TargetFramework/$ProjectName$.Shared.Oqtane.dll" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/"
|
||||||
cp -f "../Shared/bin/Debug/$TargetFramework/$ProjectName.Shared.Oqtane.pdb" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/"
|
cp -f "../Shared/bin/Debug/$TargetFramework/$ProjectName$.Shared.Oqtane.pdb" "../../oqtane.framework/Oqtane.Server/bin/Debug/$TargetFramework/"
|
||||||
cp -rf "../Server/wwwroot/"* "../../oqtane.framework/Oqtane.Server/wwwroot/"
|
cp -rf "../Server/wwwroot/"* "../../oqtane.framework/Oqtane.Server/wwwroot/"
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
TargetFramework=$1
|
TargetFramework=$1
|
||||||
ProjectName=$2
|
ProjectName=$2
|
||||||
|
|
||||||
"..\..\oqtane.framework\oqtane.package\nuget.exe" pack %ProjectName%.nuspec -Properties targetframework=%TargetFramework%;projectname=%ProjectName%
|
find . -name *.nupkg -delete
|
||||||
cp -f "*.nupkg" "..\..\oqtane.framework\Oqtane.Server\Packages\"
|
dotnet run --project ../../fixProps/FixProps/FixProps.csproj
|
||||||
|
nuget pack $ProjectName.nuspec -Properties "targetframework=${TargetFramework};ProjectName=${ProjectName}"
|
||||||
|
cp -f *.nupkg ../../oqtane.framework/Oqtane.Server/Packages/
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio Version 17
|
|
||||||
VisualStudioVersion = 17.13.35828.75 d17.13
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Oqtane.Server", "..\oqtane.framework\Oqtane.Server\Oqtane.Server.csproj", "{3AB6FCC9-EFEB-4C0E-A2CF-8103914C5196}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SZUAbsolventenverein.Module.EventRegistration.Client", "Client\SZUAbsolventenverein.Module.EventRegistration.Client.csproj", "{AA8E58A1-CD09-4208-BF66-A8BB341FD669}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SZUAbsolventenverein.Module.EventRegistration.Server", "Server\SZUAbsolventenverein.Module.EventRegistration.Server.csproj", "{04B05448-788F-433D-92C0-FED35122D45A}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SZUAbsolventenverein.Module.EventRegistration.Shared", "Shared\SZUAbsolventenverein.Module.EventRegistration.Shared.csproj", "{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SZUAbsolventenverein.Module.EventRegistration.Package", "Package\SZUAbsolventenverein.Module.EventRegistration.Package.csproj", "{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{3AB6FCC9-EFEB-4C0E-A2CF-8103914C5196}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{3AB6FCC9-EFEB-4C0E-A2CF-8103914C5196}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{AA8E58A1-CD09-4208-BF66-A8BB341FD669}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{AA8E58A1-CD09-4208-BF66-A8BB341FD669}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{AA8E58A1-CD09-4208-BF66-A8BB341FD669}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{AA8E58A1-CD09-4208-BF66-A8BB341FD669}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{04B05448-788F-433D-92C0-FED35122D45A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{04B05448-788F-433D-92C0-FED35122D45A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{04B05448-788F-433D-92C0-FED35122D45A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{04B05448-788F-433D-92C0-FED35122D45A}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {1D016F15-46FE-4726-8DFD-2E4FD4DC7668}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
9
SZUAbsolventenverein.Module.EventRegistration.slnx
Normal file
9
SZUAbsolventenverein.Module.EventRegistration.slnx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<Solution>
|
||||||
|
<Project Path="../oqtane.framework/Oqtane.Server/Oqtane.Server.csproj">
|
||||||
|
<Build Project="false" />
|
||||||
|
</Project>
|
||||||
|
<Project Path="Client/SZUAbsolventenverein.Module.EventRegistration.Client.csproj" />
|
||||||
|
<Project Path="Package/SZUAbsolventenverein.Module.EventRegistration.Package.csproj" />
|
||||||
|
<Project Path="Server/SZUAbsolventenverein.Module.EventRegistration.Server.csproj" />
|
||||||
|
<Project Path="Shared/SZUAbsolventenverein.Module.EventRegistration.Shared.csproj" />
|
||||||
|
</Solution>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.0</Version>
|
||||||
<Product>SZUAbsolventenverein.Module.EventRegistration</Product>
|
<Product>SZUAbsolventenverein.Module.EventRegistration</Product>
|
||||||
@@ -19,10 +19,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.9" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.9" />
|
<PackageReference Include="Microsoft.Extensions.Localization" Version="10.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Oqtane.Enums;
|
using Oqtane.Enums;
|
||||||
@@ -25,10 +23,9 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
|||||||
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 ISettingRepository _settingRepository;
|
|
||||||
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, ISettingRepository settingRepository)
|
public ServerEventRegistrationService(IEventRepository EventRepository, IResponseRepository ResponseRepository, INotificationRepository NotificationRepository, IUserRepository UserRepository, IUserPermissions userPermissions, ITenantManager tenantManager, ILogManager logger, IHttpContextAccessor accessor)
|
||||||
{
|
{
|
||||||
_EventRepository = EventRepository;
|
_EventRepository = EventRepository;
|
||||||
_ResponseRepository = ResponseRepository;
|
_ResponseRepository = ResponseRepository;
|
||||||
@@ -37,7 +34,6 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
|||||||
_userPermissions = userPermissions;
|
_userPermissions = userPermissions;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_accessor = accessor;
|
_accessor = accessor;
|
||||||
_settingRepository = settingRepository;
|
|
||||||
_alias = tenantManager.GetAlias();
|
_alias = tenantManager.GetAlias();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,32 +148,7 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
|||||||
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Event Response Get Attempt {ModuleId}", ModuleId);
|
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Event Response Get Attempt {ModuleId}", ModuleId);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
throw new System.NotImplementedException();
|
||||||
|
|
||||||
public async Task<List<User>> GetRecommendedResponses(int EventId, int ModuleId)
|
|
||||||
{
|
|
||||||
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View))
|
|
||||||
{
|
|
||||||
IEnumerable<Response> responses = _ResponseRepository.GetResponses(EventId, ModuleId).DistinctBy(r => r.OwnerId).Where(r => r.OwnerId != _accessor.HttpContext.User.UserId() && r.ResponseType);
|
|
||||||
IEnumerable<User> users = _UserRepository.GetUsers();
|
|
||||||
|
|
||||||
List<Setting> userSettings = _settingRepository.GetSettings("User").ToList();
|
|
||||||
|
|
||||||
List<Setting> requestorSettings = userSettings.FindAll(s => s.EntityId == _accessor.HttpContext.User.UserId());
|
|
||||||
string targetFachrichtung = requestorSettings.FirstOrDefault(s => s.SettingName == "Fachrichtung")?.SettingValue;
|
|
||||||
int targetStartjahr = int.Parse(requestorSettings.FirstOrDefault(s => s.SettingName == "Jahrgang")?.SettingValue ?? "0");
|
|
||||||
|
|
||||||
|
|
||||||
IEnumerable<GroupingUser> gu = responses.Join(users, r => r.OwnerId, u => u.UserId,
|
|
||||||
(response, user) => (response, user)).GroupJoin(userSettings, ru => ru.user.UserId,
|
|
||||||
s => s.EntityId, (ru, s) => new GroupingUser(ru.user, ru.response, s, targetStartjahr, targetFachrichtung)).OrderBy(gu => gu.Score());
|
|
||||||
return gu.Select(gu => gu.User).Take(10).ToList();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Event Response Get Attempt {ModuleId}", ModuleId);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<List<Event>> GetEventsAsync(int ModuleId)
|
public Task<List<Event>> GetEventsAsync(int ModuleId)
|
||||||
@@ -208,6 +179,55 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
|||||||
return Task.FromResult(NewEvent);
|
return Task.FromResult(NewEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Implement the methods for EventResponses
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
public Task<Models.Event> GetEventRegistrationAsync(int EventRegistrationId, int ModuleId)
|
||||||
|
{
|
||||||
|
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.View))
|
||||||
|
{
|
||||||
|
return Task.FromResult(_EventRegistrationRepository.GetEventRegistration(EventRegistrationId));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Get Attempt {EventRegistrationId} {ModuleId}", EventRegistrationId, ModuleId);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<Models.Event> AddEventRegistrationAsync(Models.Event EventRegistration)
|
||||||
|
{
|
||||||
|
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, EventRegistration.ModuleId, PermissionNames.Edit))
|
||||||
|
{
|
||||||
|
EventRegistration = _EventRegistrationRepository.AddEventRegistration(EventRegistration);
|
||||||
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "EventRegistration Added {EventRegistration}", EventRegistration);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Add Attempt {EventRegistration}", EventRegistration);
|
||||||
|
EventRegistration = null;
|
||||||
|
}
|
||||||
|
return Task.FromResult(EventRegistration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<Models.Event> UpdateEventRegistrationAsync(Models.Event EventRegistration)
|
||||||
|
{
|
||||||
|
if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, EventRegistration.ModuleId, PermissionNames.Edit))
|
||||||
|
{
|
||||||
|
EventRegistration = _EventRegistrationRepository.UpdateEventRegistration(EventRegistration);
|
||||||
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "EventRegistration Updated {EventRegistration}", EventRegistration);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized EventRegistration Update Attempt {EventRegistration}", EventRegistration);
|
||||||
|
EventRegistration = null;
|
||||||
|
}
|
||||||
|
return Task.FromResult(EventRegistration);
|
||||||
|
}
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
private void SendEventResponseNotification(string subject, string body)
|
private void SendEventResponseNotification(string subject, string body)
|
||||||
{
|
{
|
||||||
User user = _UserRepository.GetUser(_accessor.HttpContext.User.UserId());
|
User user = _UserRepository.GetUser(_accessor.HttpContext.User.UserId());
|
||||||
@@ -215,76 +235,4 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
|||||||
_NotificationRepository.AddNotification(notification);
|
_NotificationRepository.AddNotification(notification);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GroupingUser
|
|
||||||
{
|
|
||||||
private User _user;
|
|
||||||
private Response _response;
|
|
||||||
|
|
||||||
private string _fachrichtung;
|
|
||||||
private int _startjahr;
|
|
||||||
|
|
||||||
private int _targetyear;
|
|
||||||
private string _targetfachrichtung;
|
|
||||||
public User User { get { return _user; } }
|
|
||||||
|
|
||||||
public IEnumerable<Setting> Settings
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
_fachrichtung = "-";
|
|
||||||
_startjahr = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_fachrichtung = value.FirstOrDefault(v => v.SettingName == "Fachrichtung", new Setting(){SettingValue = "-"}).SettingValue;
|
|
||||||
_startjahr = int.Parse(value.FirstOrDefault(v => v.SettingName == "Jahrgang", new Setting(){SettingValue = "0"}).SettingValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string TargetFachrichtung
|
|
||||||
{
|
|
||||||
set { _targetfachrichtung = value; }
|
|
||||||
}
|
|
||||||
public int TargetJahr
|
|
||||||
{
|
|
||||||
set { _targetyear = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public GroupingUser(User user, Response response, IEnumerable<Setting> settings, int targetyear, string targetfachrichtung)
|
|
||||||
{
|
|
||||||
_user = user;
|
|
||||||
_response = response;
|
|
||||||
Settings = settings;
|
|
||||||
TargetJahr = targetyear;
|
|
||||||
TargetFachrichtung = targetfachrichtung;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Score()
|
|
||||||
{
|
|
||||||
int total = 0;
|
|
||||||
total += ScoreYear() * 5;
|
|
||||||
total += ScoreFachrichtung() * 3;
|
|
||||||
|
|
||||||
return total;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int ScoreYear()
|
|
||||||
{
|
|
||||||
return Math.Abs(_targetyear - _startjahr);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int ScoreFachrichtung()
|
|
||||||
{
|
|
||||||
if (_fachrichtung == _targetfachrichtung)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Oqtane.Models;
|
|
||||||
using SZUAbsolventenverein.Module.EventRegistration.Models;
|
using SZUAbsolventenverein.Module.EventRegistration.Models;
|
||||||
|
|
||||||
namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
||||||
@@ -27,6 +26,5 @@ namespace SZUAbsolventenverein.Module.EventRegistration.Services
|
|||||||
Task<(Event, Response)> GetEventDetails(int EventId, int ModuleId);
|
Task<(Event, Response)> GetEventDetails(int EventId, int ModuleId);
|
||||||
|
|
||||||
Task<List<Response>> GetEventResponses(int EventId, int ModuleId);
|
Task<List<Response>> GetEventResponses(int EventId, int ModuleId);
|
||||||
Task<List<User>> GetRecommendedResponses(int EventId, int ModuleId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.0</Version>
|
||||||
<Product>SZUAbsolventenverein.Module.EventRegistration</Product>
|
<Product>SZUAbsolventenverein.Module.EventRegistration</Product>
|
||||||
<Authors>SZUAbsolventenverein</Authors>
|
<Authors>SZUAbsolventenverein</Authors>
|
||||||
|
|||||||
Reference in New Issue
Block a user