Example #1
0
        public PresentationContextList LoadSettings( )
        {
            PresentationContextList list;


            if (null == _optionsAgent)
            {
                _optionsAgent = GetOptionsDataAccessAgent( );
            }

            if (null != _optionsAgent && _optionsAgent.OptionExits(_settingsKeyName))
            {
                list = _optionsAgent.Get <PresentationContextList>(_settingsKeyName, null, new Type[0]);
            }
            else
            {
                list = new PresentationContextList();
                list.Default();

                if (null != _optionsAgent)
                {
                    _optionsAgent.Set <PresentationContextList> (_settingsKeyName, list, new Type[0]);
                }
            }

            return(list);
        }
        public AnonymizeScripts LoadSettings()
        {
            AnonymizeScripts scripts;


            if (null == _optionsAgent)
            {
                _optionsAgent = GetOptionsDataAccessAgent();
            }

            if (null != _optionsAgent && _optionsAgent.OptionExits(AnonymizeOptionsKey))
            {
                scripts = _optionsAgent.Get <AnonymizeScripts>(AnonymizeOptionsKey, null, new Type[0]);
            }
            else
            {
                scripts = new AnonymizeScripts(true);

                if (null != _optionsAgent)
                {
                    _optionsAgent.Set <AnonymizeScripts>(AnonymizeOptionsKey, scripts, new Type[0]);
                }
            }

            return(scripts);
        }
 private void OnUpdateServerSettings(object sender, EventArgs e)
 {
     try
     {
         _Options.Set <DatabaseManagerOptions>(DatabaseManagerOptions, View.Options);
     }
     catch (Exception exception)
     {
         Messager.ShowError(null, exception);
     }
 }
 private void OnUpdateServerSettings(object sender, EventArgs e)
 {
     try
     {
         _Options.Set <ClientConfigurationOptions>(ClientConfigurationOptions, View.Options);
     }
     catch (Exception exception)
     {
         Messager.ShowError(null, exception);
     }
 }
Example #5
0
 private void OnUpdateServerSettings(object sender, EventArgs e)
 {
     try
     {
         _optionsAgent.Set <PasswordOptions>(PasswordOptions, View.Options);
         if (View.Options.EnableIdleTimeout)
         {
             StartIdleMonitor();
         }
         else
         {
             StopIdleMonitor();
         }
     }
     catch (Exception exception)
     {
         Messager.ShowError(null, exception);
     }
 }
Example #6
0
        private void SetNextLogDate(DateTime nextLogDate, LoggingState logState, IOptionsDataAccessAgent optionsDataAccess)
        {
            nextLogDate = new DateTime(nextLogDate.Year,
                                       nextLogDate.Month,
                                       nextLogDate.Day,
                                       logState.AutoSaveTime.Hour,
                                       logState.AutoSaveTime.Minute,
                                       logState.AutoSaveTime.Second);


            optionsDataAccess.Set <string> (NextLogDateSettingsName, nextLogDate.ToString( ), new Type[0]);
        }
Example #7
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 #8
0
        private static void SetStorageServerInformationOptions(IOptionsDataAccessAgent optionsAgent)
        {
            if (null != ServerState.Instance.ServerService)
            {
                StorageServerInformation information = null;

                DicomAE ae = new DicomAE(ServerState.Instance.ServerService.Settings.AETitle,
                                         ServerState.Instance.ServerService.Settings.IpAddress,
                                         ServerState.Instance.ServerService.Settings.Port,
                                         0,
                                         ServerState.Instance.ServerService.Settings.Secure);

                information = new StorageServerInformation(ae, ServerState.Instance.ServerService.ServiceName, Environment.MachineName);

                optionsAgent.Set <StorageServerInformation> (typeof(StorageServerInformation).Name, information, new Type[0]);
            }
        }
Example #9
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);
            }
        }