37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
namespace LaaProduction.Personalization.Repositories
|
|
{
|
|
using LaaProduction.Personalization.Repositories.Interfaces;
|
|
|
|
using LaaProductionSQL.Interfaces;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
internal class SoftwareRepository : ISoftwareRepository
|
|
{
|
|
private readonly ISQLConnection sqlConnection;
|
|
|
|
public SoftwareRepository(ISQLConnection sqlConnection)
|
|
=> this.sqlConnection = sqlConnection;
|
|
|
|
public short AppId(string software)
|
|
=> this.sqlConnection
|
|
.CreateCommand($@"
|
|
SELECT [AppID]
|
|
FROM [VersionSoftwareAccess]
|
|
WHERE [SoftwareAccess_Program] = @{nameof(software)}")
|
|
.SetParameter(nameof(software), software)
|
|
.FirstOrDefault(x => x.GetSmallint());
|
|
|
|
public IEnumerable<string> GetSoftwareFunctions(string token)
|
|
=> this.sqlConnection
|
|
.CreateCommand($@"
|
|
SELECT [SF].[Function]
|
|
FROM [MitarbeiterTokens] AS [MT]
|
|
JOIN [SoftwareFunctions] AS [SF]
|
|
ON [SF].[AppId] = [MT].[AppId]
|
|
WHERE [MT].[Token] = @{nameof(token)}")
|
|
.SetParameter(nameof(token), token)
|
|
.ExecuteReader(x => x.GetString());
|
|
}
|
|
}
|