protected virtual void OnCallCarregaInformacoes() { if (eCallCarregaInformacoes != null) { mdlDataBaseAccess.Tabelas.XsdTbErros.tbErrosRow dtrwDados = eCallCarregaInformacoes(); if (dtrwDados != null) { m_txtCodigoCliente.Text = dtrwDados.mstrCodigoCliente; m_txtNomeMaquina.Text = dtrwDados.mstrNomeMaquina; m_txtNomeUsuario.Text = dtrwDados.mstrUsuario; m_txtVersaoServidor.Text = dtrwDados.strVersaoServidor; m_txtVersaoCliente.Text = dtrwDados.strVersaoCliente; m_txtExceptionSource.Text = dtrwDados.mstrExceptionSource; m_txtExceptionMessage.Text = dtrwDados.mstrExceptionMessage; m_txtExceptionStackTrace.Text = dtrwDados.mstrExceptionStackTrace; m_txtExceptionTargetSite.Text = dtrwDados.mstrExceptionTargetSite; m_txtExceptionHelpLink.Text = dtrwDados.mstrExceptionHelpLink; m_txtExceptionString.Text = dtrwDados.mstrExceptionString; } } }
public void trataErro(ref Object objErro) { System.Exception exErro = (System.Exception)objErro; if (m_cls_dba_ConnectionDB == null) { // PROGRAMADORES string strException = ""; strException = "ATENÇÃO!!! Resolva o problema encontrado ou relate o problema em Leiame.xml no modulo problemático."; strException += System.Environment.NewLine; strException += System.Environment.NewLine; strException += exErro.ToString() + System.Environment.NewLine; System.Windows.Forms.MessageBox.Show(strException, "Siscobras - Problemas na Código"); } else { // USUARIOS mdlManipuladorArquivo.clsManipuladorArquivoIni m_cls_man_Arquivo = new mdlManipuladorArquivo.clsManipuladorArquivoIni(m_strEnderecoExecutavel + NOME_ARQUIVO_CONFIGURACAO); // Erro System.DateTime dtOcorrencia = System.DateTime.Now; string strExceptionSource = exErro.Source; string strExceptionMessage = exErro.Message; string strExceptionStackTrace = exErro.StackTrace; string strExceptionTargetSite = exErro.TargetSite.ToString(); string strExceptionHelpLink = ""; if (exErro.HelpLink != null) { strExceptionHelpLink = exErro.HelpLink; } string strExceptionString = exErro.ToString(); // Identificacao Cliente string strCodigoCliente = m_cls_dba_ConnectionDB.GetConfiguracao("CodigoCliente", ""); string strNomeMaquina = System.Environment.MachineName; int nIdUsuario = -1; string strUsuario = ""; string strVersaoServidor = m_cls_dba_ConnectionDB.GetConfiguracao("VersaoServidor", ""); string strVersaoCliente = m_cls_man_Arquivo.retornaValor("Siscobras", "VersaoCliente", ""); // Inserindo no banco de dados mdlDataBaseAccess.Tabelas.XsdTbErros typDatSetTbErros = m_cls_dba_ConnectionDB.GetTbErros(null, null, null, null, null); m_dtrwErro = typDatSetTbErros.tbErros.NewtbErrosRow(); m_dtrwErro.nIdErro = 1; while (typDatSetTbErros.tbErros.FindBynIdErro(m_dtrwErro.nIdErro) != null) { m_dtrwErro.nIdErro = m_dtrwErro.nIdErro + 1; } m_dtrwErro.dtOcorrencia = dtOcorrencia; m_dtrwErro.mstrExceptionSource = strExceptionSource; m_dtrwErro.mstrExceptionMessage = strExceptionMessage; m_dtrwErro.mstrExceptionStackTrace = strExceptionStackTrace; m_dtrwErro.mstrExceptionTargetSite = strExceptionTargetSite; m_dtrwErro.mstrExceptionHelpLink = strExceptionHelpLink; m_dtrwErro.mstrExceptionString = strExceptionString; m_dtrwErro.mstrCodigoCliente = strCodigoCliente; m_dtrwErro.mstrNomeMaquina = strNomeMaquina; m_dtrwErro.nIdUsuario = nIdUsuario; m_dtrwErro.mstrUsuario = strUsuario; m_dtrwErro.strVersaoServidor = strVersaoServidor; m_dtrwErro.strVersaoCliente = strVersaoCliente; typDatSetTbErros.tbErros.Rows.Add(m_dtrwErro); try { m_cls_dba_ConnectionDB.SetTbErros(typDatSetTbErros); }catch (System.Exception expErro) { // BD COM PROBLEMAS this.ConnectionDB = null; object objErroDB = (object)expErro; this.trataErro(ref objErroDB); } ShowDialogReportandoProblema(); if (m_bClose && m_bReabrirSiscobras) { if (System.IO.File.Exists(m_strEnderecoExecutavel + "Siscobras.exe")) { System.Diagnostics.Process.Start(m_strEnderecoExecutavel + "Siscobras.exe"); } } if (m_bClose) { System.Environment.Exit(0); } } }
public bool bEnviaDados() { bool bReTry = false; int nErrorsDB = 0, nErrosSent = 0; System.Collections.ArrayList arlURLs; mdlSysWebServicesProxy.clsSysWebServicesProxy cls_Proxy = new mdlSysWebServicesProxy.clsSysWebServicesProxy(ref m_cls_dba_ConnectionDB, m_strEnderecoExecutavel, true); if (cls_Proxy.GetURLListFromService(SERVICE_TRATADOR_ERROS, out arlURLs)) { mdlDataBaseAccess.Tabelas.XsdTbErros typDatSetErros = m_cls_dba_ConnectionDB.GetTbErros(null, null, null, null, null); nErrorsDB = typDatSetErros.tbErros.Rows.Count; if (typDatSetErros.tbErros.Rows.Count > 0) { mdlDataBaseAccess.Tabelas.XsdTbErros.tbErrosRow dtrwErro = null; wbsvSiscoTratamentoErros.wbsvSiscoTratamentoErros wbsvTratadorErro; // Error Data string strCodigoCliente = ""; System.DateTime dtOcorrencia = System.DateTime.Now; string strNomeMaquina = ""; int nIdUsuario = -1; string strUsuario = ""; string strVersaoServidor = ""; string strVersaoCliente = ""; string strExceptionSource = ""; string strExceptionMessage = ""; string strExceptionStackTrace = ""; string strExceptionTargetSite = ""; string strExceptionHelpLink = ""; string strExceptionString = ""; // Getting the Client Code strCodigoCliente = m_cls_dba_ConnectionDB.GetConfiguracao("STRIDCLIENTE", INDEFINIDO); foreach (string strUrl in arlURLs) { wbsvTratadorErro = new mdlWebServiceEnviaDados.wbsvSiscoTratamentoErros.wbsvSiscoTratamentoErros(); wbsvTratadorErro.Url = strUrl; for (int nCont = 0; nCont < typDatSetErros.tbErros.Rows.Count; nCont++) { dtrwErro = (mdlDataBaseAccess.Tabelas.XsdTbErros.tbErrosRow)typDatSetErros.tbErros.Rows[nCont]; if (dtrwErro.RowState != System.Data.DataRowState.Deleted) { // Get the Error Data if (!dtrwErro.IsmstrCodigoClienteNull()) { strCodigoCliente = strCodigoCliente; } else { strCodigoCliente = INDEFINIDO; } if (!dtrwErro.IsdtOcorrenciaNull()) { dtOcorrencia = dtrwErro.dtOcorrencia; } else { dtOcorrencia = System.DateTime.Now; } if (!dtrwErro.IsmstrNomeMaquinaNull()) { strNomeMaquina = dtrwErro.mstrNomeMaquina; } else { strNomeMaquina = INDEFINIDO; } if (!dtrwErro.IsnIdUsuarioNull()) { nIdUsuario = dtrwErro.nIdUsuario; } else { nIdUsuario = -1; } if (!dtrwErro.IsmstrUsuarioNull()) { strUsuario = dtrwErro.mstrUsuario; } else { strUsuario = INDEFINIDO; } if (!dtrwErro.IsstrVersaoServidorNull()) { strVersaoServidor = dtrwErro.strVersaoServidor; } else { strVersaoServidor = ""; } if (!dtrwErro.IsstrVersaoClienteNull()) { strVersaoCliente = dtrwErro.strVersaoCliente; } else { strVersaoCliente = ""; } if (!dtrwErro.IsmstrExceptionSourceNull()) { strExceptionSource = dtrwErro.mstrExceptionSource; } else { strExceptionSource = INDEFINIDO; } if (!dtrwErro.IsmstrExceptionMessageNull()) { strExceptionMessage = dtrwErro.mstrExceptionMessage; } else { strExceptionMessage = INDEFINIDO; } if (!dtrwErro.IsmstrExceptionStackTraceNull()) { strExceptionStackTrace = dtrwErro.mstrExceptionStackTrace; } else { strExceptionStackTrace = INDEFINIDO; } if (!dtrwErro.IsmstrExceptionTargetSiteNull()) { strExceptionTargetSite = dtrwErro.mstrExceptionTargetSite; } else { strExceptionTargetSite = INDEFINIDO; } if (!dtrwErro.IsmstrExceptionTargetSiteNull()) { strExceptionHelpLink = dtrwErro.mstrExceptionHelpLink; } else { strExceptionHelpLink = INDEFINIDO; } if (!dtrwErro.IsmstrExceptionStringNull()) { strExceptionString = dtrwErro.mstrExceptionString; } else { strExceptionString = INDEFINIDO; } try { if (wbsvTratadorErro.bInsereErro(strCodigoCliente, dtOcorrencia, strNomeMaquina, nIdUsuario, strUsuario, strVersaoServidor, strVersaoCliente, strExceptionSource, strExceptionMessage, strExceptionStackTrace, strExceptionTargetSite, strExceptionHelpLink, strExceptionString)) { // Succesfull send dtrwErro.Delete(); nErrosSent++; } else { // Error On Send bReTry = true; } }catch { bReTry = true; } } } if (!bReTry) { break; } } m_cls_dba_ConnectionDB.SetTbErros(typDatSetErros); } } return(nErrorsDB == nErrosSent); }