示例#1
0
        private bool RemoveIncludeTag(string tag)
        {
            if (!IncludeTags.Contains(tag))
            {
                return(false);
            }

            return(IncludeTags.Remove(tag));
        }
示例#2
0
 protected override void OnPreRender(EventArgs e)
 {
     base.OnPreRender(e);
     if (Terms != null)
     {
         Attributes.Add("SelectedTerms", String.Join(",", Terms.Select(t => t.TermId.ToString()).ToArray()));
     }
     Attributes.Add("IncludeSystemVocabularies", IncludeSystemVocabularies.ToString().ToLowerInvariant());
     Attributes.Add("IncludeTags", IncludeTags.ToString().ToLowerInvariant());
     Attributes.Add("PortalId", PortalId.ToString());
 }
示例#3
0
        private bool AddIncludeTag(string tag)
        {
            if (IncludeTags.Contains(tag))
            {
                return(false);
            }

            IncludeTags.Add(tag);

            return(true);
        }
示例#4
0
        /// <summary>
        /// Tests whether an error record applies to the provider
        /// </summary>
        /// <param name="Record">The error record to test</param>
        /// <returns>Whether it applies to the provider</returns>
        public bool MessageApplies(Message.PsfExceptionRecord Record)
        {
            if ((IncludeModules.Count == 0) && (ExcludeModules.Count == 0) && (IncludeTags.Count == 0) && (ExcludeTags.Count == 0))
            {
                return(true);
            }

            if (IncludeModules.Count > 0)
            {
                bool test = false;
                foreach (string module in IncludeModules)
                {
                    if (Record.ModuleName.ToLower() == module.ToLower())
                    {
                        test = true;
                    }
                }

                if (!test)
                {
                    return(false);
                }
            }

            foreach (string module in ExcludeModules)
            {
                if (Record.ModuleName.ToLower() == module.ToLower())
                {
                    return(false);
                }
            }

            if (IncludeTags.Count > 0)
            {
                if (IncludeTags.Except(Record.Tags).ToList().Count == IncludeTags.Count)
                {
                    return(false);
                }
            }

            if (ExcludeTags.Except(Record.Tags).ToList().Count < ExcludeTags.Count)
            {
                return(false);
            }

            return(true);
        }
示例#5
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (!string.IsNullOrEmpty(CssClass))
            {
                CssClass = string.Format("{0} TermsSelector", CssClass);
            }
            else
            {
                CssClass = "TermsSelector";
            }

            var includeSystem = IncludeSystemVocabularies.ToString().ToLowerInvariant();
            var includeTags   = IncludeTags.ToString().ToLowerInvariant();
            var apiPath       = Globals.ResolveUrl($"~/API/InternalServices/ItemListService/GetTerms?includeSystem={includeSystem}&includeTags={includeTags}&q=");

            Options.Preload = "focus";
            Options.Plugins.Add("remove_button");
            Options.Render = new RenderOption
            {
                Option = "function(item, escape) {return '<div>' + item.text + '</div>';}"
            };

            Options.Load  = $@"function(query, callback) {{
                                $.ajax({{
                                        url: '{apiPath}' + encodeURIComponent(query),
                                    type: 'GET',
                                    error: function() {{
                                        callback();
                                    }},
                                    success: function(data) {{
                                        callback(data);
                                    }}
                                }});
                            }}
";
            Options.Items = _initOptions;
        }
示例#6
0
        /// <summary>
        /// Tests whether an error record applies to the provider instance
        /// </summary>
        /// <param name="Record">The error record to test</param>
        /// <returns>Whether it applies to the provider instance</returns>
        public bool MessageApplies(Message.PsfExceptionRecord Record)
        {
            // Modules
            if (IncludeModules.Count > 0)
            {
                bool test = false;
                foreach (string module in IncludeModules)
                {
                    if (string.Equals(Record.ModuleName, module, StringComparison.InvariantCultureIgnoreCase))
                    {
                        test = true;
                    }
                }

                if (!test)
                {
                    return(false);
                }
            }

            foreach (string module in ExcludeModules)
            {
                if (string.Equals(Record.ModuleName, module, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(false);
                }
            }

            // Functions
            if (IncludeFunctions.Count > 0)
            {
                bool test = false;
                foreach (string function in IncludeFunctions)
                {
                    if (UtilityHost.IsLike(Record.FunctionName, function))
                    {
                        test = true;
                    }
                }

                if (!test)
                {
                    return(false);
                }
            }

            foreach (string function in ExcludeFunctions)
            {
                if (UtilityHost.IsLike(Record.FunctionName, function))
                {
                    return(false);
                }
            }

            // Tags
            if (IncludeTags.Count > 0)
            {
                if (IncludeTags.Except(Record.Tags).ToList().Count == IncludeTags.Count)
                {
                    return(false);
                }
            }

            if (ExcludeTags.Except(Record.Tags).ToList().Count < ExcludeTags.Count)
            {
                return(false);
            }

            return(true);
        }
示例#7
0
        /// <summary>
        /// Tests whether a log entry applies to the provider instance
        /// </summary>
        /// <param name="Entry">The Entry to validate</param>
        /// <returns>Whether it applies</returns>
        public bool MessageApplies(Message.LogEntry Entry)
        {
            // Level
            if (!IncludeWarning && (Entry.Level == Message.MessageLevel.Warning))
            {
                return(false);
            }
            if (((_MinLevel != 1) || (_MaxLevel != 9)) && (Entry.Level != Message.MessageLevel.Warning))
            {
                if (Entry.Level < (Message.MessageLevel)_MinLevel)
                {
                    return(false);
                }
                if (Entry.Level > (Message.MessageLevel)_MaxLevel)
                {
                    return(false);
                }
            }

            // Modules
            if (IncludeModules.Count > 0)
            {
                bool test = false;
                foreach (string module in IncludeModules)
                {
                    if (string.Equals(Entry.ModuleName, module, StringComparison.InvariantCultureIgnoreCase))
                    {
                        test = true;
                    }
                }

                if (!test)
                {
                    return(false);
                }
            }

            foreach (string module in ExcludeModules)
            {
                if (string.Equals(Entry.ModuleName, module, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(false);
                }
            }

            // Functions
            if (IncludeFunctions.Count > 0)
            {
                bool test = false;
                foreach (string function in IncludeFunctions)
                {
                    if (UtilityHost.IsLike(Entry.FunctionName, function))
                    {
                        test = true;
                    }
                }

                if (!test)
                {
                    return(false);
                }
            }

            foreach (string function in ExcludeFunctions)
            {
                if (UtilityHost.IsLike(Entry.FunctionName, function))
                {
                    return(false);
                }
            }

            // Tags
            if (IncludeTags.Count > 0)
            {
                if (IncludeTags.Except(Entry.Tags, StringComparer.InvariantCultureIgnoreCase).ToList().Count == IncludeTags.Count)
                {
                    return(false);
                }
            }

            if (ExcludeTags.Except(Entry.Tags, StringComparer.InvariantCultureIgnoreCase).ToList().Count < ExcludeTags.Count)
            {
                return(false);
            }

            return(true);
        }
示例#8
0
 public bool HasTagFilters()
 {
     return(IncludeTags.Any() || ExcludeTags.Any());
 }
示例#9
0
 public bool IncludesAny(List <string> tags)
 {
     return(!IncludeTags.Any() || IncludeTags.Intersect(tags).Any());
 }
示例#10
0
 public bool Includes(string tag)
 {
     return(!IncludeTags.Any() || IncludeTags.Contains(tag));
 }
 public override void Analyze(SymbolAnalysisContext context, List <IncludeAttributeData> includeTags, List <ProtobufAttributeData> memberTags, List <ContractAttributeData> contractAttributes)
 {
     MemberTags.Add(context.Symbol.Name, memberTags);
     IncludeTags.Add(context.Symbol.Name, includeTags);
 }