예제 #1
0
 // Creates the error message and displays it.
 private DialogResult ShowThreadExceptionDialog(Exception e)
 {
     try
     {
         if (e is DbModelTimeoutException)
         {
             ErrorForm.ShowWarning("msgTimeoutList", "Cannot retrieve records from database because of the timeout. Please change search criteria and try again");
         }
         else if (!SqlExceptionHandler.Handle(e))
         {
             ErrorForm.ShowError(StandardError.UnprocessedError, e);
         }
     }
     catch (Exception e1)
     {
         Dbg.Debug("application error: {0} ", e.ToString());
         if (e.InnerException != null)
         {
             Dbg.Debug("Inner exception: {0} ", e.InnerException.ToString());
         }
         Dbg.Debug("error during displaying application error: {0} ", e1.ToString());
         return(MessageForm.Show(e.Message, "Application Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop));
     }
     if (BaseFormManager.MainForm == null || !((MainForm)BaseFormManager.MainForm).m_Loaded)
     {
         return(DialogResult.Abort);
     }
     return(DialogResult.Ignore);
 }
예제 #2
0
        private bool ConnectToArchiveDatabase()
        {
            try
            {
                if (m_StoredUserPermissions == null)
                {
                    m_StoredUserPermissions = EidssUserContext.User.Permissions;
                }
                var credentials = new ConnectionCredentials(null, "Archive");
                ConnectionManager.DefaultInstance.SetCredentials(null, null, null, null, null, "Archive");
                DbManagerFactory.SetSqlFactory(credentials.ConnectionString);
                if (credentials.IsCorrect)
                {
                    using (var manager = DbManagerFactory.Factory.Create(ModelUserContext.Instance))
                    {
                        if (!manager.TestConnection())
                        {
                            ErrorForm.ShowError("errArchiveConnectionError");
                            return(false);
                        }
                    }
                }
                else
                {
                    ErrorForm.ShowError("errArchiveConnectionError");
                    return(false);
                }

                var readOnlyPermissions = new Dictionary <string, bool>();
                foreach (string key in m_StoredUserPermissions.Keys)
                {
                    if (key.StartsWith(EIDSSPermissionObject.HumanCaseDeduplication.ToString()) ||
                        key.StartsWith(EIDSSPermissionObject.NotificationSubscription.ToString())
                        )
                    {
                        continue;
                    }
                    readOnlyPermissions.Add(key, key.EndsWith(".Select") ? m_StoredUserPermissions[key] : false);
                }
                EidssUserContext.User.Permissions = readOnlyPermissions;
                BaseFormManager.ArchiveMode       = true;
                return(true);
            }
            catch (Exception e)
            {
                if (!SqlExceptionHandler.Handle(e))
                {
                    ErrorForm.ShowError("errArchiveConnectionError", e);
                }
                return(false);
            }
        }
예제 #3
0
        public void btnOk_Click(Object sender, EventArgs e)
        {
            if (!ValidateData())
            {
                return;
            }
            try
            {
                var errMessage = PasswordValidatorHelper.ChangePassword(txtOrganization.Text, txtUserName.Text, txtPassword.Text, txtNewPassword1.Text,
                                                                        txtNewPassword2.Text);
                if (errMessage != null)
                {
                    ErrorForm.ShowMessageDirect(errMessage);
                    return;
                }

                DialogResult = DialogResult.OK;
                Close();
            }
            catch (Exception ex)
            {
                if (SqlExceptionHandler.Handle(ex))
                {
                    return;
                }
                string errMessage;
                if (ex is SqlException)
                {
                    errMessage = SecurityMessages.GetDBErrorMessage((ex as SqlException).Number, null, null);
                }
                else
                {
                    errMessage = SecurityMessages.GetDBErrorMessage(0, null, null);
                }
                ErrorForm.ShowErrorDirect(errMessage, ex);
            }
        }
예제 #4
0
        private void btnOk_Click(Object sender, EventArgs e)
        {
            string errorMessage  = string.Empty;
            var    errorCode     = -1;
            var    bSuccessLogin = false;

            try
            {
                if (!ValidateArchiveConnection())
                {
                    return;
                }
                if (!ValidateAvrService())
                {
                    return;
                }
                InitConnection();
                bSuccessLogin = DoLogin(m_Manager, txtOrganization.Text, txtUserName.Text, txtPassword.Text, out errorCode);
                if (!bSuccessLogin)
                {
                    switch (errorCode)
                    {
                    case 6:
                        errorMessage = SecurityMessages.GetLoginErrorMessage(errorCode, txtOrganization.Text,
                                                                             txtUserName.Text);
                        break;

                    default:
                        errorMessage = SecurityMessages.GetLoginErrorMessage(errorCode);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                if (SqlExceptionHandler.Handle(ex))
                {
                    m_LoginType = LoginType.Complex;
                    UpdateTabsVisibility();
                    return;
                }
                errorMessage = SqlExceptionMessage.Get(ex);
                if (errorMessage == null)
                {
                    Dbg.Debug("unprocessed error during login: {0}", ex);
                    errorMessage = StandardErrorHelper.Error(StandardError.UnprocessedError);
                }
                else
                {
                    errorMessage = BvMessages.Get(errorMessage);
                }
            }

            if (bSuccessLogin)
            {
                SuccessLogin();
            }
            else
            {
                FailedLogin(errorMessage, errorCode);
            }
        }