Beispiel #1
0
        public virtual void ProcessHandler(string email)
        {
            bool wordFound = false;

            IEnumerable <string> words = MatchingWords();

            if (MatchingWords().Count() == 0)
            {
                wordFound = true;
            }
            else
            {
                string word = MatchingWords().FirstOrDefault(w => email.ToUpper().Contains(w.ToUpper()));

                if (!(word is null))
                {
                    wordFound = true;
                }
            }

            if (wordFound)
            {
                HandleHere(email);
            }
            else
            {
                _nextHandler.ProcessHandler(email);
            }
        }
        public virtual void ProcessHandler(string email)
        {
            bool wordFound = false;

            // If no words to match against then this object can handle
            if (MatchingWords().Length == 0)
            {
                wordFound = true;
            }
            else
            {
                // Look for any of the maching words
                foreach (string word in MatchingWords())
                {
                    if (email.IndexOf(word) >= 0)
                    {
                        wordFound = true;
                        break;
                    }
                }
            }

            // Can we handle email in this object
            if (wordFound)
            {
                HandleHere(email);
            }
            else
            {
                // Unable to handle here so forward to next in chain
                nextHandle.ProcessHandler(email);
            }
        }
        public virtual void ProcessHandler(string email)
        {
            bool wordFound = false;

            if (MatchingWords().Length == 0)
            {
                wordFound = true;
            }
            else
            {
                foreach (var word in MatchingWords())
                {
                    if (email.IndexOf(word) >= 0)
                    {
                        wordFound = true;
                        break;
                    }
                }
            }

            if (wordFound)
            {
                HandleHere(email);
            }
            else
            {
                nextHandler.ProcessHandler(email);
            }
        }