public void CreateStandardChartsIfNotExists() { int amountStandardCharts = 12; if (standardCharts.Count < amountStandardCharts && chartRepository.ReadStandardCharts().Count < amountStandardCharts) { standardCharts = new Dictionary <string, Chart>(); Chart trendingPersonWeek = new Chart() { StandardChart = true, ChartType = ChartType.bar, ChartValue = ChartValue.trendPersons, FrequencyType = DateFrequencyType.weekly }; Chart trendingPersonMonth = new Chart() { StandardChart = true, ChartType = ChartType.bar, ChartValue = ChartValue.trendPersons, FrequencyType = DateFrequencyType.monthly }; Chart trendingOrganizationWeek = new Chart() { StandardChart = true, ChartType = ChartType.bar, ChartValue = ChartValue.trendOrganizations, FrequencyType = DateFrequencyType.weekly }; Chart trendingOrganizationMonth = new Chart() { StandardChart = true, ChartType = ChartType.bar, ChartValue = ChartValue.trendOrganizations, FrequencyType = DateFrequencyType.monthly }; Chart trendingThemeWeek = new Chart() { StandardChart = true, ChartType = ChartType.bar, ChartValue = ChartValue.trendThemes, FrequencyType = DateFrequencyType.weekly }; Chart trendingThemeMonth = new Chart() { StandardChart = true, ChartType = ChartType.bar, ChartValue = ChartValue.trendThemes, FrequencyType = DateFrequencyType.monthly }; Chart mostPositivePersons = new Chart() { StandardChart = true, ChartType = ChartType.bar, ChartValue = ChartValue.trendMostPositive, FrequencyType = DateFrequencyType.weekly, ItemType = "Person" }; Chart mostNegativePersons = new Chart() { StandardChart = true, ChartType = ChartType.bar, ChartValue = ChartValue.trendMostNegative, FrequencyType = DateFrequencyType.weekly, ItemType = "Person" }; Chart mostPositiveOrganizations = new Chart() { StandardChart = true, ChartType = ChartType.bar, ChartValue = ChartValue.trendMostPositive, FrequencyType = DateFrequencyType.weekly, ItemType = "Organization" }; Chart mostNegativeOrganizations = new Chart() { StandardChart = true, ChartType = ChartType.bar, ChartValue = ChartValue.trendMostNegative, FrequencyType = DateFrequencyType.weekly, ItemType = "Organization" }; Chart mostPositiveThemes = new Chart() { StandardChart = true, ChartType = ChartType.bar, ChartValue = ChartValue.trendMostPositive, FrequencyType = DateFrequencyType.weekly, ItemType = "Theme" }; Chart mostNegativeThemes = new Chart() { StandardChart = true, ChartType = ChartType.bar, ChartValue = ChartValue.trendMostNegative, FrequencyType = DateFrequencyType.weekly, ItemType = "Theme" }; standardCharts.Add("trendingPersonWeek", chartRepository.CreateChart(trendingPersonWeek)); standardCharts.Add("trendingPersonMonth", chartRepository.CreateChart(trendingPersonMonth)); standardCharts.Add("trendingOrganizationWeek", chartRepository.CreateChart(trendingOrganizationWeek)); standardCharts.Add("trendingOrganizationMonth", chartRepository.CreateChart(trendingOrganizationMonth)); standardCharts.Add("trendingThemeWeek", chartRepository.CreateChart(trendingThemeWeek)); standardCharts.Add("trendingThemeMonth", chartRepository.CreateChart(trendingThemeMonth)); standardCharts.Add("mostPositivePersons", chartRepository.CreateChart(mostPositivePersons)); standardCharts.Add("mostNegativePersons", chartRepository.CreateChart(mostNegativePersons)); standardCharts.Add("mostPositiveOrganizations", chartRepository.CreateChart(mostPositiveOrganizations)); standardCharts.Add("mostNegativeOrganizations", chartRepository.CreateChart(mostNegativeOrganizations)); standardCharts.Add("mostPositiveThemes", chartRepository.CreateChart(mostPositiveThemes)); standardCharts.Add("mostNegativeThemes", chartRepository.CreateChart(mostNegativeThemes)); } else if (standardCharts.Count < amountStandardCharts) { standardCharts = new Dictionary <string, Chart>(); List <Chart> tempStandardCharts = chartRepository.ReadStandardCharts(); standardCharts.Add("trendingPersonWeek", tempStandardCharts.First(c => c.ChartValue == ChartValue.trendPersons && c.FrequencyType == DateFrequencyType.weekly)); standardCharts.Add("trendingPersonMonth", tempStandardCharts.First(c => c.ChartValue == ChartValue.trendPersons && c.FrequencyType == DateFrequencyType.monthly)); standardCharts.Add("trendingOrganizationWeek", tempStandardCharts.First(c => c.ChartValue == ChartValue.trendOrganizations && c.FrequencyType == DateFrequencyType.weekly)); standardCharts.Add("trendingOrganizationMonth", tempStandardCharts.First(c => c.ChartValue == ChartValue.trendOrganizations && c.FrequencyType == DateFrequencyType.monthly)); standardCharts.Add("trendingThemeWeek", tempStandardCharts.First(c => c.ChartValue == ChartValue.trendThemes && c.FrequencyType == DateFrequencyType.weekly)); standardCharts.Add("trendingThemeMonth", tempStandardCharts.First(c => c.ChartValue == ChartValue.trendThemes && c.FrequencyType == DateFrequencyType.monthly)); standardCharts.Add("mostPositivePersons", tempStandardCharts.First(c => c.ChartValue == ChartValue.trendMostPositive && c.FrequencyType == DateFrequencyType.weekly && c.ItemType == "Person")); standardCharts.Add("mostNegativePersons", tempStandardCharts.First(c => c.ChartValue == ChartValue.trendMostNegative && c.FrequencyType == DateFrequencyType.weekly && c.ItemType == "Person")); standardCharts.Add("mostPositiveOrganizations", tempStandardCharts.First(c => c.ChartValue == ChartValue.trendMostPositive && c.FrequencyType == DateFrequencyType.weekly && c.ItemType == "Organization")); standardCharts.Add("mostNegativeOrganizations", tempStandardCharts.First(c => c.ChartValue == ChartValue.trendMostNegative && c.FrequencyType == DateFrequencyType.weekly && c.ItemType == "Organization")); standardCharts.Add("mostPositiveThemes", tempStandardCharts.First(c => c.ChartValue == ChartValue.trendMostPositive && c.FrequencyType == DateFrequencyType.weekly && c.ItemType == "Theme")); standardCharts.Add("mostNegativeThemes", tempStandardCharts.First(c => c.ChartValue == ChartValue.trendMostNegative && c.FrequencyType == DateFrequencyType.weekly && c.ItemType == "Theme")); } }