示例#1
0
        /// <summary>
        /// Checks the attributes for this component and determines if the message
        /// should be processed.
        /// </summary>
        /// <param name="action">The action that contains the configuration for this component.</param>
        /// <param name="message">The message that is to be checked.</param>
        /// <param name="errorMessage">If there is a problem processing, this should be set</param>
        /// <returns>
        ///   <c>true</c> if the message should be processed.
        /// </returns>
        public override bool ShouldProcessMessage(SmsActionCache action, SmsMessage message, out string errorMessage)
        {
            //
            // Give the base class a chance to check it's own settings to see if we
            // should process this message.
            //
            if (!base.ShouldProcessMessage(action, message, out errorMessage))
            {
                return(false);
            }

            //
            // Check if we have a valid workflow type.
            //
            var workflowType = WorkflowTypeCache.Get(GetAttributeValue(action, AttributeKey.WorkflowType).AsGuid());

            if (workflowType == null)
            {
                return(false);
            }

            //
            // Get the filter expression for the message body.
            //
            var attribute = action.Attributes.ContainsKey(AttributeKey.Message) ? action.Attributes[AttributeKey.Message] : null;
            var msg       = GetAttributeValue(action, AttributeKey.Message);
            var filter    = ValueFilterFieldType.GetFilterExpression(attribute?.QualifierValues, msg);

            //
            // Evaluate the message against the filter and return the match state.
            //
            return(filter != null?filter.Evaluate(message, AttributeKey.Message) : true);
        }
示例#2
0
        /// <summary>
        /// Checks the attributes for this component and determines if the message
        /// should be processed.
        /// </summary>
        /// <param name="action">The action that contains the configuration for this component.</param>
        /// <param name="message">The message that is to be checked.</param>
        /// /// <param name="errorMessage">If there is a problem, this should be set</param>
        /// <returns><c>true</c> if the message should be processed.</returns>
        public virtual bool ShouldProcessMessage(SmsActionCache action, SmsMessage message, out string errorMessage)
        {
            errorMessage = string.Empty;

            var attribute    = action.Attributes.ContainsKey("PhoneNumbers") ? action.Attributes["PhoneNumbers"] : null;
            var phoneNumbers = GetAttributeValue(action, "PhoneNumbers");
            var filter       = ValueFilterFieldType.GetFilterExpression(attribute?.QualifierValues, phoneNumbers);

            return(filter != null?filter.Evaluate(message, "ToNumber") : true);
        }