protected void DeleteSeriesButton_Clicked(object sender, ImageClickEventArgs e) { if (DeletingSeries==null || DeletingSeries.Count==0) return; Study study = DeletingSeries[0].Study; string serverPartitionAE = DeletingSeries[0].ServerPartitionAE; if (Page.IsValid) { try { var reason = ReasonListBox.SelectedItem.Text; if (!String.IsNullOrEmpty(SaveReasonAsName.Text)) { reason = SaveReasonAsName.Text; SaveCustomReason(); } OnDeletingSeries(); StudyController controller = new StudyController(); if(DeleteEntireStudy) { try { controller.DeleteStudy(DeletingSeries[0].StudyKey, reason + ImageServerConstants.ReasonCommentSeparator[0] + Comment.Text); } catch (Exception ex) { Platform.Log(LogLevel.Error, ex); StringBuilder log = new StringBuilder(); log.AppendLine(string.Format("Unable to delete all series in study {0} on partition {1}", study.StudyInstanceUid, serverPartitionAE)); log.AppendLine(ex.Message); Platform.Log(LogLevel.Error, log.ToString()); throw; } } else { try { IList<Series> series = new List<Series>(); foreach (DeleteSeriesInfo seriesInfo in DeletingSeries) { series.Add((seriesInfo.Series)); } controller.DeleteSeries(DeletingSeries[0].Study, series, reason + ImageServerConstants.ReasonCommentSeparator[0] + Comment.Text); } catch (Exception ex) { Platform.Log(LogLevel.Error, ex); StringBuilder log = new StringBuilder(); log.AppendLine(string.Format("Unable to delete the following series in study {0} on partition {1}", study.StudyInstanceUid, serverPartitionAE)); foreach (var series in DeletingSeries) { log.AppendLine(string.Format("\tSeries #{0} {1} {2}", series.SeriesNumber, series.Description, series.Modality)); } log.AppendLine(ex.Message); Platform.Log(LogLevel.Error, log.ToString()); throw; } } OnSeriesDeleted(study); } finally { Close(); } } else { EnsureDialogVisible(); } }
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(); } }