Exemple #1
0
        private CommandAsyncProcessor RegisterAutoSaveLogService(LoggingState logState)
        {
            AutoSaveLogCommand      autoSaveCommand;
            CommandAsyncProcessor   service           = null;
            IOptionsDataAccessAgent optionsDataAccess = null;

            optionsDataAccess = DataAccessServices.GetDataAccessService <IOptionsDataAccessAgent>();

            if (optionsDataAccess != null)
            {
                autoSaveCommand = new AutoSaveLogCommand(logState);
                service         = new CommandAsyncProcessor();

                if (logState.EnableAutoSaveLog)
                {
                    string nextLogDate;


                    nextLogDate = optionsDataAccess.Get <string>(NextLogDateSettingsName, null, new Type[0]);

                    if (!string.IsNullOrEmpty(nextLogDate))
                    {
                        DateTime nextLog = DateTime.Parse(nextLogDate);

                        if (DateTime.Now > nextLog)
                        {
                            autoSaveCommand.Execute();
                        }
                    }
                }

                service.Commands.Add(autoSaveCommand);

                ConfigureServiceIntervals(logState, service, optionsDataAccess);

                service.CommandsExecuted += new EventHandler(service_CommandsExecuted);

                ServiceLocator.Register <CommandAsyncProcessor>(service);
            }

            return(service);
        }
Exemple #2
0
        public bool CanAccessDatabase(out string error)
        {
            error = string.Empty;
            bool ret = false;

            try
            {
                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(GatewaySession.ServiceDirectory);

                IForwardDataAccessAgent forwardAgent = GetAgent <IForwardDataAccessAgent>(configuration, new ForwardDataAccessConfigurationView(configuration, null, GatewaySession.ServiceName));
                IOptionsDataAccessAgent optionsAgent = GetAgent <IOptionsDataAccessAgent>(configuration, new OptionsDataAccessConfigurationView(configuration, null, GatewaySession.ServiceName));

                bool bContinue = true;
                if (forwardAgent == null)
                {
                    error     = string.Format("{0} {1}", AssemblyName, "Cannot create IForwardDataAccessAgent");
                    bContinue = false;
                }

                if (bContinue)
                {
                    if (optionsAgent == null)
                    {
                        error     = string.Format("{0} {1}", AssemblyName, "Cannot create IOptionsDataAccessAgent");
                        bContinue = false;
                    }
                }

                if (bContinue)
                {
                    forwardAgent.IsForwarded("notUsed");
                    optionsAgent.GetDefaultOptions();
                }
            }
            catch (Exception e)
            {
                error = string.Format("{0} {1}", AssemblyName, e.Message);
            }

            ret = string.IsNullOrEmpty(error);
            return(ret);
        }
Exemple #3
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);
        }
Exemple #4
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();
            }
        }
Exemple #5
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);
            }
        }
Exemple #6
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);
            }
        }
Exemple #7
0
        public AuthenticationAddin(IUserManagementDataAccessAgent4 UserManagementDataAccessAgent, Leadtools.Medical.PermissionsManagement.DataAccessLayer.IPermissionManagementDataAccessAgent2 PermissionManagementDataAccessAgent, IOptionsDataAccessAgent optionsAgent,
                                   ILoggingDataAccessAgent loggingAgent)
        {
            UserManagementAgent       = UserManagementDataAccessAgent;
            PermissionManagementAgent = PermissionManagementDataAccessAgent;
            OptionsAgent = optionsAgent;
            LoggingAgent = loggingAgent;

            AuthenticationLogger.OptionsAgent = optionsAgent;
        }
Exemple #8
0
 public ExportAddin(IStorageDataAccessAgent3 dataAccessAgent, IAuthorizedStorageDataAccessAgent2 authAgent, Lazy <IExternalStoreDataAccessAgent> externalStoreAgent, ILoggingDataAccessAgent loggingAgent, string storageServerServicePath, IStoreAddin storeAddin, IOptionsDataAccessAgent optionsAgent, IPermissionManagementDataAccessAgent2 permissionsAgent, Leadtools.Dicom.Imaging.IDataCacheProvider dataCache)
 {
     _DataAccessAgent     = dataAccessAgent;
     _Exporter            = new Exporter(dataAccessAgent);
     _ObjectRetrieveAddIn = new ObjectRetrieveAddin(dataAccessAgent, externalStoreAgent, loggingAgent, storageServerServicePath, optionsAgent, permissionsAgent, authAgent, dataCache);
     _StoreAddin          = storeAddin;
     _QueryAddIn          = new DatabaseQueryAddin(authAgent, optionsAgent, permissionsAgent, externalStoreAgent, loggingAgent, storageServerServicePath, null, dataCache);
 }
Exemple #9
0
 public OptionsAddin(IOptionsDataAccessAgent dataAccess, ILoggingDataAccessAgent loggingAccess)
 {
     DataAccess        = dataAccess;
     LoggingDataAccess = loggingAccess;
 }
Exemple #10
0
 static UserManager()
 {
     userAgent         = Program.GetUserAgent(GlobalPacsConfiguration);
     permissionsAgent2 = Program.GetPermissionsAgent(GlobalPacsConfiguration);
     optionsAgent      = Program.GetOptionsAgent(GlobalPacsConfiguration);
 }