public void OnCompleted(WebDeleteProcessorContext context, IList <Series> series) { if (series.Count > 0) { Platform.Log(LogLevel.Info, "Logging history.."); DateTime now = Platform.Time; using (IUpdateContext ctx = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush)) { IStudyHistoryEntityBroker broker = ctx.GetBroker <IStudyHistoryEntityBroker>(); StudyHistoryUpdateColumns columns = new StudyHistoryUpdateColumns(); columns.InsertTime = Platform.Time; columns.StudyHistoryTypeEnum = StudyHistoryTypeEnum.SeriesDeleted; columns.StudyStorageKey = context.StorageLocation.Key; columns.DestStudyStorageKey = context.StorageLocation.Key; columns.StudyData = XmlUtils.SerializeAsXmlDoc(_studyInfo); SeriesDeletionChangeLog changeLog = new SeriesDeletionChangeLog(); changeLog.TimeStamp = now; changeLog.Reason = context.Reason; changeLog.UserId = context.UserId; changeLog.UserName = context.UserName; changeLog.Series = CollectionUtils.Map(series, delegate(Series ser) { ServerEntityAttributeProvider seriesWrapper = new ServerEntityAttributeProvider(ser); return(new SeriesInformation(seriesWrapper)); }); columns.ChangeDescription = XmlUtils.SerializeAsXmlDoc(changeLog); StudyHistory history = broker.Insert(columns); if (history != null) { ctx.Commit(); } } } }
public void OnCompleted(WebDeleteProcessorContext context, IList<Series> series) { if (series.Count > 0) { Platform.Log(LogLevel.Info, "Logging history.."); DateTime now = Platform.Time; using(IUpdateContext ctx = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush)) { IStudyHistoryEntityBroker broker = ctx.GetBroker<IStudyHistoryEntityBroker>(); StudyHistoryUpdateColumns columns = new StudyHistoryUpdateColumns(); columns.InsertTime = Platform.Time; columns.StudyHistoryTypeEnum = StudyHistoryTypeEnum.SeriesDeleted; columns.StudyStorageKey = context.StorageLocation.Key; columns.DestStudyStorageKey = context.StorageLocation.Key; columns.StudyData = XmlUtils.SerializeAsXmlDoc(_studyInfo); SeriesDeletionChangeLog changeLog = new SeriesDeletionChangeLog(); changeLog.TimeStamp = now; changeLog.Reason = context.Reason; changeLog.UserId = context.UserId; changeLog.UserName = context.UserName; changeLog.Series = CollectionUtils.Map(series, delegate(Series ser) { ServerEntityAttributeProvider seriesWrapper = new ServerEntityAttributeProvider(ser); return new SeriesInformation(seriesWrapper); }); columns.ChangeDescription = XmlUtils.SerializeAsXmlDoc(changeLog); StudyHistory history = broker.Insert(columns); if (history!=null) ctx.Commit(); } } }