示例#1
0
 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();
             }
         }
     }
 }
示例#2
0
		public void EventHandler(object sender, StudyEditedEventArgs e)
		{
			IPersistentStore store = PersistentStoreRegistry.GetDefaultStore();
			using (IUpdateContext ctx = store.OpenUpdateContext(UpdateContextSyncMode.Flush))
			{
				Platform.Log(LogLevel.Info, "Logging study history record...");
				IStudyHistoryEntityBroker broker = ctx.GetBroker<IStudyHistoryEntityBroker>();
				StudyHistoryUpdateColumns recordColumns = CreateStudyHistoryRecord(e);
				StudyHistory entry = broker.Insert(recordColumns);
				if (entry != null)
					ctx.Commit();
				else
					throw new ApplicationException("Unable to log study history record");
			}
		}
示例#3
0
        public static StudyHistory CreateStudyHistoryRecord(IUpdateContext updateContext,
                                                            StudyStorageLocation primaryStudyLocation, StudyStorageLocation secondaryStudyLocation,
                                                            StudyHistoryTypeEnum type, object entryInfo, object changeLog)
        {
            StudyHistoryUpdateColumns columns = new StudyHistoryUpdateColumns
            {
                InsertTime           = Platform.Time,
                StudyHistoryTypeEnum = type,
                StudyStorageKey      = primaryStudyLocation.GetKey(),
                DestStudyStorageKey  =
                    secondaryStudyLocation != null
                                                                                        ? secondaryStudyLocation.GetKey()
                                                                                        : primaryStudyLocation.GetKey(),
                StudyData         = XmlUtils.SerializeAsXmlDoc(entryInfo) ?? new XmlDocument(),
                ChangeDescription = XmlUtils.SerializeAsXmlDoc(changeLog) ?? new XmlDocument()
            };

            IStudyHistoryEntityBroker broker = updateContext.GetBroker <IStudyHistoryEntityBroker>();

            return(broker.Insert(columns));
        }
        private void LogHistory(ImageSetDetails details)
        {
            IPersistentStore store = PersistentStoreRegistry.GetDefaultStore();

            using (IUpdateContext ctx = store.OpenUpdateContext(UpdateContextSyncMode.Flush))
            {
                Platform.Log(LogLevel.Info, "Logging study history record...");
                IStudyHistoryEntityBroker broker        = ctx.GetBroker <IStudyHistoryEntityBroker>();
                StudyHistoryUpdateColumns recordColumns = CreateStudyHistoryRecord(details);
                StudyHistory entry = broker.Insert(recordColumns);
                if (entry != null)
                {
                    ctx.Commit();
                }
                else
                {
                    throw new ApplicationException("Unable to log study history record");
                }
            }

            HistoryLogged = true;
        }