private void SimulateExceptionIgnored() { try { File.ReadAllLines("notexistingfile"); } catch (Exception ex) { StdLoggingHandler.FileTraceIgnoredException(ex); } }
/// <summary> /// Shows the error message. /// </summary> /// <param name="ex">The ex.</param> /// <param name="title">The title.</param> /// <param name="frm">The FRM.</param> public static void ShowErrorMessage(Exception ex, string title, Form frm) { if (PriEngine.Platform == null) { MessageBox.Show(StdLoggingHandler.FullMessageFromException(ex), title, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { PriEngine.Platform.AlertNotificationManager.ShowCustomAlert(title, ex.Message, Properties.Resources.error, frm); } StdLoggingHandler.FileTraceIgnoredException(ex); }
private void btSave_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtCode.Text) || string.IsNullOrEmpty(txtDescription.Text) || string.IsNullOrEmpty(txtFileLocation.Text)) { PriEngine.Platform.AlertNotificationManager.ShowCustomAlert(this.Text, "All text fields must be filled!", Properties.Resources.Icon_Message, this); return; } switch (cbbCategory.SelectedIndex) { case 1: tabela = EnumTabelaAnexos.anxClientes; break; default: tabela = EnumTabelaAnexos.anxOutrosTerceiros; break; } StdBEAnexo anexo = new StdBEAnexo { IdAnexo = PriEngine.Platform.FuncoesGlobais.CriaGuid(true), Chave = txtCode.Text, Tabela = tabela, Descricao = Path.GetFileNameWithoutExtension(txtFileLocation.Text), Encriptado = ckbEncrypt.Checked, FicheiroOrigem = txtFileLocation.Text, EmModoEdicao = false, Utilizador = PriEngine.Platform.Contexto.Utilizador.Utilizador, Data = DateTime.Now }; PriEngine.Platform.Anexos.Actualiza(anexo); lstAttachs.Items.Add(txtFileLocation.Text); txtFileLocation.ResetText(); PriEngine.Platform.AlertNotificationManager.ShowCustomAlert(this.Text, "Attachment added to entity with success.", Properties.Resources.Icon_Success, this); } catch (Exception ex) { StdLoggingHandler.FileTraceIgnoredException(ex); PriEngine.Platform.AlertNotificationManager.ShowCustomAlert(this.Text, "An error as occurred while adding the attachment to entity!", Properties.Resources.Icon_Alert, this); } }