public Dictionary<string, int> GetNumberOfEmployeesInEachGroup()
{
Dictionary<string, int> result = new Dictionary<string, int>();
SqlConnection connection = new SqlConnection(_connectionString);
SqlCommand command = new SqlCommand("SELECT IE.EmployeeID, G.Code FROM Intern_CoyoteMoves.dbo.InternalEmployee as IE LEFT JOIN Intern_CoyoteMoves.dbo.GroupType as G on G.GroupTypeID=IE.[Group]");
command.Connection = connection;
connection.Open();
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
if (reader["Code"] != System.DBNull.Value)
{
if (result.ContainsKey((string)reader["Code"]) == false)
{
result[((string)reader["Code"])] = 1;
}
else
{
result[((string)reader["Code"])]++;
}
}
else
{
if (result.ContainsKey("NULL"))
{
result["NULL"]++;
}
else
{
result["NULL"] = 1;
}
}
}
return result;
}