private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { Exception ex = e.Exception as Exception; string hostName = Dns.GetHostName(); string ipAddress = Dns.GetHostEntry(hostName).AddressList[0].ToString(); LogError.CreateLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, "", ipAddress); MessageBox.Show(ex.Message, "Error...", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { if (e.ExceptionObject is Exception) { Exception ex = e.ExceptionObject as Exception; string hostName = Dns.GetHostName(); string ipAddress = Dns.GetHostEntry(hostName).AddressList[0].ToString(); LogError.CreateLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, "", ipAddress); MessageBox.Show(ex.Message, "Error...", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public static void Eliminar(Usuario usuarioAEliminar) { try { using (SqlConnection connection = null) Editar(usuarioAEliminar, connection); } catch (Exception ex) { //si hubiera ws ahí tendría que haber otro try catch y ahí loguear el error! string hostName = Dns.GetHostName(); string ipAddress = Dns.GetHostEntry(hostName).AddressList[0].ToString(); LogError.CreateLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, "", ipAddress); throw ex; } }
public static List <Usuario> ObtenerPorParametros(ParametrosBusquedaUsuarios parametros) { try { using (SqlConnection connection = null) return(ObtenerPorParametros(parametros, connection)); } catch (Exception ex) { //si hubiera ws ahí tendría que haber otro try catch y ahí loguear el error! string hostName = Dns.GetHostName(); string ipAddress = Dns.GetHostEntry(hostName).AddressList[0].ToString(); LogError.CreateLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, "", ipAddress); throw ex; } }
public static Usuario ObtenerUsuario(string user, string dominio, string contraseña, string appName) { try { Usuario usuario = new Usuario(); usuario.User = user; usuario.Domain = dominio; usuario.Password = contraseña; usuario.AppName = appName; SqlConnection connection = null; return(ObtenerUsuario(usuario, connection)); } catch (Exception ex) { string hostName = Dns.GetHostName(); string ipAddress = Dns.GetHostEntry(hostName).AddressList[0].ToString(); LogError.CreateLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, usuario.User, ipAddress); throw ex; } }