/// <summary> /// Get message rules /// </summary> /// <param name="theVersion">an HL7 version (eg "2.1").</param> /// <param name="theMessageType">a value valid for MSH-9-1.</param> /// <param name="theTriggerEvent">a value valid fro MSH-9-2.</param> /// <returns> /// the active rules that apply to message of the given version, message type, /// and trigger event. /// </returns> public IMessageRule[] GetMessageRules(string theVersion, string theMessageType, string theTriggerEvent) { IMessageRule[] result = new IMessageRule[0]; if (originalContext != null) { result = originalContext.GetMessageRules(theVersion, theMessageType, theTriggerEvent); } foreach (ISpecificMessageRule rule in messageRules) { // Add the rule if it applies bool flag1 = rule.GetVersions().Contains("*") || rule.GetVersions().Contains(theVersion); bool flag2 = rule.GetMessageTypes().Contains("*") || rule.GetMessageTypes().Contains(theMessageType); bool flag3 = rule.GetTriggerEvents().Contains("*") || rule.GetTriggerEvents().Contains(theTriggerEvent); if (flag1 && flag2 && flag3) { List <IMessageRule> rules = new List <IMessageRule>(result); rules.Add(rule); result = rules.ToArray(); } } return(result); }