Exemplo n.º 1
0
        public static void ShowError(StandardError errType, Exception ex)
        {
            if (HandleException(ex))
            {
                return;
            }
            string error       = StandardErrorHelper.Error(errType);
            string detailError = ex.ToString();

            ShowMessageDirect(error, FormType.Error, detailError);
        }
Exemplo n.º 2
0
        private string ValidateFieldClone(WebPivotGridFieldClone clonedField, bool isDateTimeField)
        {
            string       error         = String.Empty;
            const string lineSeparator = "<br/>";

            if (string.IsNullOrEmpty(clonedField.CaptionEn))
            {
                bv.common.Core.Utils.AppendLine(ref error,
                                                StandardErrorHelper.Error(StandardError.Mandatory, Translator.GetMessageString("strNewColumnNameEn")),
                                                lineSeparator);
            }
            if (ModelUserContext.CurrentLanguage != Localizer.lngEn && string.IsNullOrEmpty(clonedField.Caption))
            {
                bv.common.Core.Utils.AppendLine(ref error,
                                                StandardErrorHelper.Error(StandardError.Mandatory, Translator.GetMessageString("strNewColumnName")),
                                                lineSeparator);
            }

            if (clonedField.AddMissedValues && isDateTimeField)
            {
                if (clonedField.DiapasonStartDate == null)
                {
                    bv.common.Core.Utils.AppendLine(ref error,
                                                    StandardErrorHelper.Error(StandardError.Mandatory, Translator.GetMessageString("DateFrom")),
                                                    lineSeparator);
                }
                if (clonedField.DiapasonEndDate == null)
                {
                    bv.common.Core.Utils.AppendLine(ref error,
                                                    StandardErrorHelper.Error(StandardError.Mandatory, Translator.GetMessageString("DateTo")),
                                                    lineSeparator);
                }
                if (ModelState.IsValid && clonedField.DiapasonStartDate > clonedField.DiapasonEndDate)
                {
                    bv.common.Core.Utils.AppendLine(ref error,
                                                    string.Format(Translator.GetMessageString("ErrUnstrictChainDate"), Translator.GetMessageString("DateFrom"),
                                                                  clonedField.DiapasonStartDate, Translator.GetMessageString("DateTo"), clonedField.DiapasonEndDate),
                                                    lineSeparator);
                }
            }
            return(error);
        }
Exemplo n.º 3
0
        public static string GetDBErrorMessage(int?sqlErrorNumber, string databaseName, string serverName)
        {
            switch (sqlErrorNumber)
            {
            case 15211:
                return(BvMessages.Get("InvalidOldPassword"));

            case 18456:
            case 18450:
            case 18452:
            case 18458:
            case 18459:
            case 18460:
                return(StandardErrorHelper.Error(StandardError.InvalidLogin));

            case 4060:
                return(string.Format(BvMessages.Get("errDatabaseNotFound", "Cannot open database \'{0}\' on server \'{1}\'. Check the correctness of database name."), databaseName, serverName));

            default:
                return(BvMessages.Get("errSQLLoginError", "Cannot connect to SQL server. Check the correctness of SQL connection parameters in the SQL Server tab or SQL server accessibility."));
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 5
0
 public static void ShowMandatoryError(string fieldName)
 {
     ErrorForm.ShowErrorDirect(StandardErrorHelper.Error(StandardError.Mandatory, fieldName));
 }