protected override void OnInit(EventArgs e) { base.OnInit(e); DeleteConfirmation.Confirmed += delegate { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alertScript", "self.close();", true); DeleteRequest deleteRequest = DeleteConfirmation.Data as DeleteRequest; StudyController studyController = new StudyController(); studyController.DeleteSeries(deleteRequest.SelectedStudy, deleteRequest.Series, deleteRequest.Reason); }; DeleteSeriesButton.Roles = AuthorityTokens.Study.Delete; MoveSeriesButton.Roles = AuthorityTokens.Study.Move; UpdateAuthorityGroupDialog.AuthorityGroupsEdited += UpdateAuthorityGroupDialog_AuthorityGroupsEdited; //DataAccessTabPanel.Visible = Thread.CurrentPrincipal.IsInRole(Macro.Enterprise.Common.AuthorityTokens.Admin.Security.AuthorityGroup); DataAccessTabPanel.Enabled = Thread.CurrentPrincipal.IsInRole(Macro.ImageServer.Enterprise.Authentication.AuthorityTokens.Study.EditDataAccess); }
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(); } }