Пример #1
0
        private static bool CanAccessDatabase(out string errorString)
        {
            bool result = true;

            errorString = string.Empty;

            IWorklistDataAccessAgent agent = null;

            if (DataAccessServices.IsDataAccessServiceRegistered <IWorklistDataAccessAgent>())
            {
                agent = DataAccessServices.GetDataAccessService <IWorklistDataAccessAgent>();
            }
            if (agent == null)
            {
                errorString = "Error: Cannot create IWorklistDataAccessAgent";
                return(false);
            }

            try
            {
                agent.GetPatientIDs();
            }
            catch (Exception ex)
            {
                errorString = ex.Message;
                result      = false;
            }
            return(result);
        }
Пример #2
0
        public void InitializeDatabase()
        {
            System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(Module.ServiceDirectory);

            if (!DataAccessServices.IsDataAccessServiceRegistered <IAeManagementDataAccessAgent>())
            {
                _ConfigView        = new AeManagementDataAccessConfigurationView(configuration, null, Module.ServiceName);
                _aeManagementAgent = DataAccessFactory.GetInstance(_ConfigView).CreateDataAccessAgent <IAeManagementDataAccessAgent>();
                DataAccessServices.RegisterDataAccessService <IAeManagementDataAccessAgent>(_aeManagementAgent);
            }
            else
            {
                _aeManagementAgent = DataAccessServices.GetDataAccessService <IAeManagementDataAccessAgent>();
            }

            if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>())
            {
                _StorageAgent = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IStorageDataAccessAgent>();
                DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent>(_StorageAgent);
            }
            else
            {
                _StorageAgent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();
            }
        }
Пример #3
0
        /// <summary>
        /// Initiates the reset process.
        /// </summary>
        /// <param name="range">The date range to reset.</param>
        private static void Reset(DateRange range)
        {
            try
            {
                IExternalStoreDataAccessAgent externalStoreAgent;

                if (!DataAccessServices.IsDataAccessServiceRegistered <IExternalStoreDataAccessAgent>())
                {
                    System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(Module.ServiceDirectory);
                    externalStoreAgent = DataAccessFactory.GetInstance(new ExternalStoreDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IExternalStoreDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IExternalStoreDataAccessAgent>(externalStoreAgent);
                }
                else
                {
                    externalStoreAgent = DataAccessServices.GetDataAccessService <IExternalStoreDataAccessAgent>();
                }

                if (externalStoreAgent != null)
                {
                    new ResetProcess(Module.ServerAE).Run(externalStoreAgent, range);
                }
            }
            catch (Exception e)
            {
                Logger.Global.SystemLogException(e, Module.ServiceName);
            }
        }
Пример #4
0
        private static bool CanAccessDatabase(out string errorString)
        {
            bool result = true;

            errorString = string.Empty;

            IStorageDataAccessAgent agent = null;

            if (DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>())
            {
                agent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();
            }
            if (agent == null)
            {
                errorString = "Error: Cannot create IStorageDataAccessAgent";
                return(false);
            }
            agent.MaxQueryResults = 10;
            try
            {
                agent.IsPatientsExists("patientIdNotUsed");
            }
            catch (Exception ex)
            {
                errorString = ex.Message;
                result      = false;
            }
            return(result);
        }
Пример #5
0
        /// <summary>
        /// Initiates the reset process.
        /// </summary>
        /// <param name="range">The date range to reset.</param>
        private void Reset(DateRange range)
        {
            try
            {
                IForwardDataAccessAgent forwardAgent;

                if (!DataAccessServices.IsDataAccessServiceRegistered <IForwardDataAccessAgent>())
                {
                    System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(Module.ServiceDirectory);
                    forwardAgent = DataAccessFactory.GetInstance(new ForwardDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IForwardDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IForwardDataAccessAgent>(forwardAgent);
                }
                else
                {
                    forwardAgent = DataAccessServices.GetDataAccessService <IForwardDataAccessAgent>();
                }

                if (forwardAgent != null)
                {
                    new ResetProcess(Module.ServerAE).Run(forwardAgent, range);
                }
            }
            catch (Exception e)
            {
                Logger.Global.SystemMessage(LogType.Error, e.Message, Module.ServerAE);
            }
        }
Пример #6
0
        private static void RegisterDataAccessAgents(string serviceDirectory, string serviceName)
        {
            if (!DataAccessServices.IsDataAccessServiceRegistered <ILoggingDataAccessAgent2> ( ))
            {
                ILoggingDataAccessAgent2 loggingDataAccess;


                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(serviceDirectory);
                loggingDataAccess = DataAccessFactory.GetInstance(new LoggingDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <ILoggingDataAccessAgent2> ( );

                DataAccessServices.RegisterDataAccessService <ILoggingDataAccessAgent2> (loggingDataAccess);
            }


            try
            {
                if (!DataAccessServices.IsDataAccessServiceRegistered <IOptionsDataAccessAgent> ( ))
                {
                    IOptionsDataAccessAgent optionsDataAccess;


                    System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(serviceDirectory);
                    optionsDataAccess = DataAccessFactory.GetInstance(new OptionsDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IOptionsDataAccessAgent> ( );

                    DataAccessServices.RegisterDataAccessService <IOptionsDataAccessAgent> (optionsDataAccess);
                }
            }
            catch (Exception)
            {
                // Workstation does not use IOptionsDataAccessAgent, so ignore if not registered
            }
        }
Пример #7
0
        public override void AddServices( )
        {
            Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(ServiceDirectory);
            DicomServer   server        = ServiceLocator.Retrieve <DicomServer>();
            string        serviceName   = server.Name;

            if (!DataAccessServices.IsDataAccessServiceRegistered <IForwardDataAccessAgent> ( ))
            {
                IForwardDataAccessAgent dataAccess = DataAccessFactory.GetInstance(new ForwardDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IForwardDataAccessAgent>();

                DataAccessServices.RegisterDataAccessService <IForwardDataAccessAgent> (dataAccess);
            }

            RegisterGatewayServer( );

            RegisterForwardService( );

            SettingsChangedNotifier settingsChanged;

            if (!ServiceLocator.IsRegistered <SettingsChangedNotifier> ( ))
            {
                settingsChanged = new SettingsChangedNotifier(__Settings);

                ServiceLocator.Register <SettingsChangedNotifier> (settingsChanged);
            }
            else
            {
                settingsChanged = ServiceLocator.Retrieve <SettingsChangedNotifier> (  );
            }

            settingsChanged.SettingsChanged += new EventHandler(settingsChanged_SettingsChanged);

            settingsChanged.Enabled = true;
        }
Пример #8
0
        static void RegisterDataAccessAgents(string serviceName)
        {
            System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(ServiceDirectory);
            if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent> ( ))
            {
                IStorageDataAccessAgent storageDataAccess = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IStorageDataAccessAgent> ( );

                DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent> (storageDataAccess);

                DataAccess = storageDataAccess;
            }
            else
            {
                DataAccess = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();
            }

            if (!DataAccessServices.IsDataAccessServiceRegistered <IPermissionManagementDataAccessAgent> ( ))
            {
                try
                {
                    IPermissionManagementDataAccessAgent permissionsDataAccess = DataAccessFactory.GetInstance(new AePermissionManagementDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IPermissionManagementDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IPermissionManagementDataAccessAgent>(permissionsDataAccess);

                    PermissionsAgent = permissionsDataAccess;
                }
                catch (Exception)
                {
                }
            }
            else
            {
                PermissionsAgent = DataAccessServices.GetDataAccessService <IPermissionManagementDataAccessAgent>();
            }

            if (!DataAccessServices.IsDataAccessServiceRegistered <IOptionsDataAccessAgent> ( ))
            {
                try
                {
                    IOptionsDataAccessAgent optionsDataAccess = DataAccessFactory.GetInstance(new OptionsDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IOptionsDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IOptionsDataAccessAgent>(optionsDataAccess);
                }
                catch (Exception)
                {
                }
            }

            //TODO: Check if workstastion data access is registered if not then check if config information
            //is available. create only if config options available otherwise don't.
            //the database manager will use the ws dataAccess only if registered.
            //if ( !DataAccessServices.IsDataAccessServiceRegistered <IWorkstationDataAccess> ( ) )
            //{
            //   IOptionsDataAccessAgent optionsDataAccess = DataAccessFactory.GetInstance ( new OptionsDataAccessConfigurationView (configuration, null, serviceName) ).CreateDataAccessAgent <IOptionsDataAccessAgent> ( ) ;

            //   DataAccessServices.RegisterDataAccessService <IOptionsDataAccessAgent> ( optionsDataAccess ) ;
            //}
        }
Пример #9
0
        public static void RegisterInterfaces()
        {
#if TUTORIAL_CUSTOM_DATABASE
            // The 'RegisterInterfaces' method is implemented as part of the "Changing the LEAD HTML5 Medical Viewer to use a different database schema" tutorial.
            // For the tutorial, 'RegisterInterfaces' is used to register custom classes that you define to interact with a custom database.
            // For the shipping version, the 'RegisterInterfaces' does nothing
            //
            // Since the WCF services are stateless (below), this method is called before using any of the services.
            // The AddinsFactory class is used to generate the addins required by each of the services.
            // So the AddinsFactory constructor calls 'RegisterInterfaces' if it has not already been called.
            //
            // WCF Services:
            // * AuthenticationService
            // * ObjectRetrieveService
            // * PacsQueryService
            // * PACSRetrieveService
            // * StoreService
            //
            // The MyPatientInfo, MyStudyInfo, MySeriesInfo, and MyInstanceInfo classes are used for extracting DICOM data from a System.Data.DataRow.
            // The MyStorageSqlDbDataAccessAgent and MyStorageDataAccessConfigurationView classes are used for accessing your custom database
            // The MyPatient, MyStudy, MySeries, and MyInstance classes are used to generate the WHERE statement of the database query
            // For more details, see the "Changing the LEAD HTML5 Medical Viewer to use a different database schema" tutorial.

            if (!DataAccessServiceLocator.IsRegistered <IPatientInfo>())
            {
                DataAccessServiceLocator.Register <IPatientInfo>(new MyPatientInfo());
            }

            if (!DataAccessServiceLocator.IsRegistered <IStudyInfo>())
            {
                DataAccessServiceLocator.Register <IStudyInfo>(new MyStudyInfo());
            }

            if (!DataAccessServiceLocator.IsRegistered <ISeriesInfo>())
            {
                DataAccessServiceLocator.Register <ISeriesInfo>(new MySeriesInfo());
            }

            if (!DataAccessServiceLocator.IsRegistered <IInstanceInfo>())
            {
                DataAccessServiceLocator.Register <IInstanceInfo>(new MyInstanceInfo());
            }

            if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent3>())
            {
                System.Configuration.Configuration configuration     = ServiceUtils.GetGlobalPacsConfig();
                IStorageDataAccessAgent3           storageDataAccess = DataAccessFactory.GetInstance(new MyStorageDataAccessConfigurationView(configuration, ServiceUtils.ProductNameStorageServer, null)).CreateDataAccessAgent <IStorageDataAccessAgent3>();
                DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent3>(storageDataAccess);
            }

            RegisteredEntities.AddItem(RegisteredEntities.PatientEntityName, typeof(MyPatient));
            RegisteredEntities.AddItem(RegisteredEntities.StudyEntityName, typeof(MyStudy));
            RegisteredEntities.AddItem(RegisteredEntities.SeriesEntityName, typeof(MySeries));
            RegisteredEntities.AddItem(RegisteredEntities.InstanceEntityName, typeof(MyInstance));
#endif
        }
Пример #10
0
        public void RunView(ForwardManagerConfigurationView view, AdvancedSettings settings)
        {
            ForwardOptions clonedOptions;

            _View     = view;
            _Settings = settings;

            if (!DataAccessServices.IsDataAccessServiceRegistered <IAeManagementDataAccessAgent>())
            {
                throw new InvalidOperationException(typeof(IAeManagementDataAccessAgent).Name + " is not registered.");
            }

            _AccessAgent = DataAccessServices.GetDataAccessService <IAeManagementDataAccessAgent>();

            if (settings != null)
            {
                try
                {
                    _Options = _Settings.GetAddInCustomData <ForwardOptions>(_addinName, _customDataName);
                    if (_Options == null)
                    {
                        _Options = new ForwardOptions();
                        _Settings.SetAddInCustomData <ForwardOptions>(_addinName, _customDataName, _Options);
                        _Settings.Save();
                    }
                }
                catch (Exception e)
                {
                    Logger.Global.Exception("Forwarder", e);
                    if (_Options == null)
                    {
                        _Options = new ForwardOptions();
                    }
                }

                clonedOptions = Clone(_Options);
                _View.Initialize(clonedOptions);
                _View.Enabled = false;
            }
            _View.SetAeTitles(_AccessAgent.GetAeTitles());

            _View.Forward         += new EventHandler <ForwardMessageEventArgs>(View_Forward);
            _View.Clean           += new EventHandler <SendMessageEventArgs>(View_Clean);
            _View.Reset           += new EventHandler <ResetEventArgs>(View_Reset);
            _View.SettingsChanged += new EventHandler(View_SettingsChanged);

#if LEADTOOLS_V18_OR_LATER
            _View.CancelForward += new EventHandler <EventArgs>(View_CancelForward);
            _View.CancelClean   += new EventHandler <EventArgs>(View_CancelClean);
#endif // #if LEADTOOLS_V18_OR_LATER
            EventBroker.Instance.Subscribe <ClientAddedEventArgs>(new EventHandler <ClientAddedEventArgs>(OnClientAdded));
            EventBroker.Instance.Subscribe <ClientRemovedEventArgs>(new EventHandler <ClientRemovedEventArgs>(OnClientRemoved));
            EventBroker.Instance.Subscribe <ClientUpdatedEventArgs>(new EventHandler <ClientUpdatedEventArgs>(OnClientUpdated));
        }
Пример #11
0
        public static void StartExternalStoreJobs(ExternalStoreAddinConfigAbstract addinExternalStoreAddinConfig, string addinFriendlyName)
        {
            ExternalStoreItem item = null;

            if (Options != null)
            {
                item = Options.GetCurrentOption();
            }
            if ((item != null) && (addinExternalStoreAddinConfig != null) && (item.ExternalStoreAddinConfig.Equals(addinExternalStoreAddinConfig)))
            {
                ICrud crud = item.ExternalStoreAddinConfig.GetCrudInterface();
                crud.Initialize();
                DataAccessServiceLocator.Register <ICrud>(crud);
                DataAccessServiceLocator.Register <ICrud>(crud, crud.ExternalStoreGuid);

                StorageConfigManager = new StorageModuleConfigurationManager(true);
                StorageConfigManager.Load(ServiceDirectory);
                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(_serviceDirectory);
                IExternalStoreDataAccessAgent      externalStoreAgent;
                if (!DataAccessServices.IsDataAccessServiceRegistered <IExternalStoreDataAccessAgent>())
                {
                    externalStoreAgent = DataAccessFactory.GetInstance(new ExternalStoreDataAccessConfigurationView(configuration, null, _displayName)).CreateDataAccessAgent <IExternalStoreDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IExternalStoreDataAccessAgent>(externalStoreAgent);
                }
                else
                {
                    externalStoreAgent = DataAccessServices.GetDataAccessService <IExternalStoreDataAccessAgent>();
                }

                IStorageDataAccessAgent storageAgent;
                if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>())
                {
                    storageAgent = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, _displayName)).CreateDataAccessAgent <IStorageDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent>(storageAgent);
                }
                else
                {
                    storageAgent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();
                }

                string sDebug = string.Format("{0}: Module.StartOrStopAddin()  -- new JobManager()", addinFriendlyName);
                ExternalStorePresenter.MyDumpExternalStoreOptions(sDebug, Options);
                JobManager = new JobManager(Options, externalStoreAgent, storageAgent, ServiceName, StorageConfigManager.GetStorageAddInsSettings());

                JobManager.ExternalStoreGuid = item.ExternalStoreAddinConfig.Guid;

                if (IsLicenseValid())
                {
                    sDebug = string.Format("{0}: Module.StartOrStopAddin()  -- JobManager.Start", addinFriendlyName);
                    DicomUtilities.DebugString(DebugStringOptions.ShowCounter, sDebug);
                    JobManager.Start();
                }
            }
        }
Пример #12
0
        private IOptionsDataAccessAgent GetOptionsDataAccessAgent()
        {
            if (!DataAccessServices.IsDataAccessServiceRegistered <IOptionsDataAccessAgent>())
            {
                // Here need to check if OptionsAgent is registered in GlobalPacsConfig or machine.config
                // If not, just return
                // throw new InvalidOperationException(typeof(IOptionsDataAccessAgent).Name + " is not registered.");
                return(null);
            }

            return(DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent>());
        }
Пример #13
0
        internal static string FindReferencedFile(
#if LEADTOOLS_V19_OR_LATER
            IExternalStoreDataAccessAgent externalStoreAgent,
#endif // #if LEADTOOLS_V19_OR_LATER
            string sopInstanceUID)
        {
            MatchingParameterCollection          mpc = new MatchingParameterCollection();
            MatchingParameterList                mpl = new MatchingParameterList();
            DataSet /*CompositeInstanceDataSet*/ instanceData;
            IStorageDataAccessAgent              agent = null;
            string referencedFile = string.Empty;

            if (DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>())
            {
                agent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();
            }

            if (agent != null)
            {
                ICatalogEntity instanceEntity = RegisteredEntities.GetInstanceEntity(sopInstanceUID);
                mpl.Add(instanceEntity);
                mpc.Add(mpl);

                instanceData = agent.QueryCompositeInstances(mpc);
                if (instanceData.Tables[DataTableHelper.InstanceTableName].Rows.Count == 1)
                {
                    DataRow row = instanceData.Tables[DataTableHelper.InstanceTableName].Rows[0];
                    referencedFile = RegisteredDataRows.InstanceInfo.ReferencedFile(row);

#if (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V19_OR_LATER)
                    if (string.IsNullOrEmpty(referencedFile))
                    {
                        // If empty, it might be on the cloud
                        // Use DicomInstanceRetrieveExternalStoreCommand with cache set to true to copy it locally
                        if (externalStoreAgent == null)
                        {
                            if (DataAccessServices.IsDataAccessServiceRegistered <IExternalStoreDataAccessAgent>())
                            {
                                externalStoreAgent = DataAccessServices.GetDataAccessService <IExternalStoreDataAccessAgent>();
                            }
                        }

                        DicomInstanceRetrieveExternalStoreCommand c = new DicomInstanceRetrieveExternalStoreCommand(agent, externalStoreAgent, AddInsSession.ServiceDirectory, true);
                        DicomDataSet ds = c.GetDicomDataSet(row, out referencedFile);
                    }
#endif // (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V19_OR_LATER)
                }
            }
            return(referencedFile);
        }
Пример #14
0
        /// <summary>
        /// Initiates the 'External Store' operation.
        /// </summary>
        private static void ExternalStore(string externalStoreGuid)
        {
            try
            {
                IExternalStoreDataAccessAgent externalStoreAgent;
                IStorageDataAccessAgent       storageAgent;

                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(Module.ServiceDirectory);

                // External Store Agent
                if (!DataAccessServices.IsDataAccessServiceRegistered <IExternalStoreDataAccessAgent>())
                {
                    externalStoreAgent = DataAccessFactory.GetInstance(new ExternalStoreDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IExternalStoreDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IExternalStoreDataAccessAgent>(externalStoreAgent);
                }
                else
                {
                    externalStoreAgent = DataAccessServices.GetDataAccessService <IExternalStoreDataAccessAgent>();
                }

                // Storage Agent
                if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>())
                {
                    storageAgent = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IStorageDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent>(storageAgent);
                }
                else
                {
                    storageAgent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();
                }

                if (externalStoreAgent != null && storageAgent != null)
                {
                    ExternalStoreOptions options = Module.Options;
                    if (options != null)
                    {
                        new ExternalStoreProcess(Module.Options, externalStoreGuid, Module.ServiceName).Run(externalStoreAgent, storageAgent);
                    }
                    else
                    {
                        string message = string.Format("Before using the 'External Store' tools, you must configure an 'External Store' addin and then click the 'Apply' button.");
                        Logger.Global.SystemMessage(LogType.Error, message, Module.ServiceName);
                    }
                }
            }
            catch (Exception e)
            {
                Logger.Global.SystemLogException(e, Module.ServiceName);
            }
        }
Пример #15
0
        private static T GetDataAccess <T>(DataAccessConfigurationView configView)
        {
            T service;

            if (!DataAccessServices.IsDataAccessServiceRegistered <T>())
            {
                service = DataAccessFactory.GetInstance(configView).CreateDataAccessAgent <T>();
                DataAccessServices.RegisterDataAccessService <T>(service);
            }
            else
            {
                service = DataAccessServices.GetDataAccessService <T>();
            }
            return(service);
        }
Пример #16
0
        public static T GetAgent <T>(System.Configuration.Configuration configuration, DataAccessConfigurationView view)
        {
            T agent;

            if (!DataAccessServices.IsDataAccessServiceRegistered <T>())
            {
                agent = DataAccessFactory.GetInstance(view).CreateDataAccessAgent <T>();
                DataAccessServices.RegisterDataAccessService <T>(agent);
            }
            else
            {
                agent = DataAccessServices.GetDataAccessService <T>();
            }
            return(agent);
        }
Пример #17
0
        public void Initialize(AdvancedSettings advancedSettings, ServerSettings Settings, string ServerDirectory)
        {
            _AdvancedSettings = advancedSettings;
            _Settings         = Settings;

            if (!DataAccessServices.IsDataAccessServiceRegistered <IAeManagementDataAccessAgent>())
            {
                _AccessAgent = DataAccessFactory.GetInstance(new AeManagementDataAccessConfigurationView(DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(ServerDirectory), null, Settings.ServiceName)).CreateDataAccessAgent <IAeManagementDataAccessAgent>();

                DataAccessServices.RegisterDataAccessService <IAeManagementDataAccessAgent>(_AccessAgent);
            }

            _ConfigureDialog = new ConfigureDialog();
            _Presenter       = new ForwardManagerPresenter();
            _Presenter.RunView(_ConfigureDialog.View, _AdvancedSettings);
        }
Пример #18
0
        static void RegisterDataAccessAgents(string serviceName)
        {
            System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(ServiceDirectory);
            if (!DataAccessServices.IsDataAccessServiceRegistered <IWorklistDataAccessAgent> ( ))
            {
                IWorklistDataAccessAgent worklistDataAccess = DataAccessFactory.GetInstance(new WorklistDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IWorklistDataAccessAgent> ( );

                DataAccessServices.RegisterDataAccessService <IWorklistDataAccessAgent> (worklistDataAccess);

                DataAccess = worklistDataAccess;
            }
            else
            {
                DataAccess = DataAccessServices.GetDataAccessService <IWorklistDataAccessAgent>();
            }
        }
        public void ConfigureCommand(DicomCommand command)
        {
            try
            {
                AdvancedSettings            settings;
                WorklistAddInsConfiguration worklistConfig;

                settings       = AdvancedSettings.Open(AddInsSession.ServiceDirectory);
                worklistConfig = GetWorklistAddInsSettings(settings);



                if (null != worklistConfig)
                {
                    if (DataAccessServices.IsDataAccessServiceRegistered <IWorklistDataAccessAgent> ( ))
                    {
                        IWorklistDataAccessAgent dataAccess = DataAccessServices.GetDataAccessService <IWorklistDataAccessAgent> ( );

                        if (dataAccess is WorklistDbDataAccessAgent)
                        {
                            if (worklistConfig.LimitNumberOfResponses)
                            {
                                (( WorklistDbDataAccessAgent )dataAccess).NumberOfMatchingWlResponses = worklistConfig.NumberOfMatchingResponses;
                            }
                            else
                            {
                                (( WorklistDbDataAccessAgent )dataAccess).NumberOfMatchingWlResponses = -1;
                            }
                        }
                    }

                    if (command is CFindCommand)
                    {
                        ConfigureCFindCommand(command, worklistConfig);
                    }

                    if (command is MWLCFindCommand)
                    {
                        ConfigureQueryCFindCommand(command, worklistConfig);
                    }
                }
            }
            catch (Exception exception)
            {
                LogEvent("Failed to configure Modality Worklist CFind Command, default configuration will be applied.^\n" + exception.Message, command.RequestDataSet);
            }
        }
Пример #20
0
        private IStorageDataAccessAgent GetDataAccessAgent()
        {
            if (_ciStorage == null)
            {
                return(null);
            }

            IStorageDataAccessAgent db = null;

            if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>())
            {
                throw new InvalidOperationException(typeof(IStorageDataAccessAgent).Name + " is not registered.");
            }

            db = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();

            return(db);
        }
Пример #21
0
        static void RegisterDataAccessAgents(string serviceDirectory, string serviceName)
        {
            System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(serviceDirectory);


            if (!DataAccessServices.IsDataAccessServiceRegistered <IDownloadJobsDataAccessAgent>())
            {
                try
                {
                    IDownloadJobsDataAccessAgent downloadDataAccess = DataAccessFactory.GetInstance(new DownloadJobsDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IDownloadJobsDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IDownloadJobsDataAccessAgent>(downloadDataAccess);
                }
                catch (Exception)
                {
                }
            }
        }
Пример #22
0
        public void RunView(AutoCopyView view, AdvancedSettings settings)
        {
            AutoCopyOptions clonedOptions;

            _view     = view;
            _Settings = settings;


            if (!DataAccessServices.IsDataAccessServiceRegistered <IAeManagementDataAccessAgent> ( ))
            {
                throw new InvalidOperationException(typeof(IAeManagementDataAccessAgent).Name + " is not registered.");
            }

            _aeAccessAgent = DataAccessServices.GetDataAccessService <IAeManagementDataAccessAgent> ( );

            if (settings != null)
            {
                try
                {
                    _Options = _Settings.GetAddInCustomData <AutoCopyOptions>("Auto Copy", "AutoCopyOptions");
                    if (_Options == null)
                    {
                        _Options = new AutoCopyOptions();
                        _Settings.SetAddInCustomData <AutoCopyOptions>("Auto Copy", "AutoCopyOptions", _Options);
                        _Settings.Save();
                    }
                }
                catch (Exception e)
                {
                    Logger.Global.Exception("Auto Copy", e);
                    if (_Options == null)
                    {
                        _Options = new AutoCopyOptions();
                    }
                }

                clonedOptions = Clone(_Options);
                view.Initialize(clonedOptions, AUTOCOPY_RELATION, _aeAccessAgent);
                _view.SettingsChanged += new EventHandler(View_SettingsChanged);
            }

            EventBroker.Instance.Subscribe <ClientAddedEventArgs>(new EventHandler <ClientAddedEventArgs>(OnClientAdded));
            EventBroker.Instance.Subscribe <ClientRemovedEventArgs>(new EventHandler <ClientRemovedEventArgs>(OnClientRemoved));
        }
Пример #23
0
        private static IUserManagementDataAccessAgent GetDataAccessAgent( )
        {
            IUserManagementDataAccessAgent datasetDataAccessAgent;


            if (!DataAccessServices.IsDataAccessServiceRegistered <IUserManagementDataAccessAgent>())
            {
                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsConfiguration();
                datasetDataAccessAgent = DataAccessFactory.GetInstance(new UserManagementDataAccessConfigurationView(configuration, PacsProduct.ProductName, PacsProduct.ServiceName)).CreateDataAccessAgent <IUserManagementDataAccessAgent>();

                DataAccessServices.RegisterDataAccessService <IUserManagementDataAccessAgent>(datasetDataAccessAgent);
            }
            else
            {
                datasetDataAccessAgent = DataAccessServices.GetDataAccessService <IUserManagementDataAccessAgent>();
            }

            return(datasetDataAccessAgent);
        }
Пример #24
0
        private static void Restore(string externalStoreGuid, DateRange range)
        {
            try
            {
                IExternalStoreDataAccessAgent externalStoreAgent;
                IStorageDataAccessAgent       storageAgent;

                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(Module.ServiceDirectory);

                if (!DataAccessServices.IsDataAccessServiceRegistered <IExternalStoreDataAccessAgent>())
                {
                    externalStoreAgent = DataAccessFactory.GetInstance(new ExternalStoreDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IExternalStoreDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IExternalStoreDataAccessAgent>(externalStoreAgent);
                }
                else
                {
                    externalStoreAgent = DataAccessServices.GetDataAccessService <IExternalStoreDataAccessAgent>();
                }

                if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>())
                {
                    storageAgent = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IStorageDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent>(storageAgent);
                }
                else
                {
                    storageAgent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();
                }

                if (externalStoreAgent != null && storageAgent != null)
                {
                    StorageAddInsConfiguration storageAddinsConfiguration = Module.StorageConfigManager.GetStorageAddInsSettings();

                    new RestoreProcess(Module.Options, externalStoreGuid, Module.ServiceName, storageAddinsConfiguration).Run(externalStoreAgent, storageAgent, range);
                }
            }
            catch (Exception e)
            {
                Logger.Global.SystemLogException(e, Module.ServiceName);
            }
        }
Пример #25
0
        public DicomFileDeleter()
        {
            try
            {
                if (!DataAccessServices.IsDataAccessServiceRegistered <IWorkstationDataAccessAgent>())
                {
                    wsAgent = DataAccessFactory.GetInstance(new WorkstationDataAccessConfigurationView(/*DicomDemoSettingsManager.GetGlobalPacsConfiguration(), PacsProduct.ProductName, null*/)).CreateDataAccessAgent <IWorkstationDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IWorkstationDataAccessAgent>(wsAgent);
                }
                else
                {
                    wsAgent = DataAccessServices.GetDataAccessService <IWorkstationDataAccessAgent>();
                }
            }
            catch
            {
                wsAgent = null;
            }
            _DeleteReferencedImagesOnImageDelete = true;
        }
Пример #26
0
        public void RunView(PatientUpdaterConfigurationView view, string serviceDirectory)
        {
            _ServiceDirectory = serviceDirectory;
            _view             = view;

            if (!DataAccessServices.IsDataAccessServiceRegistered <IOptionsDataAccessAgent> ( ))
            {
                throw new InvalidOperationException(typeof(IOptionsDataAccessAgent).Name + " is not registered.");
            }

            if (!DataAccessServices.IsDataAccessServiceRegistered <IAeManagementDataAccessAgent> ( ))
            {
                throw new InvalidOperationException(typeof(IAeManagementDataAccessAgent).Name + " is not registered.");
            }

            _aeAccessAgent = DataAccessServices.GetDataAccessService <IAeManagementDataAccessAgent> ( );

            _view.SettingsChanged += new EventHandler(View_SettingsChanged);

            EventBroker.Instance.Subscribe <ClientAddedEventArgs>(new EventHandler <ClientAddedEventArgs>(OnClientAdded));
            EventBroker.Instance.Subscribe <ClientRemovedEventArgs>(new EventHandler <ClientRemovedEventArgs>(OnClientRemoved));

            InitializeView();
            view.RequireStationNameChanged          += new EventHandler(view_RequireStationNameChanged);
            view.RequireOperatorsNameChanged        += new EventHandler(view_RequireOperatorsNameChanged);
            view.RequireTransactionUidChanged       += new EventHandler(view_RequireTransactionUidChanged);
            view.RequireTransactionDateChanged      += new EventHandler(view_RequireTransactionDateChanged);
            view.RequireTransactionTimeChanged      += new EventHandler(view_RequireTransactionTimeChanged);
            view.RequireDescriptionChanged          += new EventHandler(view_RequireDescriptionChanged);
            view.RequireReasonChanged               += new EventHandler(view_RequireReasonChanged);
            view.AutoUpdateEnableChanged            += new EventHandler(view_AutoUpdateEnableChanged);
            view.EnableRetryChanged                 += new EventHandler(view_EnableRetryChanged);
            view.RetrySecondsChanged                += new EventHandler(view_RetrySecondsChanged);
            view.RetryExpirationDaysChanged         += new EventHandler(view_RetryExpirationDaysChanged);
            view.RetryDirectoryChanged              += new EventHandler(view_RetryDirectoryChanged);
            view.UseCustomAeTitleChanged            += new EventHandler(view_UseCustomAeTitleChanged);
            view.CustomAeTitleChanged               += new EventHandler(view_CustomAeTitleChanged);
            view.AutoUpdateProcessingThreadsChanged += new EventHandler(view_AutoUpdateProcessingThreadsChanged);
        }
Пример #27
0
        /// <summary>
        /// Initiates the clean process.
        /// </summary>
        private void Clean()
        {
            try
            {
                IForwardDataAccessAgent forwardAgent;
                IStorageDataAccessAgent storageAgent;

                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(Module.ServiceDirectory);

                if (!DataAccessServices.IsDataAccessServiceRegistered <IForwardDataAccessAgent>())
                {
                    forwardAgent = DataAccessFactory.GetInstance(new ForwardDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IForwardDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IForwardDataAccessAgent>(forwardAgent);
                }
                else
                {
                    forwardAgent = DataAccessServices.GetDataAccessService <IForwardDataAccessAgent>();
                }

                if (!DataAccessServices.IsDataAccessServiceRegistered <IAeManagementDataAccessAgent>())
                {
                    storageAgent = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IStorageDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent>(storageAgent);
                }
                else
                {
                    storageAgent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();
                }

                if (forwardAgent != null && storageAgent != null)
                {
                    new CleanProcess(Module.Options, Module.ServerAE).Run(forwardAgent, storageAgent);
                }
            }
            catch (Exception e)
            {
                Logger.Global.SystemMessage(LogType.Error, e.Message, Module.ServerAE);
            }
        }
        private void InitializeDataAccess()
        {
            if (!DataAccessServices.IsDataAccessServiceRegistered <IForwardDataAccessAgent>())
            {
                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsConfiguration();
                _forwardAgent = DataAccessFactory.GetInstance(new ForwardDataAccessConfigurationView(configuration, PacsProduct.ProductName, PacsProduct.ServiceName)).CreateDataAccessAgent <IForwardDataAccessAgent>();
                DataAccessServices.RegisterDataAccessService <IForwardDataAccessAgent>(_forwardAgent);
            }
            else
            {
                _forwardAgent = DataAccessServices.GetDataAccessService <IForwardDataAccessAgent>();
            }

            if (_forwardAgent != null)
            {
                _infoTimer      = new System.Threading.Timer(new System.Threading.TimerCallback(UpdateCount));
                VisibleChanged += new EventHandler(ForwardManagerConfigurationView_VisibleChanged);
                if (Visible)
                {
                    _infoTimer.Change(REFRESH_INTERVAL, REFRESH_INTERVAL);
                }
            }
        }
Пример #29
0
        public void Initialize(AdvancedSettings advancedSettings, ServerSettings Settings, string ServerDirectory)
        {
            _AdvancedSettings = advancedSettings;
            _Settings         = Settings;

            if (Settings != null)
            {
                Module.ServiceName = Settings.ServiceName;
            }

            try
            {
                IAeManagementDataAccessAgent aeManagementAgent;

                if (!DataAccessServices.IsDataAccessServiceRegistered <IAeManagementDataAccessAgent>())
                {
                    aeManagementAgent = DataAccessFactory.GetInstance(new AeManagementDataAccessConfigurationView(DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(ServerDirectory), null, Settings.ServiceName)).CreateDataAccessAgent <IAeManagementDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IAeManagementDataAccessAgent>(aeManagementAgent);
                }
                else
                {
                    aeManagementAgent = DataAccessServices.GetDataAccessService <IAeManagementDataAccessAgent>();
                }


                _autoCopyDlg       = new ConfigureDialog( );
                _autoCopyPresenter = new AutoCopyPresenter( );

                _autoCopyPresenter.RunView(_autoCopyDlg.AutoCopyView, advancedSettings);
            }
            catch (Exception e)
            {
                Logger.Global.Exception(Module.Source, e);
            }
        }
Пример #30
0
        public void Initialize(AdvancedSettings advancedSettings, ServerSettings Settings, string ServerDirectory)
        {
            _AdvancedSettings = advancedSettings;
            _Settings         = Settings;

            try
            {
                IOptionsDataAccessAgent      optionsAgent;
                IAeManagementDataAccessAgent aeManagementAgent;


                if (!DataAccessServices.IsDataAccessServiceRegistered <IOptionsDataAccessAgent> ( ))
                {
                    optionsAgent = DataAccessFactory.GetInstance(new OptionsDataAccessConfigurationView(DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(ServerDirectory), null, Settings.ServiceName)).CreateDataAccessAgent <IOptionsDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IOptionsDataAccessAgent>(optionsAgent);
                }

                if (!DataAccessServices.IsDataAccessServiceRegistered <IAeManagementDataAccessAgent> ( ))
                {
                    aeManagementAgent = DataAccessFactory.GetInstance(new AeManagementDataAccessConfigurationView(DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(ServerDirectory), null, Settings.ServiceName)).CreateDataAccessAgent <IAeManagementDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IAeManagementDataAccessAgent>(aeManagementAgent);
                }


                _patientUpdaterDlg       = new ConfigureDialog( );
                _patientUpdaterPresenter = new PatientUpdaterPresenter( );

                _patientUpdaterPresenter.RunView(_patientUpdaterDlg.PatientUpdaterConfigurationView, ServerDirectory);
            }
            catch (Exception e)
            {
                Logger.Global.Exception(Module.Source, e);
            }
        }