private bool UnattendedRunPostScript() { bool success = true; ErrorFormParams errorFormParams = dataViewUserControl1.RunPostScriptFile(_postScriptFileName); if (errorFormParams != null) { success = false; } if (success) { errorFormParams = dataViewUserControl1.RunPostScript(_postScript); if (errorFormParams != null) { success = false; } } if (!success) { ErrorFormHandler errorFormHandler = new ErrorFormHandler(); if (!ConfigHandler.ErrorFormShown) { ConfigHandler.ErrorFormShown = true; errorFormHandler.ErrorOccuredEvent(errorFormParams.OkButtonText, errorFormParams.Message, errorFormParams.Sql); } } return(success); }
private void HandleError(string message, string sql, int errorNumber) { _success = false; string okButtonText = "Close"; if (ConfigHandler.UseTranslation) { okButtonText = Translator.GetText("Close"); } if (_exitOnError) { okButtonText = "Exit"; if (ConfigHandler.UseTranslation) { okButtonText = Translator.GetText("exit"); } } _errorFormParams = new ErrorFormParams(okButtonText, message, sql); if (_showErrorForm && (ConfigHandler.ErrorNumbersToSkip == null || (ConfigHandler.ErrorNumbersToSkip != null && !ConfigHandler.ErrorNumbersToSkip.Contains(errorNumber)))) { ErrorFormHandler errorFormHandler = new ErrorFormHandler(); if (!ConfigHandler.ErrorFormShown) { ConfigHandler.ErrorFormShown = true; errorFormHandler.ErrorOccuredEvent(okButtonText, message, sql); } if (errorNumber != -1 && ConfigHandler.ErrorNumbersToSkip != null) { ConfigHandler.ErrorNumbersToSkip.Add(errorNumber); } } if (_exitOnError) { Dispose(); Environment.Exit(-1); } }
private void HandleError(int errorNumber, string message, string sql) { _success = false; if (GenericHelper.ShowErrorMessageForm) { if (_onlyShowOneErrorMessageFormOnMultipleErrors) { GenericHelper.ShowErrorMessageForm = false; } string okButtonText = "Close"; if (_exitOnError) { okButtonText = "Exit"; } if (GenericHelper.UnattendedErrorLogFileName != null) { string error; if (sql != "") { error = string.Format("Error: {0}\r\n\r\nSQL:\r\n{1}", message, sql); } else { error = string.Format("Error: {0}", message); } try { File.WriteAllText(GenericHelper.UnattendedErrorLogFileName, error); } catch (Exception ex) { MessageBox.Show(ex.Message, GenericHelper.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { string location; lock (this) { if (GenericHelper.ActiveRunningStepAndName != null) { location = GenericHelper.ActiveRunningStepAndName; } else { location = GenericHelper.ApplicationName; } } ErrorFormHandler.ErrorOccuredEvent(errorNumber, okButtonText, message, sql, location); } } if (_exitOnError) { Dispose(); Environment.Exit(-1); } }