Example #1
0
        public StorageFilestreamHandler(DicomScpContext context, Device remoteDevice, ServerAssociationParameters assoc)
        {
            _context       = context;
            _remoteDevice  = remoteDevice;
            _importContext = new SopInstanceImporterContext(
                String.Format("{0}_{1}", assoc.CallingAE, assoc.TimeStamp.ToString("yyyyMMddhhmmss")),
                assoc.CallingAE, assoc.CalledAE);

            if (_remoteDevice != null && _remoteDevice.DeviceTypeEnum.Equals(DeviceTypeEnum.PrimaryPacs))
            {
                _importContext.DuplicateProcessing = DuplicateProcessingEnum.OverwriteSopAndUpdateDatabase;
            }
        }
Example #2
0
        /// <summary>
        /// Do the actual verification if an association is acceptable.
        /// </summary>
        /// <remarks>
        /// This method primarily checks the remote AE title to see if it is a valid device that can
        /// connect to the partition.
        /// </remarks>
        /// <param name="context">Generic parameter passed in, is a DicomScpParameters instance.</param>
        /// <param name="assocParms">The association parameters.</param>
        /// <param name="result">Output parameter with the DicomRejectResult for rejecting the association.</param>
        /// <param name="reason">Output parameter with the DicomRejectReason for rejecting the association.</param>
        /// <returns>true if the association should be accepted, false if it should be rejected.</returns>
        public static bool Verify(DicomScpContext context, ServerAssociationParameters assocParms, out DicomRejectResult result, out DicomRejectReason reason)
        {
            bool isNew;

            context.Device = DeviceManager.LookupDevice(context.Partition, assocParms, out isNew);

            if (context.Device == null)
            {
                if (context.Partition.AcceptAnyDevice)
                {
                    reason = DicomRejectReason.NoReasonGiven;
                    result = DicomRejectResult.Permanent;
                    return(true);
                }

                reason = DicomRejectReason.CallingAENotRecognized;
                result = DicomRejectResult.Permanent;
                return(false);
            }

            if (context.Device.Enabled == false)
            {
                Platform.Log(LogLevel.Error,
                             "Rejecting association from {0} to {1}.  Device is disabled.",
                             assocParms.CallingAE, assocParms.CalledAE);

                reason = DicomRejectReason.CallingAENotRecognized;
                result = DicomRejectResult.Permanent;
                return(false);
            }

            reason = DicomRejectReason.NoReasonGiven;
            result = DicomRejectResult.Permanent;

            return(true);
        }
        public static void InstancesTransferredAuditLogger(DicomScpContext context, ServerAssociationParameters assocParams, List <StorageInstance> instances)
        {
            Dictionary <string, AuditPatientParticipantObject> list = new Dictionary <string, AuditPatientParticipantObject>();

            foreach (StorageInstance instance in instances)
            {
                string key = instance.PatientId + instance.PatientsName;
                if (!list.ContainsKey(key))
                {
                    AuditPatientParticipantObject patient =
                        new AuditPatientParticipantObject(instance.PatientsName, instance.PatientId);
                    list.Add(key, patient);
                }
            }

            foreach (AuditPatientParticipantObject patient in list.Values)
            {
                // Audit Log
                DicomInstancesTransferredAuditHelper helper =
                    new DicomInstancesTransferredAuditHelper(ServerPlatform.AuditSource,
                                                             EventIdentificationContentsEventOutcomeIndicator.Success,
                                                             EventIdentificationContentsEventActionCode.E,
                                                             assocParams);

                foreach (StorageInstance instance in instances)
                {
                    if (patient.PatientId.Equals(instance.PatientId) &&
                        patient.PatientsName.Equals(instance.PatientsName))
                    {
                        helper.AddStorageInstance(instance);
                    }
                }

                ServerAuditHelper.LogAuditMessage(helper);
            }
        }