Dendency injection sorce abstraction implemented

This commit is contained in:
Stoyan Zlatev
2023-06-21 09:50:18 +02:00
parent 218099f61c
commit a9089911be
42 changed files with 235 additions and 189 deletions
@@ -60,5 +60,17 @@
WHERE [Function] IN ({string.Join(", ", functions.Select(x => $"'{x}'"))})")
.SetParameter(nameof(employeeId), employeeId)
.ExecuteNonQuery();
public IEnumerable<KeyValuePair<short, int>> UserFunctionsCount()
=> this.sqlConnection
.CreateCommand($@"
SELECT DISTINCT
[UF].[UserId] AS [EmployeeId]
, COUNT([SF].[Function]) AS [Functions]
FROM [UsersFunctions] AS [UF]
JOIN [SoftwareFunctions] AS [SF]
ON [SF].[Id] = [UF].[SoftwareFunctionId]
GROUP BY [UF].[UserId]")
.ExecuteReader(x => new KeyValuePair<short, int>(x.GetSmallint(), x.GetInt()));
}
}