Dendency injection sorce abstraction implemented
This commit is contained in:
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user