示例#1
0
        private bool InformationCategorySelected(MemberInfo memberInfo)
        {
            if (InformationCategories != null)
            {
                if (InformationCategories.Contains(InformationCategory.All))
                {
                    return(true);
                }

                var informationCategories = memberInfo?.GetCustomAttributes(typeof(InformationCategoryAttribute), true)
                                            .Cast <InformationCategoryAttribute>()
                                            .FirstOrDefault()?
                                            .InformationCategories;

                if (informationCategories != null)
                {
                    foreach (var informationCategory in informationCategories)
                    {
                        if (InformationCategories.Contains(informationCategory))
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
示例#2
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
                };
            }
        }
示例#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);
        }