private void DataOrderingNumbers(string param, bool orderByDescending) { var propertyInfo = typeof(ReligiousComposition).GetProperty(param); if (orderByDescending == false) { if (continentValue == string.Empty) { SelectedReligiousData = ReligiousDataCollection.Where(x => x.Year == yearValue). OrderBy(x => double.Parse(Regex.Replace(propertyInfo.GetValue(x, null).ToString(), "[,<]", string.Empty))).ToList(); } else { SelectedReligiousData = ReligiousDataCollection.Where(x => x.Continent == continentValue && x.Year == yearValue). OrderBy(x => double.Parse(Regex.Replace(propertyInfo.GetValue(x, null).ToString(), "[,<]", string.Empty))).ToList(); } } else { if (continentValue == string.Empty) { SelectedReligiousData = ReligiousDataCollection.Where(x => x.Year == yearValue). OrderByDescending(x => double.Parse(Regex.Replace(propertyInfo.GetValue(x, null).ToString(), "[,<]", string.Empty))).ToList(); } else { SelectedReligiousData = ReligiousDataCollection.Where(x => x.Continent == continentValue && x.Year == yearValue). OrderByDescending(x => double.Parse(Regex.Replace(propertyInfo.GetValue(x, null).ToString(), "[,<]", string.Empty))).ToList(); } } }
private void UpdateYears(object year) { int yearCasted = (int)year; if (string.IsNullOrEmpty(continentValue)) { SelectedReligiousData = ReligiousDataCollection.Where(x => x.Year == yearCasted).ToList(); } else { SelectedReligiousData = ReligiousDataCollection.Where(x => x.Year == yearCasted && x.Continent == continentValue).ToList(); } yearValue = yearCasted; RepeatLastOrdering(); /// Order by last selected description value }
private void UpdateContinents(object name) { string nameCasted = (string)name; if (nameCasted == "All") { SelectedReligiousData = ReligiousDataCollection.Where(x => x.Year == yearValue).ToList(); continentValue = string.Empty; } else { SelectedReligiousData = ReligiousDataCollection.Where(x => x.Continent == nameCasted && x.Year == yearValue).ToList(); continentValue = nameCasted; } RepeatLastOrdering(); /// Order by last selected description value }
private void SearchByCountry(object _countryName) { string countryName = (string)_countryName; SelectedReligiousData = ReligiousDataCollection.Where(x => x.CountryName.ToLower() == countryName.ToLower()). ToList(); if (SelectedReligiousData.Count == 0) { NoResultsFoundVisibility = "Visible"; GridDataView = "Collapsed"; } else { GridDataView = "Visible"; NoResultsFoundVisibility = "Collapsed"; } }