public void SetComparators(Dvtk.Comparator.BaseComparatorCollection comparatorCollection) { if (_transaction is DicomTransaction) { System.String name = System.String.Empty; DicomTransaction dicomTransaction = (DicomTransaction)_transaction; switch(dicomTransaction.Direction) { case TransactionDirectionEnum.TransactionReceived: name = System.String.Format("Received by {0} from {1}", ActorNames.Name(_fromActorName), ActorNames.Name(_toActorName)); break; case TransactionDirectionEnum.TransactionSent: name = System.String.Format("Sent from {0} to {1}", ActorNames.Name(_fromActorName), ActorNames.Name(_toActorName)); break; default: break; } for (int i = 0; i < dicomTransaction.DicomMessages.Count; i++) { DicomMessage dicomMessage = (DicomMessage)dicomTransaction.DicomMessages[i]; DvtkHighLevelInterface.Comparator.Comparator comparator = new DvtkHighLevelInterface.Comparator.Comparator(name); Dvtk.Comparator.DicomComparator dicomComparator = comparator.InitializeDicomComparator(dicomMessage); if (dicomComparator != null) { comparatorCollection.Add(dicomComparator); } } } }
/// <summary> /// Set the Comparators needed to handle each message in the Transaction. /// </summary> /// <param name="comparatorCollection">Comparator collection to fill.</param> public void SetComparators(Dvtk.Comparator.BaseComparatorCollection comparatorCollection) { if (_transaction is DicomTransaction) { System.String name = System.String.Empty; DicomTransaction dicomTransaction = (DicomTransaction)_transaction; switch(dicomTransaction.Direction) { case TransactionDirectionEnum.TransactionReceived: name = System.String.Format("Received by {0}:{1} from {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; case TransactionDirectionEnum.TransactionSent: name = System.String.Format("Sent from {0}:{1} to {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; default: break; } for (int i = 0; i < dicomTransaction.DicomMessages.Count; i++) { DicomMessage dicomMessage = (DicomMessage)dicomTransaction.DicomMessages[i]; DvtkHighLevelInterface.Comparator.Comparator comparator = new DvtkHighLevelInterface.Comparator.Comparator(name); Dvtk.Comparator.DicomComparator dicomComparator = comparator.InitializeDicomComparator(dicomMessage); if (dicomComparator != null) { comparatorCollection.Add(dicomComparator); } } } else if (_transaction is Hl7Transaction) { System.String name = System.String.Empty; Hl7Transaction hl7Transaction = (Hl7Transaction)_transaction; switch(hl7Transaction.Direction) { case TransactionDirectionEnum.TransactionReceived: name = System.String.Format("Received by {0}:{1} from {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; case TransactionDirectionEnum.TransactionSent: name = System.String.Format("Sent from {0}:{1} to {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; default: break; } Hl7Message hl7Message= hl7Transaction.Request; DvtkHighLevelInterface.Comparator.Comparator comparator = new DvtkHighLevelInterface.Comparator.Comparator(name); Dvtk.Comparator.Hl7Comparator hl7Comparator = comparator.InitializeHl7Comparator(hl7Message); if (hl7Comparator != null) { comparatorCollection.Add(hl7Comparator); } } }