Example #1
0
        public override void Execute( )
        {
            IMediaCreationDataAccessAgent dataAccess;


            if (null != MediaService)
            {
                dataAccess = DataAccessServices.GetDataAccessService <IMediaCreationDataAccessAgent> ( );

                if (null != dataAccess)
                {
                    foreach (MediaCreationManagement mediaObject in MediaService.SelectedMediaItems.ToArray( ))
                    {
                        string creationPath;


                        dataAccess.DeleteMediaObject(mediaObject);

                        MediaService.MediaQueue.Remove(mediaObject);

                        creationPath = mediaObject.GetCreationPath( );

                        try
                        {
                            if (!string.IsNullOrEmpty(creationPath))
                            {
                                Directory.Delete(creationPath, true);
                            }
                        }
                        catch {}
                    }
                }
            }
        }
Example #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>();
            }
        }
Example #3
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);
        }
Example #4
0
        public void RunView(ClientViewerControl view)
        {
            //
            view.ServerSecure = false;
            if (ServerState.Instance.ServerService != null && ServerState.Instance.ServerService.Settings != null)
            {
                view.ServerSecure = ServerState.Instance.ServerService.Settings.Secure;
            }

            EventBroker.Instance.Subscribe <ApplyServerSettingsEventArgs>(OnUpdateServerSettings);
            EventBroker.Instance.Subscribe <CancelServerSettingsEventArgs>(OnCancelServerSettings);
            EventBroker.Instance.Subscribe <ServerSettingsSecureChangedEventArgs>(OnServerSettingsSecureChanged);

            // store the view
            _view = view;
            _view.SettingsChanged += new EventHandler(View_SettingsChanged);
            _view_LoadClients(_view, EventArgs.Empty);
            _view.LoadClients += new EventHandler <EventArgs>(_view_LoadClients);

#if LEADTOOLS_V20_OR_LATER
            IOptionsDataAccessAgent optionsAgent = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent>();
            if (optionsAgent != null)
            {
                ClientConfigurationOptions clientConfigurationOptions = optionsAgent.Get <ClientConfigurationOptions>(ClientConfigurationOptionsKeyName, new ClientConfigurationOptions());
                if (clientConfigurationOptions != null)
                {
                    _view.Options = clientConfigurationOptions;
                }
            }
#endif // #if LEADTOOLS_V20_OR_LATER
        }
Example #5
0
        void loggingConfigManager_SettingsUpdated(object sender, EventArgs e)
        {
            try
            {
                LoggingModuleConfigurationManager loggingConfigManager = ServiceLocator.Retrieve <LoggingModuleConfigurationManager> ( );
                CommandAsyncProcessor             service = ServiceLocator.Retrieve <CommandAsyncProcessor> ( );

                ConfigureLogger(Logger.Global,
                                loggingConfigManager.GetLoggingState( ),
                                DataAccessServices.GetDataAccessService <ILoggingDataAccessAgent2> ( ));

                StartStopService(loggingConfigManager.GetLoggingState( ),
                                 service);

                IOptionsDataAccessAgent optionsAgent = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent> ( );
                if (optionsAgent != null)
                {
                    ConfigureServiceIntervals(loggingConfigManager.GetLoggingState(),
                                              service, optionsAgent);
                }
            }
            catch (Exception exception)
            {
                Log(LogType.Error, "Logging Config Error: " + exception.Message);
            }
        }
Example #6
0
        void service_CommandsExecuted(object sender, EventArgs e)
        {
            try
            {
                LoggingModuleConfigurationManager configurationManager = ServiceLocator.Retrieve <LoggingModuleConfigurationManager> ( );
                CommandAsyncProcessor             service = ServiceLocator.Retrieve <CommandAsyncProcessor> ( );

                IOptionsDataAccessAgent optionsAgent = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent> ( );
                if (optionsAgent != null)
                {
                    if (null != service && configurationManager.GetLoggingState().EnableAutoSaveLog)
                    {
                        DateTime nextLogDate = DateTime.Now.AddDays(service.Interval.Days);

                        SetNextLogDate(nextLogDate,
                                       configurationManager.GetLoggingState(),
                                       optionsAgent);
                    }
                }
            }
            catch (Exception exception)
            {
                Log(LogType.Error, "Logging Config Error: " + exception.Message);
            }
        }
Example #7
0
        public static DbRetrieveClient CreateLocalRetrieveClient( )
        {
            IStorageDataAccessAgent dataAccess;
            DbRetrieveClient        client;


            if (!ConfigurationData.SupportLocalQueriesStore)
            {
                throw new InvalidOperationException("Feature is not supported.");
            }

            dataAccess = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent> ( );

            if (null == dataAccess)
            {
                throw new InvalidOperationException("Storage Service is not registered.");
            }

            client = new DbRetrieveClient(ConfigurationData.WorkstationClient.ToAeInfo( ), dataAccess);

            client.EnableLog   = ConfigurationData.Debugging.GenerateLogFile;
            client.LogFileName = ConfigurationData.Debugging.LogFileName;

            return(client);
        }
Example #8
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);
        }
Example #9
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);
            }
        }
Example #10
0
        public void Configure(DicomServer server)
        {
            LoggingModuleConfigurationManager loggingConfigManager;
            CommandAsyncProcessor             service;

            _server          = server;
            ServiceDirectory = server.ServerDirectory;
            DisplayName      = server.Name;

            loggingConfigManager = new LoggingModuleConfigurationManager(true);

            loggingConfigManager.Load(ServiceDirectory);

            ServiceLocator.Register <LoggingModuleConfigurationManager> (loggingConfigManager);

            _loggingConfigManager = loggingConfigManager;

            RegisterDataAccessAgents(ServiceDirectory, DisplayName);

            CheckPermissions(loggingConfigManager.GetLoggingState( ));

            ConfigureLogger(Logger.Global, loggingConfigManager.GetLoggingState( ), DataAccessServices.GetDataAccessService <ILoggingDataAccessAgent2> ( ));

            service = RegisterAutoSaveLogService(loggingConfigManager.GetLoggingState( ));

            if (service != null)
            {
                StartStopService(loggingConfigManager.GetLoggingState(), service);
            }

            loggingConfigManager.SettingsUpdated += new EventHandler(loggingConfigManager_SettingsUpdated);
        }
Example #11
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);
            }
        }
Example #12
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 ) ;
            //}
        }
Example #13
0
        public static StorageServerInformation GetServerInformation( )
        {
            IOptionsDataAccessAgent optionsAgent;


            optionsAgent = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent> ( );

            return(optionsAgent.Get <StorageServerInformation> (typeof(StorageServerInformation).Name, null, new Type[0]));
        }
Example #14
0
        private ClientQueryDataSet.ImagesRow[] FillImages
        (
            ClientQueryDataSet.SeriesRow seriesRow,
            ClientQueryDataSet informationDS
        )
        {
            IStorageDataAccessAgent     storageDataAccess;
            MatchingParameterCollection matchingcollection;
            MatchingParameterList       matchingList;

            Leadtools.Medical.Storage.DataAccessLayer.MatchingParameters.Study  matchingStudy;
            Leadtools.Medical.Storage.DataAccessLayer.MatchingParameters.Series matchingSeries;
            List <ClientQueryDataSet.ImagesRow> imageRows;


            storageDataAccess = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent> ( );

            if (null == storageDataAccess)
            {
                return(new ClientQueryDataSet.ImagesRow [] {});
            }

            matchingcollection = new MatchingParameterCollection( );
            matchingList       = new MatchingParameterList( );
            matchingStudy      = new Leadtools.Medical.Storage.DataAccessLayer.MatchingParameters.Study(seriesRow.StudyInstanceUID);
            matchingSeries     = new Leadtools.Medical.Storage.DataAccessLayer.MatchingParameters.Series(seriesRow.SeriesInstanceUID);

            matchingList.Add(matchingStudy);
            matchingList.Add(matchingSeries);
            matchingcollection.Add(matchingList);

            CompositeInstanceDataSet instances = storageDataAccess.QueryCompositeInstances(matchingcollection).ToCompositeInstanceDataSet();

            imageRows = new List <ClientQueryDataSet.ImagesRow> ( );

            foreach (CompositeInstanceDataSet.InstanceRow instance in instances.Instance)
            {
                ClientQueryDataSet.ImagesRow imageRow;


                imageRow = informationDS.Images.NewImagesRow( );

                imageRow.StudyInstanceUID  = seriesRow.StudyInstanceUID;
                imageRow.SeriesInstanceUID = seriesRow.SeriesInstanceUID;
                imageRow.SOPInstanceUID    = instance.SOPInstanceUID;
                imageRow.InstanceNumber    = instance.IsInstanceNumberNull( ) ? string.Empty : instance.InstanceNumber.ToString( );
                imageRow.SOPClassUID       = instance.IsSOPClassUIDNull( ) ? string.Empty : instance.SOPClassUID;

                informationDS.Images.AddImagesRow(imageRow);
                imageRows.Add(imageRow);

                __BurningImages.Add(imageRow);
            }

            return(imageRows.ToArray( ));
        }
Example #15
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();
                }
            }
        }
        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));
        }
Example #17
0
        private string InitializeServiceAdmin(ServiceAdministrator serverAdmin)
        {
            IOptionsDataAccessAgent  optionsAgent;
            StorageServerInformation serverInfo;
            List <string>            services;
            string serviceName;

            optionsAgent = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent> ( );
            serverInfo   = optionsAgent.Get <StorageServerInformation> (typeof(StorageServerInformation).Name, null, new Type[0]);
            services     = new List <string> ( );

            ServerState.Instance.IsRemoteServer = false;

            if (null == serverInfo)
            {
                serviceName = DefaultServiceName;

                services.Add(serviceName);
            }
            else
            {
                if (serverInfo.MachineName.ToLower() == Environment.MachineName.ToLower())
                {
                    if (!string.IsNullOrEmpty(serverInfo.ServiceName))
                    {
                        serviceName = serverInfo.ServiceName;
                    }
                    else
                    {
                        serviceName = DefaultServiceName;
                    }

                    services.Add(serverInfo.ServiceName);
                }
                else
                {
                    ServerState.Instance.IsRemoteServer          = true;
                    ServerState.Instance.RemoteServerInformation = serverInfo;

                    serviceName = serverInfo.ServiceName;
                }
            }

            ServerState.Instance.ServiceAdminChanged  += new EventHandler(Instance_ServiceAdminChanged);
            ServerState.Instance.ServerServiceChanged += new EventHandler(Instance_ServerServiceChanged);

            if (services.Count > 0)
            {
                serverAdmin.Initialize(services);
            }

            return(serviceName);
        }
Example #18
0
        public static void dlgLogin_AuthenticateUser(object sender, AuthenticateUserEventArgs e)
        {
#if LEADTOOLS_V19_OR_LATER
            if (e.LoginType == LoginType.SmartcardPin)
            {
                AuthenticateCardUser(sender, e);
                return;
            }
#endif
            //
            // Once user is logged in we need to check to see if the user password
            // has expired.
            //
            _UserName = e.Username;
            try
            {
                if (UserManager.Authenticate(e.Username, e.Password))
                {
                    if (UserManager.IsPasswordExpired(e.Username))
                    {
                        StorageServer.UI.PasswordDialog dlgPassword = new StorageServer.UI.PasswordDialog();

                        dlgPassword.Text              = "Reset Expired Password";
                        dlgPassword.ValidatePassword += new EventHandler <ValidatePasswordEventArgs>(dlgPassword_ValidatePassword);
                        if (dlgPassword.ShowDialog(sender as Form) == DialogResult.OK)
                        {
                            UserManager.ResetPassword(e.Username, dlgPassword.Password);
                        }
                        else
                        {
                            e.Cancel = true;
                        }
                    }
                }
                else
                {
                    Messager.ShowError(sender as Form, "Invalid user name or password.");
                    e.InvalidCredentials = true;
                }
            }
            catch (Exception exception)
            {
                Messager.ShowError(sender as Form, exception);
                e.InvalidCredentials = true;
            }

            if (!e.Cancel && !e.InvalidCredentials)
            {
                IOptionsDataAccessAgent optionsAgent = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent>();

                optionsAgent.Set <string>("LastUser", e.Username);
            }
        }
Example #19
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>());
        }
        public void RunView(DatabaseManagerOptionsView view)
        {
            // EventBroker.Instance.Subscribe<BackgroundProcessEventAgs>(OnBackgroundProcess);

            View                  = view;
            _Options              = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent>();
            View.Options          = _Options.Get <DatabaseManagerOptions>(DatabaseManagerOptions, new DatabaseManagerOptions());
            View.SettingsChanged += new EventHandler(View_SettingsChanged);

            // Administration:
            View.PageSizeChanged += new EventHandler(View_PageSizeChanged);
            View.PaginationDisplayOptionChanged += new EventHandler(View_PaginationDisplayOptionChanged);
        }
Example #21
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);
        }
        public void RunView(ClientConfigurationOptionsView view)
        {
            // EventBroker.Instance.Subscribe<BackgroundProcessEventAgs>(OnBackgroundProcess);

            View                  = view;
            _Options              = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent>();
            View.Options          = _Options.Get <ClientConfigurationOptions>(ClientConfigurationOptions, new ClientConfigurationOptions());
            View.SettingsChanged += new EventHandler(View_SettingsChanged);

            // Administration:
            View.PageSizeChanged += new EventHandler(View_PageSizeChanged);
            View.PaginationDisplayOptionChanged += new EventHandler(View_PaginationDisplayOptionChanged);
            View.LastViewDisplayOptionChanged   += View_LastAccessDateDisplayOptionChanged;
        }
Example #23
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);
            }
        }
        public void RunView(PasswordOptionsView view)
        {
            ServerEventBroker.Instance.Subscribe <ApplyServerSettingsEventArgs>(OnUpdateServerSettings);
            ServerEventBroker.Instance.Subscribe <CancelServerSettingsEventArgs>(OnCancelServerSettings);
            ServerEventBroker.Instance.Subscribe <ActivateIdleMonitorEventArgs>(UpdateIdleMonitor);

            View         = view;
            _Options     = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent>();
            View.Options = _Options.Get <PasswordOptions>(PasswordOptions, new PasswordOptions());
            if (View.Options.EnableIdleTimeout)
            {
                StartIdleMonitor();
            }
        }
Example #25
0
        private void ConfigureDataAccessLayers( )
        {
            IStorageDataAccessAgent storageDataAccess = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent> ( );


            if (storageDataAccess != null && storageDataAccess is StorageDbDataAccessAgent)
            {
                StorageModuleConfigurationManager storageConfig = ServiceLocator.Retrieve <StorageModuleConfigurationManager> ( );

                if (storageConfig.IsLoaded)
                {
                    ((StorageDbDataAccessAgent)storageDataAccess).AutoTruncateData = storageConfig.GetStorageAddInsSettings(ServerState.Instance.ServiceName).StoreAddIn.AutoTruncateData;
                }
            }
        }
Example #26
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);
        }
Example #27
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);
        }
Example #28
0
        void _view_LoadClients(object sender, EventArgs e)
        {
            IAeManagementDataAccessAgent2 agent = DataAccessServices.GetDataAccessService <IAeManagementDataAccessAgent>() as IAeManagementDataAccessAgent2;

            if (agent == null)
            {
                return;
            }

#if LEADTOOLS_V20_OR_LATER
            IOptionsDataAccessAgent optionsAgent = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent>() as IOptionsDataAccessAgent;
            if (optionsAgent == null)
            {
                return;
            }

            AeInfoExtended searchParams = new AeInfoExtended();
#endif // #if LEADTOOLS_V20_OR_LATER

            AeInfoExtended[] aeInfoExtendedArray = agent.GetAeTitles();

            IPermissionManagementDataAccessAgent permissionsAgent = DataAccessServices.GetDataAccessService <IPermissionManagementDataAccessAgent>();

            // Get the list of all possible permissions
            _view.Permissions = permissionsAgent.GetPermissions();

            // The LEADTOOLS skinned version defaults to all permissions on
            if (Shell.storageServerName.Contains("LEAD"))
            {
                _view.NewClientPermissions = _view.Permissions; // All permissions on by default;
            }
            else
            {
                _view.NewClientPermissions = new Permission[0]; // All permissions off by default;
            }
            _view.ClientInformationList = new ClientInformationList();

            // view.ClientInformationList.AddItems(aeInfoExtendedArray);
            foreach (AeInfoExtended info in aeInfoExtendedArray)
            {
                string[]          permissionsArray = permissionsAgent.GetUserPermissions(info.AETitle);
                ClientInformation ci = new ClientInformation(info, permissionsArray);
                _view.ClientInformationList.ClientDictionary.Add(info.AETitle, ci);
            }

            // Make a backup of the settings
            ServerState.Instance.ClientList = new ClientInformationList(_view.ClientInformationList);
        }
Example #29
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);
            }
        }