public string[] GetValue(CodeGroupType groupType, string language, string code) { if (!CodeGroups.Any()) { return(null); } if (string.IsNullOrEmpty(language)) { return(null); } if (string.IsNullOrEmpty(code)) { return(null); } var codeGroup = CodeGroups.FirstOrDefault(cg => cg.Type == groupType && cg.Translations.Any(t => t.Language.Equals(language, StringComparison.OrdinalIgnoreCase))); if (codeGroup == null) { return(null); } var translations = codeGroup.Translations.Where(t => t.Language.Equals(language, StringComparison.OrdinalIgnoreCase)); return(translations.Select(t => t.Value).ToArray()); }
public string GetValue(CodeGroupType groupType, string culture, string language, string code) { if (!CodeGroups.Any()) { return(null); } if (string.IsNullOrEmpty(culture)) { return(null); } if (string.IsNullOrEmpty(language)) { return(null); } if (string.IsNullOrEmpty(code)) { return(null); } var codeGroup = CodeGroups.FirstOrDefault(cg => cg.Type == groupType && cg.Translations.Any(t => t.Culture.Equals(culture, StringComparison.OrdinalIgnoreCase) && t.Language.Equals(language, StringComparison.OrdinalIgnoreCase))); if (codeGroup == null) { return(null); } var translation = codeGroup.Translations.FirstOrDefault(t => t.Culture.Equals(culture, StringComparison.OrdinalIgnoreCase) && t.Language.Equals(language, StringComparison.OrdinalIgnoreCase)); return(translation != null ? translation.Value : null); }
public ObservableCollection <CodeGroup> GetCodeGroups(CodeGroupType type) { var codeGroups = new ObservableCollection <CodeGroup>(); if (!CodeGroups.Any()) { return(codeGroups); } return(CodeGroups.Where(cg => cg.Type == type) .ToObservableCollection()); }
public string GetValue(CodeGroupType groupType, string code) { if (!CodeGroups.Any()) { return(null); } if (string.IsNullOrEmpty(code)) { return(null); } var codeGroup = CodeGroups.FirstOrDefault(cg => cg.Type == groupType && cg.Code.Equals(code, StringComparison.OrdinalIgnoreCase)); return(codeGroup != null ? codeGroup.Value : null); }
public string GetCode(CodeGroupType groupType, string value) { if (!CodeGroups.Any()) { return(null); } if (string.IsNullOrEmpty(value)) { return(null); } var codeGroup = CodeGroups.FirstOrDefault(cg => cg.Type == groupType && cg.Translations.Any(t => t.Value != null && t.Value.Contains(value))); return(codeGroup != null ? codeGroup.Code : null); }