Пример #1
0
        void QueryButton_Click(object sender, EventArgs e)
        {
            try
            {
                IWorklistDataAccessAgent worklistAgent;


                worklistAgent = DataAccessServices.GetDataAccessService <IWorklistDataAccessAgent> ( );

                _queryResult = worklistAgent.FindPatientInformation(new MatchingParameterCollection( ));
                List <string> tables = new List <string> ( );

                tableLayoutPanel1.Controls.Clear( );

                foreach (DatabaseDicomTags dbTag in _source)
                {
                    if (tables.Contains(dbTag.TableName))
                    {
                        continue;
                    }

                    DataGridView queryResultsDataGridView = new DataGridView( );
                    queryResultsDataGridView.AllowUserToAddRows = false;

                    queryResultsDataGridView.ColumnAdded += new DataGridViewColumnEventHandler(queryResultsDataGridView_ColumnAdded);

                    queryResultsDataGridView.DataSource = _queryResult;
                    queryResultsDataGridView.DataMember = dbTag.TableName;
                    queryResultsDataGridView.Dock       = DockStyle.Fill;

                    queryResultsDataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;

                    tables.Add(dbTag.TableName);

                    tableLayoutPanel1.Controls.Add(queryResultsDataGridView);
                }
            }
            catch (Exception exception)
            {
                Messager.ShowError(this, exception);
            }
        }
Пример #2
0
        public static void LogMessage(string description, LogType logType)
        {
            DicomLogEntry logEntry = new DicomLogEntry( );

            logEntry.LogType = logType;
            if (UserManager.User != null)
            {
                logEntry.ClientAETitle = UserManager.User.FriendlyName;
            }
            else
            {
                IOptionsDataAccessAgent optionsAgent = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent>();
                string lastUser = optionsAgent.Get <string>("LastUser", string.Empty);

                logEntry.ClientAETitle = lastUser;
            }
            logEntry.Description = description;

            Logger.Global.Log(logEntry);
        }
Пример #3
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);
            }
        }
Пример #4
0
 private void iremoveProfile_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (_currentRole != null)
     {
         if (uxProfilesListBox.SelectedItems.Count == 1)
         {
             if (XtraMessageBox.Show("Sicuro di procedere nella cancellazione del profilo?", "Domanda", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 string   item    = uxProfilesListBox.SelectedItems[0].ToString();
                 IProfile profile = GetProfileByDescription(item);
                 if (profile != null)
                 {
                     _currentRole.Profiles.Remove(profile);
                     //secureDataAccess.MarkDelete(new RoleProfile(_currentRole, profile));
                     DataAccessServices.SimplePersistenceFacadeInstance().ExecuteScalar(String.Format("Delete from roleprofile where roleID = {0} and profileID = {1}", _currentRole.ID, profile.ID));
                     LoadUserAndProfiles();
                 }
             }
         }
     }
 }
Пример #5
0
        public WIN.SCHEDULING_APPLICATION.HANDLERS.SearchDTOs.IsearchDTO CreateDTO()
        {
            string subject = txtSubject.Text;

            if (!string.IsNullOrEmpty(subject))
            {
                if (Properties.Settings.Default.Main_InsertJolly)
                {
                    //seleziono il carattere jolly in dipendenza dal tipo di DB
                    if (DataAccessServices.Instance().PersistenceFacade.DBType == DB.DBType.Access)
                    {
                        subject = "%" + subject;
                    }
                    else
                    {
                        subject = "%" + subject;
                    }
                }
            }
            return(new SimpleDocumentSearch(GetSelectedScopes(), GetSelectedTypes(), GetSelectedOperators(), subject, txtProtocol.Text, Convert.ToInt32(spYear.Value)));
        }
Пример #6
0
        public WIN.SCHEDULING_APPLICATION.HANDLERS.SearchDTOs.IsearchDTO CreateDTO()
        {
            string subject = txtsubject.Text;

            if (!string.IsNullOrEmpty(subject))
            {
                if (Properties.Settings.Default.Main_InsertJolly)
                {
                    //seleziono il carattere jolly in dipendenza dal tipo di DB
                    if (DataAccessServices.Instance().PersistenceFacade.DBType == DB.DBType.Access)
                    {
                        subject = "%" + subject;
                    }
                    else
                    {
                        subject = "%" + subject;
                    }
                }
            }
            return(new SimpleAppointmentSearch(GetSelectedResources(), GetSelectedLabels(), GetSelectedOperators(), subject, txtLoc.Text));
        }
Пример #7
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;
        }
Пример #8
0
        public void RunView(PasswordOptionsView view)
        {
            EventBroker.Instance.Subscribe <BackgroundProcessEventAgs>(OnBackgroundProcess);

            View = view;

#if LEADTOOLS_V19_OR_LATER
            _userAgent3 = DataAccessServices.GetDataAccessService <IUserManagementDataAccessAgent4>();
            _userAgent2 = DataAccessServices.GetDataAccessService <IUserManagementDataAccessAgent2>();
#else
            _userAgent2 = DataAccessServices.GetDataAccessService <IUserManagementDataAccessAgent2>();
#endif
            _permissionAgent = DataAccessServices.GetDataAccessService <IPermissionManagementDataAccessAgent2>();

#if LEADTOOLS_V19_OR_LATER
            UpdateUsersList();
#endif

            _optionsAgent = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent>();
            View.Options  = _optionsAgent.Get <PasswordOptions>(PasswordOptions, new PasswordOptions());

            View.SettingsChanged += new EventHandler(View_SettingsChanged);

            // Administration: Password Options
            View.ComplexityLowerCaseChanged += new EventHandler(View_ComplexityLowerCaseChanged);
            View.ComplexityUpperCaseChanged += new EventHandler(View_ComplexityUpperCaseChanged);
            View.ComplexitySymbolChanged    += new EventHandler(View_ComplexitySymbolChanged);
            View.ComplexityNumberChanged    += new EventHandler(View_ComplexityNumberChanged);
            View.MinimumLengthChanged       += new EventHandler(View_MinimumLengthChanged);
            View.DaysToExpirationChanged    += new EventHandler(View_DaysToExpirationChanged);
            View.MaximumRememberedChanged   += new EventHandler(View_MaximumRememberedChanged);
            View.IdleTimeoutEnableChanged   += new EventHandler(View_IdleTimeoutEnableChanged);
            View.IdleTimeoutChanged         += new EventHandler(View_IdleTimeoutChanged);
            View.LoginTypeChanged           += new EventHandler(View_LoginTypeChanged);

            if (View.Options.EnableIdleTimeout)
            {
                StartIdleMonitor();
            }
        }
Пример #9
0
        public static void Register(
            [NotNull] IServiceCollection services,
            [NotNull] IConfiguration configuration,
            [NotNull] IHostingEnvironment hostingEnvironment)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (hostingEnvironment == null)
            {
                throw new ArgumentNullException(nameof(hostingEnvironment));
            }

            var photoStoreRoot = GetPhotoStoreRoot(configuration, hostingEnvironment);
            var photoStoreType = GetPhotoStoreType(configuration);

            SharedKernelRegistrations.RegisterServices(services);
            ApplicationRegistration.RegisterServices(services);
            InterfaceAdaptersRegistration.RegisterServices(services);

            PhotoStorageRegistration.RegisterServices(services, photoStoreRoot, photoStoreType);
            ApplicationInsightsRegistration.RegisterServices(services);
            ImageSharpRegistrations.RegisterServices(services);
            SmtpEmailRegistrations.RegisterServices(services);
            DataAccessServices.RegisterServices(services);

            services.AddSingleton <IActionContextAccessor, ActionContextAccessor>();
            services.AddSingleton <IAbsoluteUrlGenerator, MvcAbsoluteUrlGenerator>();
            services.AddSingleton <IRelativeUrlGenerator, MvcRelativeUrlGenerator>();
            services.AddSingleton <ILogbookDetailsUrlGenerator, MvcLogbookDetailsUrlGenerator>();
            services.AddSingleton <IAvatarPathProvider, AvatarPathProvider>();
            services.AddTransient <ITextFormattingHelper, TextFormattingHelper>();
            services.AddSingleton(new TokenConfiguration(GetTokenSecurityKey(configuration)));
            services.AddTransient <ITokenGenerator, TokenGenerator>();
        }
Пример #10
0
        private void UpdateMediaObjectStatus
        (
            MediaCreationManagement mediaObject,
            ExecutionStatus status,
            ExecutionStatusInfo statusInfo
        )
        {
            IMediaCreationDataAccessAgent dataAccess;


            dataAccess = DataAccessServices.GetDataAccessService <IMediaCreationDataAccessAgent> ( );

            mediaObject.ExecutionStatus.ExecutionStatus     = status;
            mediaObject.ExecutionStatus.ExecutionStatusInfo = statusInfo;

            if (null != dataAccess)
            {
                dataAccess.UpdateMediaObjectStatus(mediaObject.SopCommon.SOPInstanceUID, mediaObject.ExecutionStatus);
            }

            __MediaStateService.MediaQueue.NotifyMediaObjectUpdated(mediaObject);
        }
Пример #11
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);
            }
        }
Пример #12
0
        void Instance_ServerServiceChanged(object sender, EventArgs e)
        {
            IOptionsDataAccessAgent optionsAgent;


            optionsAgent = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent> ( );

            if (null != ServerState.Instance.ServerService)
            {
                SetStorageServerInformationOptions(optionsAgent);

                LoadLicense(ServerState.Instance.ServerService.Settings.LicenseFile);
            }
            else
            {
                optionsAgent.DeleteOption(typeof(StorageServerInformation).Name);

                ServerState.Instance.License = null;
            }

            LoadLoggingState(ServerState.Instance.ServerService);
        }
Пример #13
0
        public static bool Login(string info, bool relogin)
        {
            try
            {
                IOptionsDataAccessAgent optionsAgent    = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent>();
                PasswordOptions         passwordOptions = optionsAgent.Get <PasswordOptions>("PasswordOptions", new PasswordOptions());

                LoginDialog dlgLogin = new LoginDialog(passwordOptions.LoginType);
                Process     process  = Process.GetCurrentProcess();
                string      lastUser = optionsAgent.Get <string>("LastUser", string.Empty);
                bool        lastLoginUseCardReader = optionsAgent.Get <bool>("LastLoginUseCardReader", false);

                dlgLogin.Text            = Shell.storageServerName + " Login";
                dlgLogin.Info            = info;
                dlgLogin.RegularUsername = lastUser;

                if (passwordOptions.LoginType == LoginType.Both)
                {
                    dlgLogin.UseCardReaderCheckBox = lastLoginUseCardReader;
                }
                dlgLogin.CanSetUserName    = !relogin;
                dlgLogin.AuthenticateUser += new EventHandler <AuthenticateUserEventArgs>(dlgLogin_AuthenticateUser);
                if (dlgLogin.ShowDialog(new WindowWrapper(process.MainWindowHandle)) == DialogResult.OK)
                {
                    UserManager.User = new ManagerUser(dlgLogin.GetUserName(), dlgLogin.GetFriendlyName(), UserManager.GetUserPermissions(dlgLogin.GetUserName()));

                    optionsAgent.Set <bool>("LastLoginUseCardReader", dlgLogin.UseCardReaderCheckBox);

                    LoadSplash();
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                Messager.ShowError(null, ex);
                return(false);
            }
        }
Пример #14
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);
        }
Пример #15
0
        static void RegisterDataAccessAgents(string serviceDirectory, 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);
            }

            if (!DataAccessServices.IsDataAccessServiceRegistered <IPatientRightsDataAccessAgent> ( ))
            {
                try
                {
                    IPatientRightsDataAccessAgent patientRightsDataAccess = DataAccessFactory.GetInstance(new PatientRightsDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IPatientRightsDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IPatientRightsDataAccessAgent>(patientRightsDataAccess);
                }
                catch (Exception)
                {
                    //Log
                }
            }

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

                    DataAccessServices.RegisterDataAccessService <IDownloadJobsDataAccessAgent>(downloadDataAccess);
                }
                catch (Exception)
                {
                }
            }
        }
Пример #16
0
        private void OpenImportImpegniprogram()
        {
            try
            {
                //WIN.FENEAL_NAZIONALE.IMPORT_IMPEGNI.exe
                string   asmPath = Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", "");
                FileInfo f       = new FileInfo(asmPath);

                string fold = f.DirectoryName;

                string progName = fold + @"\WIN.FENEAL_NAZIONALE.IMPORT_IMPEGNI.exe";


                Process p = new Process();
                p.StartInfo = new ProcessStartInfo(progName, "\"" + DataAccessServices.Instance().ConnectionString + "\"");
                p.StartInfo.UseShellExecute = false;
                p.Start();
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
            }
        }
        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);
                }
            }
        }
Пример #18
0
        private void InitializeStorageAddinsSettings()
        {
            IStorageDataAccessAgent storageDataAccess = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();

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

                if (storageConfig.IsLoaded)
                {
                    StorageAddInsConfiguration settings = storageConfig.GetStorageAddInsSettings(ServerState.Instance.ServiceName);
                    if (settings != null)
                    {
                        if (settings.StoreAddIn.AutoCreateFolderLocations != AutoCreateLocationsDefault)
                        {
                            settings.StoreAddIn.AutoCreateFolderLocations = AutoCreateLocationsDefault;
                            storageConfig.SetStorageAddinsSettings(settings);
                            storageConfig.Save();
                        }
                    }
                }
            }
        }
Пример #19
0
        public int GetLastProtocolNumber(int year)
        {
            //imposto l'anno ad uno stesso valore
            int progressYear = 2011;

            int result = 0;

            //verifico la presenza del protocollo nell'anno
            object o = _service.ExecuteScalar(string.Format("Select Protocol from App_LastProtocols where Year = {0}", progressYear.ToString()));

            //se non esiste inserisco l'anno con protocollo 1 e lo restituisco
            if (o == null)
            {
                if (DataAccessServices.Instance().PersistenceFacade.DBType == DB.DBType.Access)
                {
                    _service.ExecuteNonQuery(string.Format("Insert into App_LastProtocols ([Year], [Protocol]) values ({0}, {1})", progressYear.ToString(), "1"));
                }
                else
                {
                    _service.ExecuteNonQuery(string.Format("Insert into App_LastProtocols (Year, Protocol) values ({0}, {1})", progressYear.ToString(), "1"));
                }
                return(1);
            }
            if (DataAccessServices.Instance().PersistenceFacade.DBType == DB.DBType.Access)
            {
                _service.ExecuteNonQuery("Update App_LastProtocols set Protocol = Protocol + 1");
                o = _service.ExecuteScalar(string.Format("Select Protocol from App_LastProtocols where Year = {0}", progressYear.ToString()));
            }
            else
            {
                o = _service.ExecuteScalar(string.Format("Update App_LastProtocols set Protocol = Protocol + 1; Select Protocol from App_LastProtocols where Year = {0}", progressYear.ToString()));
            }

            result = Convert.ToInt32(o);

            return(result);
        }
Пример #20
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);
            }
        }
Пример #21
0
        public void UpdateSettings(AdvancedSettings settings)
        {
            ForwardOptions clonedOptions;

            _Settings = settings;

            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 = true;

            if (_AccessAgent == null)
            {
                _AccessAgent = DataAccessServices.GetDataAccessService <IAeManagementDataAccessAgent>();
            }

            _View.SetAeTitles(_AccessAgent.GetAeTitles());
        }
Пример #22
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);
            }
        }
Пример #23
0
        public SoftwareInfo GetInfo()
        {
            IPersistenceFacade ps = DataAccessServices.Instance().PersistenceFacade;

            return(ps.GetObject("SoftwareInfo", 1) as SoftwareInfo);
        }
Пример #24
0
 public SecureDataManager()
 {
     ps = DataAccessServices.Instance().PersistenceFacade;
 }
        private void CreateContainerPages( )
        {
            ControlPanelView         controlPanelView  = new ControlPanelView( );
            ServerInformationView    serverInfoView    = new ServerInformationView( );
            ServerAddinsView         serverAddInView   = new ServerAddinsView( );
            ServerSettingsDialog     serverSettingsDlg = new ServerSettingsDialog( );
            ServerInformationControl serverInfoControl = new ServerInformationControl();

            ControlPanelPresenter      controlPanelPresenter   = new ControlPanelPresenter( );
            ServerInformationPresenter serverInfoPresenter     = new ServerInformationPresenter( );
            ServerAddinPresenter       serverAddInPresenter    = new ServerAddinPresenter( );
            ServerSettingsPresenter    serverSettingsPresenter = new ServerSettingsPresenter( );

#if LEADTOOLS_V19_OR_LATER
            RealTimeViewPresenter realTimePresenter = new RealTimeViewPresenter();
#endif

            StorageDatabaseManager dbManager = new StorageDatabaseManager( );
#if TUTORIAL_CUSTOM_DATABASE
            // To use a custom database schema with the Database Manager, you must define a custom MyPrepareSearch method
            // and assign it to the StorageDatabaseManager.PrepareSearch delegate.
            // For more details, see the "Changing the LEAD Medical Storage Server to use a different database schema" tutorial.

            dbManager.PrepareSearch = new PrepareSearchDelegate(MyPrepareSearch);
#endif
            EventLogViewer logViewer = new EventLogViewer( );

#if LEADTOOLS_V19_OR_LATER
            RealTimeViewerControl realTimeView = new RealTimeViewerControl()
            {
                Visible = false
            };
#endif

            dbManager.BackColor         = Color.FromArgb(75, 75, 75);
            logViewer.BackColor         = Color.White;
            logViewer.PathLogDump       = this.PathLogDump;
            serverInfoControl.BackColor = Color.White;

            ThemesManager.ApplyTheme(controlPanelView);
            ThemesManager.ApplyTheme(logViewer);
            ThemesManager.ApplyTheme(dbManager);
            ThemesManager.ApplyTheme(serverInfoControl);

#if LEADTOOLS_V19_OR_LATER
            ThemesManager.ApplyTheme(realTimeView);
#endif

            ConfigureServerInfoConrol(serverInfoControl);

            View.SetHeader(serverInfoView);

            AddPage(new PageData(controlPanelView, "Control Panel", null));

            //AddPage ( new PageData ( new Control ( ), "Security", null ) ) ;
            AddPage(new PageData(logViewer, "Event Log", null));
            AddPage(new PageData(serverInfoControl, "System Information", null));

            dbManager.MergeImportDicom = true;

#if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER)
            dbManager.EnableExport = true;
#endif // #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER)

            dbManager.Enabled = ServerState.Instance.ServerService != null;

            if (ServerState.Instance.ServerService != null)
            {
                dbManager.AETitle = ServerState.Instance.ServerService.Settings.AETitle;
            }

            AddPage(new PageData(dbManager, "Database Manager", null));

            dbManager.Enabled = true;

#if LEADTOOLS_V19_OR_LATER
            AddPage(new PageData(realTimeView, "Live View", null));
#endif
            InitializeLicenseView();

            serverAddInView.Enabled = UserManager.User.IsAdmin();
            AddPage(new PageData(serverAddInView, "Add-ons", null));

            controlPanelPresenter.RunView(controlPanelView);
            serverInfoPresenter.RunView(serverInfoView);
            serverAddInPresenter.RunView(serverAddInView);
            serverSettingsPresenter.RunView(serverSettingsDlg);

#if LEADTOOLS_V19_OR_LATER
            realTimePresenter.RunView(realTimeView);
#endif

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

            dbManager.CancelStore           += new EventHandler <CancelStoreEventArgs>  (dbManager_CancelStore);
            dbManager.ConfigureStoreCommand += new EventHandler <StoreCommandEventArgs> (dbManager_ConfigureStoreCommand);

#if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER)
            dbManager.ConfigureStoreExportCommand += new EventHandler <StoreCommandEventArgs> (dbManager_ConfigureStoreCommandExport);
#endif // #if (LEADTOOLS_V19_OR_LATER_EXPORT) || (LEADTOOLS_V19_OR_LATER)


#if TUTORIAL_CUSTOM_DATABASE
            // To use a custom database schema with the Database Manager, you must define a custom MyPrepareSearch method
            // and assign it to the StorageDatabaseManager.PrepareSearch delegate. After doing this, the search fields in the Database Manager
            //will properly refine any database manager search.  The MyPrepareSearch() method gets the search fields specified in the database manager
            // by calling StorageDatabaseManager.GetDicomQueryParams().  This returns any query parameters specified.
            // For more details, see the "Changing the LEAD Medical Storage Server to use a different database schema" tutorial.

            dbManager.GetDicomQueryParams();
#endif
            __DbManager      = dbManager;
            __ServerInfoView = serverInfoView;

            ApplyPermissions( );

            ApplyStorageSettingsPermissions( );

            Instance_LicenseChanged(this, EventArgs.Empty);
            ServerState.Instance.LicenseChanged += new EventHandler(Instance_LicenseChanged);
        }
Пример #26
0
        public static QueryClient CreateQueryClient(DicomClientMode clientMode)
        {
            try
            {
                switch (clientMode)
                {
                case DicomClientMode.LocalDb:
                {
                    QueryClient             client;
                    IStorageDataAccessAgent dataAccess;


                    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 DbQueryClient(ConfigurationData.WorkstationClient.ToAeInfo( ), dataAccess);

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

                    return(client);
                }


                case DicomClientMode.Pacs:
                {
                    QueryClient client;
                    Leadtools.Dicom.Scu.DicomScp scp;


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

                    scp = new Leadtools.Dicom.Scu.DicomScp( );

                    scp.AETitle     = ConfigurationData.ActivePacs.AETitle;
                    scp.PeerAddress = Utils.ResolveIPAddress(ConfigurationData.ActivePacs.Address);
                    scp.Port        = ConfigurationData.ActivePacs.Port;
                    scp.Timeout     = ConfigurationData.ActivePacs.Timeout;

                    client = new PacsQueryClient(ConfigurationData.WorkstationClient.ToAeInfo( ),
                                                 scp);

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

                    return(client);
                }

                case DicomClientMode.DicomDir:
                {
                    DicomDirQueryClient client = new DicomDirQueryClient(ConfigurationData.CurrentDicomDir);

                    return(client);
                }

                default:
                {
                    throw new NotImplementedException("Dicom Client not implemented.");
                }
                }
            }
            catch (Exception exception)
            {
                System.Diagnostics.Debug.Assert(false, exception.Message);

                throw;
            }
        }
Пример #27
0
        public override void Execute( )
        {
            IMediaCreationDataAccessAgent dataAccess;


            dataAccess = DataAccessServices.GetDataAccessService <IMediaCreationDataAccessAgent> ( );

            if (null != dataAccess)
            {
                List <MediaCreationManagement> mediaObjects;
                MediaCreationQueue             queue;
                MediaCreationManagement        queryObject;


                mediaObjects = new List <MediaCreationManagement> ( );
                queue        = MediaService.MediaQueue;
                queryObject  = new MediaCreationManagement( );


                queryObject.ExecutionStatus.ExecutionStatus = MediaStatus;

                mediaObjects.AddRange(dataAccess.FindMediaObjects(queryObject));

                foreach (MediaCreationManagement mediaObject in mediaObjects)
                {
                    if (queue.Contains(mediaObject))
                    {
                        if (queue [mediaObject.SopCommon.SOPInstanceUID].ExecutionStatus.ExecutionStatus != mediaObject.ExecutionStatus.ExecutionStatus)
                        {
                            MediaLocation[] location;


                            location = dataAccess.FindMediaLocation(new string [] { mediaObject.SopCommon.SOPInstanceUID });

                            queue [mediaObject.SopCommon.SOPInstanceUID].ExecutionStatus = mediaObject.ExecutionStatus;

                            if (location != null && location.Length > 0)
                            {
                                queue [mediaObject.SopCommon.SOPInstanceUID].SetCreationPath(location [0].Location);
                            }

                            queue [mediaObject.SopCommon.SOPInstanceUID].SetStatusUpdateDate(dataAccess.GetStatusUpdateDate(mediaObject.SopCommon.SOPInstanceUID));

                            queue.NotifyMediaObjectUpdated(mediaObject.SopCommon.SOPInstanceUID);
                        }
                        else if (mediaObject.ExecutionStatus.ExecutionStatus == ExecutionStatus.Creating)
                        {
                            MediaLocation[] location;


                            location = dataAccess.FindMediaLocation(new string [] { mediaObject.SopCommon.SOPInstanceUID });

                            if (location != null && location.Length > 0)
                            {
                                mediaObject.SetCreationPath(location [0].Location);
                            }

                            mediaObject.SetStatusUpdateDate(dataAccess.GetStatusUpdateDate(mediaObject.SopCommon.SOPInstanceUID));

                            if (queue [mediaObject.SopCommon.SOPInstanceUID].GetCreationPath( ) != mediaObject.GetCreationPath( ) ||
                                queue [mediaObject.SopCommon.SOPInstanceUID].GetStatusUpdateDate( ) != mediaObject.GetStatusUpdateDate( ))
                            {
                                if (location != null && location.Length > 0)
                                {
                                    queue [mediaObject.SopCommon.SOPInstanceUID].SetCreationPath(location [0].Location);
                                }

                                queue [mediaObject.SopCommon.SOPInstanceUID].SetStatusUpdateDate(mediaObject.GetStatusUpdateDate( ).Value);

                                queue.NotifyMediaObjectUpdated(mediaObject.SopCommon.SOPInstanceUID);
                            }
                        }

                        //this is important to dereference the objects and allow them to be garbage collectd.
                        mediaObject.SetCreationPath(null);
                        mediaObject.SetStatusUpdateDate(null);
                    }
                    else
                    {
                        MediaLocation[] location;


                        location = dataAccess.FindMediaLocation(new string [] { mediaObject.SopCommon.SOPInstanceUID });

                        if (location != null && location.Length > 0)
                        {
                            mediaObject.SetCreationPath(location [0].Location);
                        }

                        mediaObject.SetStatusUpdateDate(dataAccess.GetStatusUpdateDate(mediaObject.SopCommon.SOPInstanceUID));

                        queue.Add(mediaObject);
                    }
                }

                if (queue.Count > mediaObjects.Count)
                {
                    foreach (MediaCreationManagement mediaObject in queue.ToArray( ))
                    {
                        if (!mediaObjects.Contains(mediaObject))
                        {
                            queue.Remove(mediaObject);

                            if (queue.Count == mediaObjects.Count)
                            {
                                break;
                            }

                            //this is important to dereference the objects and allow them to be garbage collectd.
                            mediaObject.SetCreationPath(null);
                            mediaObject.SetStatusUpdateDate(null);
                        }
                    }
                }
            }
        }
Пример #28
0
        public WIN.TECHNICAL.PERSISTENCE.AbstractBoolCriteria GenerateSql()
        {
            bool modified       = false;
            CompositeCriteria c = new CompositeCriteria(AbstractBoolCriteria.Operatore.AndOp);


            if (!string.IsNullOrEmpty(_subject))
            {
                c.AddCriteria(Criteria.Matches("Subject", _subject, DataAccessServices.Instance().PersistenceFacade.DBType));
                modified = true;
            }

            if (!string.IsNullOrEmpty(_location))
            {
                c.AddCriteria(Criteria.Matches("Location", _location, DataAccessServices.Instance().PersistenceFacade.DBType));
                modified = true;
            }



            if (_labels.Count > 0)
            {
                CompositeCriteria c1 = new CompositeCriteria(AbstractBoolCriteria.Operatore.OrOp);
                foreach (Label item in _labels)
                {
                    if (item != null)
                    {
                        c1.AddCriteria(Criteria.Equal("LabelID", item.Id.ToString()));
                    }
                }
                c.AddCriteria(c1);
                modified = true;
            }

            if (_resources.Count > 0)
            {
                CompositeCriteria c1 = new CompositeCriteria(AbstractBoolCriteria.Operatore.OrOp);
                foreach (Resource item in _resources)
                {
                    if (item != null)
                    {
                        c1.AddCriteria(Criteria.Equal("ResourceID", item.Id.ToString()));
                    }
                }
                c.AddCriteria(c1);
                modified = true;
            }

            if (_operators.Count > 0)
            {
                CompositeCriteria c1 = new CompositeCriteria(AbstractBoolCriteria.Operatore.OrOp);
                foreach (Operator item in _operators)
                {
                    if (item != null)
                    {
                        c1.AddCriteria(Criteria.Equal("OperatorID", item.Id.ToString()));
                    }
                }
                c.AddCriteria(c1);
                modified = true;
            }

            if (modified)
            {
                return(c);
            }
            return(null);
        }
Пример #29
0
        internal static void RegisterServices(string serviceName)
        {
            if (!DataAccessServices.IsDataAccessServiceRegistered <IMediaCreationDataAccessAgent> ( ))
            {
                IMediaCreationDataAccessAgent mediaCreationService;

                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsConfiguration();

                mediaCreationService = DataAccessFactory.GetInstance(new MediaCreationDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IMediaCreationDataAccessAgent> ( );

                DataAccessServices.RegisterDataAccessService <IMediaCreationDataAccessAgent> (mediaCreationService);
            }

            IStorageDataAccessAgent storageService;

            if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent> ( ))
            {
                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsConfiguration();

                storageService = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IStorageDataAccessAgent>();

                DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent> (storageService);
            }
            else
            {
                storageService = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent> ( );
            }

            if (!CommandRequestValidationManager.IsRegistered <CommandRequestDataSetValidator> ( ))
            {
                CommandRequestValidationManager.AddValidator(new CommandRequestDataSetValidator( ));
            }

            if (!CommandRequestValidationManager.IsRegistered <MediaCreationReferencedSopsValidator> ( ))
            {
                MediaCreationReferencedSopsValidator validator = new MediaCreationReferencedSopsValidator(storageService);


                validator.Enabled = AddInConfiguration.ValidateReferencedSopInstances;

                CommandRequestValidationManager.AddValidator(validator);
            }

            if (!DicomCommandFactory.IsCommandServiceRegistered(typeof(MediaNCreateCommand)))
            {
                DicomCommandFactory.RegisterCommandInitializationService(typeof(MediaNCreateCommand),
                                                                         new MediaNCreateCommandInitializationService( ));
            }

            if (!ServiceLocator.IsRegistered <MediaServicesState> ( ))
            {
                MediaServicesState servicesState;


                servicesState = new MediaServicesState( );

                servicesState.AutoCreationServiceEnabled     = MediaAutoCreationConfiguration.EnableAutoMediaCreation;
                servicesState.MediaMaintenanceServiceEnabled = MaintenanceConfiguration.Enabled;

                servicesState.AutoCreationServiceStateChanged     += new EventHandler(servicesState_AutoCreationServiceStateChanged);
                servicesState.MediaMaintenanceServiceStateChanged += new EventHandler(servicesState_MediaMaintenanceServiceStateChanged);

                ServiceLocator.Register <MediaServicesState> (servicesState);
            }

            if (!ServiceLocator.IsRegistered <SettingsChangedNotifier> ( ))
            {
                SettingsChangedNotifier configChangedNotifier = new SettingsChangedNotifier(_settings);

                configChangedNotifier.SettingsChanged += new EventHandler(configChangedNotifier_SettingsChanged);

                configChangedNotifier.Enabled = true;

                ServiceLocator.Register <SettingsChangedNotifier> (configChangedNotifier);
            }
        }
Пример #30
0
        void OnUpdateServerSettings(object sender, EventArgs e)
        {
            if (_view != null)
            {
                IAeManagementDataAccessAgent         agent            = DataAccessServices.GetDataAccessService <IAeManagementDataAccessAgent>();
                IPermissionManagementDataAccessAgent permissionsAgent = DataAccessServices.GetDataAccessService <IPermissionManagementDataAccessAgent>();

#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

                AeInfoExtended[] aeInfoExtendedArray = agent.GetAeTitles();
                List <string>    aeTitlesInDB        = new List <string>();

                foreach (AeInfoExtended ae in aeInfoExtendedArray)
                {
                    ClientInformation info = (from i in ServerState.Instance.ClientList.Items
                                              where i.Client.AETitle == ae.AETitle
                                              select i).FirstOrDefault();

                    //
                    // Only add items that existed when the database was first queried. If an ae title was added outside of this dialog
                    //  it will be ignored.
                    //
                    if (info != null)
                    {
                        aeTitlesInDB.Add(ae.AETitle.ToUpper());
                    }
                }

                // Updates and adds
                foreach (ClientInformation ci in _view.ClientInformationList.Items)
                {
                    string aeTitle = ci.Client.AETitle;
                    if (aeTitlesInDB.Contains(aeTitle, StringComparer.InvariantCultureIgnoreCase))
                    {
                        // update
                        ClientInformation ciPrevious = null;
                        ServerState.Instance.ClientList.ClientDictionary.TryGetValue(aeTitle, out ciPrevious);

                        if (!ciPrevious.Equals(ci))
                        {
                            agent.Update(aeTitle, ci.Client);
                        }
                        aeTitlesInDB.Remove(aeTitle.ToUpper());
                        try
                        {
                            EventBroker.Instance.PublishEvent <ClientUpdatedEventArgs>(this, new ClientUpdatedEventArgs(aeTitle, ci.Client));
                        }
                        catch { }
                    }
                    else
                    {
                        // insert
                        agent.Add(ci.Client);
                        try
                        {
                            EventBroker.Instance.PublishEvent <ClientAddedEventArgs>(this, new ClientAddedEventArgs(ci.Client));
                        }
                        catch { }
                    }
                    permissionsAgent.DeleteUserPermission(null, aeTitle);
                    foreach (string permissionName in ci.Permissions)
                    {
                        permissionsAgent.AddUserPermission(permissionName, aeTitle);
                    }
                }

                // Finally, remove the deleted AE titles from the database
                foreach (string aeTitle in aeTitlesInDB)
                {
                    agent.Remove(aeTitle);
                    try
                    {
                        EventBroker.Instance.PublishEvent <ClientRemovedEventArgs>(this, new ClientRemovedEventArgs(aeTitle));
                    }
                    catch { }
                }

                ServerState.Instance.ClientList = new ClientInformationList(_view.ClientInformationList);
            }
        }