Exemplo n.º 1
0
        /// <summary>
        /// Shows the 'Server too busy to perform the requested action' Dialog.
        /// </summary>
        /// <param name="ADerivedException">An Exception instance that is derived from
        /// <see cref="EDBAccessLackingCoordinationException"/>.</param>
        /// <param name="AReason">Contains the reason as to why the action was not possible.</param>
        public static void ShowDBAccessLackingActionNotPossibleDialog(
            EDBAccessLackingCoordinationException ADerivedException, out string AReason)
        {
            AReason = Catalog.GetString("Unknown.");

            if (ADerivedException as EDBTransactionBusyException != null)
            {
                AReason = Catalog.GetString("Waiting time for initiating exclusive data access exceeded.");
            }
            else if (ADerivedException as EDBTransactionIsolationLevelWrongException != null)
            {
                AReason = Catalog.GetString("Shared data access could not be initiated.");
            }
            else if (ADerivedException as EDBCoordinatedDBAccessWaitingTimeExceededException != null)
            {
                AReason = Catalog.GetString("Waiting time for data access exceeded.");
            }
            else if
            (
                (ADerivedException as EDBAttemptingToWorkWithTransactionThatGotStartedOnDifferentThreadException != null) ||
                (ADerivedException as
                 EDBAttemptingToCreateCommandOnDifferentDBConnectionThanTheDBConnectionOfOfTheDBTransactionThatGotPassedException != null) ||
                (ADerivedException as EDBAttemptingToCreateCommandEnlistedInDifferentDBTransactionThanTheCurrentDBTransactionException != null) ||
                (ADerivedException as EDBAttemptingToCloseDBConnectionThatGotEstablishedOnDifferentThreadException != null)
            )
            {
                AReason = Catalog.GetString("Parallel data access could not be performed.");
            }

            MessageBox.Show(String.Format(AppCoreResourcestrings.StrPetraServerTooBusyWaitAFewSecondsNoAutomaticRetryCancel,
                                          String.Format(Catalog.GetString("perform the requested action.  (Reason: {0})"), AReason)),
                            AppCoreResourcestrings.StrPetraServerTooBusyTitle,
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Exemplo n.º 2
0
        public static void ProcessEDBAccessLackingCoordinationExc(EDBAccessLackingCoordinationException AException)
        {
            string Reason = String.Empty;

            //Would normally use the code below but cannot due to circular referencing.
            //Form MainMenuForm = TFormsList.GFormsList.MainMenuForm;

            if (Application.OpenForms.Count != 0)              // in the Main Menu Form Test this will be false...
            {
                Form MainMenuForm = Application.OpenForms[0];  // This gets the first ever opened Form, which is the Main Menu

                // Ensure MessageBox is shown on the UI Thread!
                if (MainMenuForm.InvokeRequired)
                {
                    MainMenuForm.Invoke((MethodInvoker) delegate
                    {
                        TServerBusyHelperGui.ShowDBAccessLackingActionNotPossibleDialog(
                            AException, out Reason);
                    });
                }
                else
                {
                    TServerBusyHelperGui.ShowDBAccessLackingActionNotPossibleDialog(
                        AException, out Reason);
                }
            }
            else
            {
                TServerBusyHelperGui.ShowDBAccessLackingActionNotPossibleDialog(
                    AException, out Reason);
            }

            if (TLogging.DebugLevel >= TLogging.DEBUGLEVEL_COORDINATED_DB_ACCESS)
            {
                TLogging.Log(String.Format(Catalog.GetString(
                                               TLogging.LOG_PREFIX_INFO + "The OpenPetra Server was too busy to perform the requested action. (Reason: {0})"),
                                           Reason));
                TLogging.Log(AException.StackTrace);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Shows the 'Server too busy to perform the requested action' Dialog.
        /// </summary>
        /// <param name="ADerivedException">An Exception instance that is derived from
        /// <see cref="EDBAccessLackingCoordinationException"/>.</param>
        /// <param name="AReason">Contains the reason as to why the action was not possible.</param>
        public static void ShowDBAccessLackingActionNotPossibleDialog(
            EDBAccessLackingCoordinationException ADerivedException, out string AReason)
        {
            AReason = Catalog.GetString("Unknown.");

            if (ADerivedException as EDBTransactionBusyException != null)
            {
                AReason = Catalog.GetString("Waiting time for initiating exclusive data access exceeded.");
            }
            else if (ADerivedException as EDBTransactionIsolationLevelWrongException != null)
            {
                AReason = Catalog.GetString("Failed to initiate shared data access.");
            }
            else if (ADerivedException as EDBCoordinatedDBAccessWaitingTimeExceededException != null)
            {
                AReason = Catalog.GetString("Waiting time for data access exceeded.");
            }

            MessageBox.Show(String.Format(AppCoreResourcestrings.StrPetraServerTooBusyWaitAFewSecondsNoAutomaticRetryCancel,
                                          String.Format(Catalog.GetString("perform the requested action.  (Reason: {0})"), AReason)),
                            AppCoreResourcestrings.StrPetraServerTooBusyTitle,
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
        }