Пример #1
0
        public override void OnException(MethodExecutionArgs args)
        {
            string argstr = "";

            //foreach (var a in args.Arguments)
            //{
            //   argstr += string.Format( " ParameterName:{0} | Value:{1} \r\n", a.GetType().Name, a.ToString());
            //}

            en.SendNotificationEmail("",
                                     Properties.Settings.Default.MachineName + ".com",
                                     Properties.Settings.Default.MachineName,
                                     @"*****@*****.**",
                                     null,
                                     "Exception Occured",
                                     args.Method.Name, argstr, args.Exception.GetType().Name, args.Exception.Message, args.Exception.StackTrace);
        }
Пример #2
0
        //[MyExceptionHandlerAspect]
        void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
        {
            string errorMessage = string.Format("An unhandled exception occurred!: {0} ---- {1}", e.Exception.Message, e.Exception.StackTrace);

            MessageBox.Show(errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            if (!errorMessage.Contains("Failure sending mail"))
            {
                var en = new EmailLogger.EmailslNotifications("Exception Occurred");
                en.SendNotificationEmail("",
                                         PayrollManager.Properties.Settings.Default.MachineName + ".com",
                                         PayrollManager.Properties.Settings.Default.MachineName,
                                         @"*****@*****.**",
                                         null,
                                         "Exception Occurred",
                                         "", "", e.Exception.GetType().Name, e.Exception.Message, e.Exception.StackTrace);
            }


            e.Handled = true;
            // throw new Exception(errorMessage);
        }