public static void LogEvent(LogType type, MessageDirection messageDirection, string description, DicomCommandType command, DicomDataSet dataset, PatientUpdaterScu Client, SerializableDictionary <string, object> customInformation) { try { string ae = Client.AETitle; DicomNet net = Client as DicomNet; SerializableDictionary <string, object> logCustomInformation = DicomLogEntry.CustomInformationDicomMessage; if (customInformation != null) { logCustomInformation = new SerializableDictionary <string, object>(); foreach (KeyValuePair <string, object> kvp in customInformation) { logCustomInformation.Add(kvp.Key, kvp.Value); } logCustomInformation.Add(DicomLogEntry.DicomMessageKey, DicomLogEntry.DicomMessageValue); } Logger.Global.Log(Module.Source, Client.CurrentScp.AETitle, Client.CurrentScp.PeerAddress.ToString(), Client.CurrentScp.Port, net.IsAssociated() ? net.Association.Calling : ae, net.HostAddress != null ? net.HostAddress.ToString() : string.Empty, net.IsConnected() ? net.HostPort : -1, command, DateTime.Now, type, messageDirection, description, dataset, logCustomInformation); } catch (Exception) { } }
void scu_BeforeAssociateRequest(object sender, BeforeAssociateRequestEventArgs e) { PatientUpdaterScu scu = sender as PatientUpdaterScu; LogEvent(LogType.Information, MessageDirection.Output, string.Format(ASSOCIATE_REQUEST_SENT, e.Associate.ToString()), DicomCommandType.Undefined, null, scu, null); }
void scu_BeforeNAction(object sender, BeforeNActionEventArgs e) { PatientUpdaterScu scu = sender as PatientUpdaterScu; string message = string.Format(NACTION_PROCESSING_SEND, e.MessageID, e.PresentationID, e.AffectedClass, e.Instance, GetActionInfo(e.ActionType)); //LogEvent(LogType.Information, MessageDirection.None, string.Format("[Auto Update] Sending Auto Update\n{0}", GetUserInformation(scu.Tag as PatientUpdate)), DicomCommandType.Undefined, null, scu, null); LogEvent(LogType.Information, MessageDirection.Output, message, DicomCommandType.NAction, e.DataSet, scu, null); }
void scu_AfterConnect(object sender, AfterConnectEventArgs e) { PatientUpdaterScu scu = sender as PatientUpdaterScu; string message = CONNECT_RESPONSE_RECEIVED; if (e.Error != DicomExceptionCode.Success) { message = string.Format(CONNECT_RESPONSE_RECEIVED_FAILURE, e.Error); } LogEvent(LogType.Information, MessageDirection.Input, message, DicomCommandType.Undefined, null, scu, null); }
public UpdateProcessor(string aetitle) { _Scu = new PatientUpdaterScu(PatientUpdaterAddIn.TemporaryDirectory); _Scu.BeforeNAction += new EventHandler <Leadtools.Dicom.Scu.Common.BeforeNActionEventArgs>(scu_BeforeNAction); _Scu.AfterNAction += new EventHandler <AfterNActionEventArgs>(scu_AfterNAction); _Scu.BeforeConnect += new BeforeConnectDelegate(scu_BeforeConnect); _Scu.AfterConnect += new AfterConnectDelegate(scu_AfterConnect); _Scu.BeforeAssociateRequest += new BeforeAssociationRequestDelegate(scu_BeforeAssociateRequest); _Scu.AfterAssociateRequest += new AfterAssociateRequestDelegate(scu_AfterAssociateRequest); _Scu.BeforeReleaseRequest += new EventHandler(scu_BeforeReleaseRequest); _Scu.AfterReleaseRequest += new EventHandler(scu_AfterReleaseRequest); _Scu.AETitle = Module.Options.UseCustomAE ? Module.Options.AutoUpdateAE : aetitle; }
void scu_AfterAssociateRequest(object sender, AfterAssociateRequestEventArgs e) { PatientUpdaterScu scu = sender as PatientUpdaterScu; if (!e.Rejected) { LogEvent(LogType.Information, MessageDirection.Input, ASSOCIATE_REQUEST_ACCEPTED, DicomCommandType.Undefined, null, scu, null); } else { LogEvent(LogType.Information, MessageDirection.Input, string.Format(ASSOCIATE_REQUEST_REJECTED, e.Reason), DicomCommandType.Undefined, null, scu, null); } }
static public void MergePatient(Dicom.Common.DataTypes.PatientUpdater.MergePatient data, string aeTitle) { var aeSrv = HL7ServerPatientUpdate.DicomServer.AETitle; var ipSrv = HL7ServerPatientUpdate.DicomServer.HostAddress; var portSrv = HL7ServerPatientUpdate.DicomServer.Port; var scp = new DicomScp(IPAddress.Parse(ipSrv), aeSrv, portSrv); var scu = new PatientUpdaterScu(null); scu.AETitle = aeTitle; var status = scu.MergePatient(scp, data); if (status != DicomCommandStatusType.Success) { throw new Exception(status.ToString()); } }
void scu_AfterNAction(object sender, AfterNActionEventArgs e) { PatientUpdaterScu scu = sender as PatientUpdaterScu; string message = string.Format(NACTION_RESPONSE_RECEIVED, e.MessageID, e.PresentationID, e.AffectedClass, e.Instance, GetActionInfo(e.ActionType), e.Status); LogEvent(LogType.Information, MessageDirection.Input, message, DicomCommandType.NAction, e.DataSet, scu, null); if (e.Status == DicomCommandStatusType.MissingAttribute || e.Status == DicomCommandStatusType.AttributeOutOfRange) { message = string.Format("{0} failed. Item not found at destination [{1}]. Item will not be added to update retry queue.", AutoRetryProcessor.Actions[e.ActionType], Scu.CurrentScp.AETitle); UpdateProcessor.LogEvent(LogType.Warning, MessageDirection.None, message, DicomCommandType.NAction, null, scu, null); } else { message = string.Format("Adding {0} action to update retry queue.", AutoRetryProcessor.Actions[e.ActionType]); UpdateProcessor.LogEvent(LogType.Debug, MessageDirection.None, message, DicomCommandType.Undefined, null, scu, null); } }
void scu_BeforeConnect(object sender, BeforeConnectEventArgs e) { PatientUpdaterScu scu = sender as PatientUpdaterScu; LogEvent(LogType.Information, MessageDirection.Output, CONNECT_REQUEST_SENT, DicomCommandType.Undefined, null, scu, null); }
void scu_BeforeReleaseRequest(object sender, EventArgs e) { PatientUpdaterScu scu = sender as PatientUpdaterScu; LogEvent(LogType.Information, MessageDirection.Output, RELEASE_REQUEST_SENT, DicomCommandType.Undefined, null, scu, null); }
void scu_AfterReleaseRequest(object sender, EventArgs e) { PatientUpdaterScu scu = sender as PatientUpdaterScu; LogEvent(LogType.Information, MessageDirection.Input, RELEASE_RESPONSE_RECEIVED, DicomCommandType.Undefined, null, scu, null); }