public static void BeginInstancesTransferAuditLogger(List<StorageInstance> instances, AssociationParameters parms)
		{
			Dictionary<string, AuditPatientParticipantObject> list = new Dictionary<string, AuditPatientParticipantObject>();

			foreach (StorageInstance instance in instances)
			{
				string key = instance.PatientId + instance.PatientsName;
				if (!list.ContainsKey(key))
				{
					AuditPatientParticipantObject patient =
						new AuditPatientParticipantObject(instance.PatientsName, instance.PatientId);
					list.Add(key, patient);
				}
			}

			foreach (AuditPatientParticipantObject patient in list.Values)
			{
				// Audit Log
				BeginTransferringDicomInstancesAuditHelper audit =
					new BeginTransferringDicomInstancesAuditHelper(ServerPlatform.AuditSource,
					                                               EventIdentificationContentsEventOutcomeIndicator.Success,
					                                               parms, patient);

				foreach (StorageInstance instance in instances)
				{
					if (patient.PatientId.Equals(instance.PatientId)
					    && patient.PatientsName.Equals(instance.PatientsName))
					{
						audit.AddStorageInstance(instance);
					}
				}

				ServerAuditHelper.LogAuditMessage(audit);
			}
		}
Esempio n. 2
0
        /// <summary>
        /// Generates a "Begin Transferring DICOM Instances" receive event in the audit log, according to DICOM Supplement 95.
        /// </summary>
        /// <remarks>
        /// This method automatically separates different patients into separately logged events, as required by DICOM.
        /// </remarks>
        /// <param name="localAETitle">The local application entity to which the transfer was started.</param>
        /// <param name="remoteAETitle">The application entity from which the transfer was started.</param>
        /// <param name="remoteHostName">The hostname of the application entity from which the transfer was started.</param>
        /// <param name="instances">The studies that were requested for transfer.</param>
        /// <param name="eventSource">The source user or application entity which invoked the operation.</param>
        /// <param name="eventResult">The result of the operation.</param>
        public static void LogBeginReceiveInstances(string localAETitle, string remoteAETitle, string remoteHostName, AuditedInstances instances, EventSource eventSource, EventResult eventResult)
        {
            if (!AuditingEnabled)
            {
                return;
            }

            try
            {
                foreach (var patient in instances.EnumeratePatients())
                {
                    var auditHelper = new BeginTransferringDicomInstancesAuditHelper(eventSource, eventResult,
                                                                                     remoteAETitle ?? localAETitle, remoteHostName ?? LocalHostname, localAETitle, LocalHostname, patient);
                    foreach (var study in instances.EnumerateStudies(patient))
                    {
                        auditHelper.AddStudyParticipantObject(study);
                    }
                    Log(auditHelper);
                }
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Warn, ex, _messageAuditFailed);
            }
        }