Exemple #1
0
        /// <summary>
        /// Generates a "Dicom Study Deleted" 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="aeTitle">The application entity from which the instances were deleted.</param>
        /// <param name="instances">The studies that were deleted.</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 LogDeleteStudies(string aeTitle, AuditedInstances instances, EventSource eventSource, EventResult eventResult)
        {
            if (!AuditingEnabled)
            {
                return;
            }

            try
            {
                foreach (var patient in instances.EnumeratePatients())
                {
                    var auditHelper = new DicomStudyDeletedAuditHelper(eventSource, eventResult);
                    auditHelper.AddUserParticipant(eventSource);
                    auditHelper.AddUserParticipant(new AuditProcessActiveParticipant(aeTitle));
                    auditHelper.AddPatientParticipantObject(patient);
                    foreach (var study in instances.EnumerateStudies(patient))
                    {
                        auditHelper.AddStudyParticipantObject(study);
                    }
                    Log(auditHelper);
                }
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Warn, ex, _messageAuditFailed);
            }
        }
 private void AuditLog(Study affectedStudy)
 {
     // Audit log
     DicomStudyDeletedAuditHelper helper =
         new DicomStudyDeletedAuditHelper(
             ServerPlatform.AuditSource,
             EventIdentificationContentsEventOutcomeIndicator.Success);
     helper.AddUserParticipant(new AuditPersonActiveParticipant(
                                   SessionManager.Current.Credentials.
                                       UserName,
                                   null,
                                   SessionManager.Current.Credentials.
                                       DisplayName));
     helper.AddStudyParticipantObject(new AuditStudyParticipantObject(
                                          affectedStudy.StudyInstanceUid,
                                          affectedStudy.AccessionNumber ??
                                          string.Empty));
     ServerAuditHelper.LogAuditMessage(helper);
 }
        protected void DeleteButton_Clicked(object sender, ImageClickEventArgs e)
        {

            if (Page.IsValid)
            {
                try
                {
                    string reason = ReasonListBox.SelectedItem.Text;
                    if (!String.IsNullOrEmpty(SaveReasonAsName.Text))
                    {
                        SaveCustomReason();
                        reason = SaveReasonAsName.Text;
                    }

                    OnDeletingStudies();
                    StudyController controller = new StudyController();
                    foreach (DeleteStudyInfo study in DeletingStudies)
                    {
                        try
                        {
                            controller.DeleteStudy(study.StudyKey, reason + "::" + Comment.Text);

							// Audit log
                        	DicomStudyDeletedAuditHelper helper = new DicomStudyDeletedAuditHelper(
                        										ServerPlatform.AuditSource, 
																EventIdentificationContentsEventOutcomeIndicator.Success);
							helper.AddUserParticipant(new AuditPersonActiveParticipant(
																SessionManager.Current.Credentials.UserName, 
																null, 
																SessionManager.Current.Credentials.DisplayName));
                        	helper.AddStudyParticipantObject(new AuditStudyParticipantObject(
																	study.StudyInstanceUid, 
																	study.AccessionNumber ?? string.Empty));
                        	ServerPlatform.LogAuditMessage(helper);
                        }
                        catch (Exception ex)
                        {
                            Platform.Log(LogLevel.Error, ex, "DeleteClicked failed: Unable to delete studies");
                            throw;
                        }
                    }

                    OnStudiesDeleted();
                }
                finally
                {
                    Close();
                }
            }
            else
            {
                EnsureDialogVisible();
            }
        }
        protected virtual void OnStudyDeleted()
        {

            // Audit log
            DicomStudyDeletedAuditHelper helper = new DicomStudyDeletedAuditHelper(
                                                ServerPlatform.AuditSource,
                                                EventIdentificationContentsEventOutcomeIndicator.Success);
            helper.AddUserParticipant(new AuditProcessActiveParticipant(ServerPartition.AeTitle));
            helper.AddStudyParticipantObject(new AuditStudyParticipantObject(
                                                    StorageLocation.StudyInstanceUid,
                                                    Study == null ? string.Empty : Study.AccessionNumber));
            ServerPlatform.LogAuditMessage(helper);


            IList<IDeleteStudyProcessorExtension> extensions = LoadExtensions();
            foreach (IDeleteStudyProcessorExtension ext in extensions)
            {
                if (ext.Enabled)
                    ext.OnStudyDeleted();
            }
        }