employees
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user