Пример #1
0
        private void EvaluateSearchOptions()
        {
            if (InformationCategories == null)
            {
                InformationCategories = new InformationCategory[0];
            }

            if (InformationTypes == null)
            {
                InformationTypes = new InformationType[0];
            }

            if (InformationCategories.Contains(InformationCategory.All))
            {
                InformationCategories = new[] { InformationCategory.All };
            }

            if (InformationTypes.Contains(InformationType.All))
            {
                InformationTypes = new[] { InformationType.All };
            }

            if (InformationCategories == null && InformationTypes == null ||
                InformationCategories != null && InformationTypes != null && !InformationTypes.Any() &&
                !InformationCategories.Any())
            {
                InformationCategories = new[]
                {
                    InformationCategory.All
                };
            }
        }
Пример #2
0
        private bool InformationTypeSelected(MemberInfo memberInfo)
        {
            if (InformationTypes != null)
            {
                if (InformationTypes.Contains(InformationType.All))
                {
                    return(true);
                }

                var typeName = memberInfo?.Name;
                var parsed   = Enum.TryParse(typeName, out InformationType informationType);
                return(parsed && InformationTypes.Contains(informationType));
            }

            return(false);
        }
Пример #3
0
        private bool IsDataFilesSelectedWithoutWhere(MemberInfo memberInfo)
        {
            if (InformationTypes != null || InformationCategories != null)
            {
                var typeName = memberInfo?.Name;
                var informationTypeParsed = Enum.TryParse(typeName, out InformationType informationType);

                if ((InformationTypes == null || !InformationTypes.Contains(InformationType.All) || !InformationTypes.Contains(InformationType.DataFiles)) ||
                    (InformationCategories == null || !InformationCategories.Contains(InformationCategory.DataFiles)) || !InformationCategories.Contains(InformationCategory.All))
                {
                    var shouldFetchDataFiles = informationTypeParsed && informationType != InformationType.DataFiles ||
                                               Queries.Any(x => x.InformationType == InformationType.DataFiles);
                    return(shouldFetchDataFiles);
                }
            }

            return(false);
        }