Vereinsmeisterschaften  22aa7800eae54b428d40e835886cefe1fdefdfdf
This is a software that can be used to manage the internal competition of the swimming club Illertissen called "Vereinsmeisterschaften".
Loading...
Searching...
No Matches
AnalyticsModuleAgeDistribution.cs
4
6{
11 {
12 private IPersonService _personService;
13
19 {
20 _personService = personService;
21 }
22
24 public bool AnalyticsAvailable => _personService.PersonCount > 0;
25
29 public Dictionary<UInt16, int> NumberPersonsPerBirthYear => _personService.GetPersons()
30 .Where(p => p.IsActive)
31 .GroupBy(p => p.BirthYear)
32 .OrderBy(g => g.Key)
33 .ToDictionary(g => g.Key, g => g.Count());
34
37 {
38 DocXPlaceholderHelper.TextPlaceholders textPlaceholder = new DocXPlaceholderHelper.TextPlaceholders();
39 // Create a string for each dictionary entry including a ASCII diagramm (Format e.g.: Birth Year 2000: 3x | ###)
40 string moduleAgeDistributionString = string.Join(Environment.NewLine,
42 .Select(kv => $"{Properties.Resources.BirthYearString} {kv.Key}: {kv.Value.ToString().PadLeft(2)}x | {new string('#', kv.Value)}"));
43 foreach (string placeholder in Placeholders.Placeholders_AnalyticsAgeDistribution) { textPlaceholder.Add(placeholder, moduleAgeDistributionString); }
44 return textPlaceholder;
45 }
46
48 public List<string> SupportedDocumentPlaceholderKeys => new List<string>()
49 {
50 Placeholders.PLACEHOLDER_KEY_ANALYTICS_AGE_DISTRIBUTION
51 };
52 }
53}
DocXPlaceholderHelper.TextPlaceholders CollectDocumentPlaceholderContents()
Collect the values for all document placeholders that are supported by this IAnalyticsModule....
List< string > SupportedDocumentPlaceholderKeys
List of all document placeholder keys that are supported by this analytics module....
Dictionary< UInt16, int > NumberPersonsPerBirthYear
Dictionary that counts the number of persons (value) per birth year (key)
AnalyticsModuleAgeDistribution(IPersonService personService)
Constructor for the AnalyticsModuleAgeDistribution
bool AnalyticsAvailable
Flag indicating if the analytics module has data.
Interface for a service used to get and store a list of Person objects.