/// <summary> /// Delete a Study. /// </summary> public void DeleteStudy(ServerEntityKey studyKey, string reason) { StudySummary study = StudySummaryAssembler.CreateStudySummary(HttpContext.Current.GetSharedPersistentContext(), Study.Load(HttpContext.Current.GetSharedPersistentContext(), studyKey)); if (study.IsReconcileRequired) { throw new ApplicationException( String.Format("Deleting the study is not allowed at this time : there are items to be reconciled.")); // NOTE: another check will occur when the delete is actually processed } using (IUpdateContext ctx = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush)) { StudyDeleteHelper.DeleteStudy(ctx, study.ThePartition, study.StudyInstanceUid, reason); ctx.Commit(); } }
//TODO: Consolidate this and DeleteStudy? public void DeleteSeries(Study study, IList <Series> series, string reason) { // Load the Partition var partitionConfigController = new ServerPartitionConfigController(); ServerPartition partition = partitionConfigController.GetPartition(study.ServerPartitionKey); var seriesUids = new List <string>(); foreach (Series s in series) { seriesUids.Add(s.SeriesInstanceUid); } using (IUpdateContext ctx = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush)) { StudyDeleteHelper.DeleteSeries(ctx, partition, study.StudyInstanceUid, seriesUids, reason); ctx.Commit(); } }