private void AddExamInfo(ReceivedDicomElements receivedDicomElements, ref CachedDicomElements cachedDicomElements)
 {
     cachedDicomElements.PatientId       = AppendIfNotExist(cachedDicomElements.PatientId, receivedDicomElements.Elements.GetSafeStringValue(t.PatientID));
     cachedDicomElements.PatientName     = AppendIfNotExist(cachedDicomElements.PatientName, receivedDicomElements.Elements.GetSafeStringValue(t.PatientName));
     cachedDicomElements.Modality        = AppendIfNotExist(cachedDicomElements.Modality, receivedDicomElements.Elements.GetSafeStringValue(t.Modality));
     cachedDicomElements.AccessionNumber = AppendIfNotExist(cachedDicomElements.AccessionNumber, receivedDicomElements.Elements.GetSafeStringValue(t.AccessionNumber));
 }
        public CachedDicomElements CreateCachedFromReceived(ReceivedDicomElements receivedDicomElements)
        {
            var cachedDicomElements = new CachedDicomElements()
            {
                CallingAeIpAddress = receivedDicomElements.CallingAeIpAddress,
                CallingAeTitle     = receivedDicomElements.CallingAeTitle,
                FileName           = receivedDicomElements.FileName,
                ReceivedDateTime   = receivedDicomElements.ReceivedDateTime,
                ImageSource        = receivedDicomElements.ImageSource,
                ImageStatus        = receivedDicomElements.ImageStatus,
            };

            if (receivedDicomElements.ImageSource == ImageSource.StorageCommitment)
            {
                foreach (var storageCommitmentReferenceDicomElement in GetStorageCommitmentReferenceDicomElements(receivedDicomElements))
                {
                    AddExamInfo(storageCommitmentReferenceDicomElement, ref cachedDicomElements);
                }
            }
            else
            {
                AddExamInfo(receivedDicomElements, ref cachedDicomElements);
            }

            return(cachedDicomElements);
        }