public void Delete(HRR.Core.Domain.ApplicationException item) { new ApplicationExceptionRepository().Delete(item); }
protected override void OnError(EventArgs e) { base.OnError(e); if (SecurityContextManager.Current == null || SecurityContextManager.Current.CurrentUser == null) { try { IdeaSeed.Core.Mail.EmailUtils.SendEmail(ConfigurationManager.AppSettings["EMAILSUPPORT_TO"], ConfigurationManager.AppSettings["EMAILSUPPORT_FROM"], "", "", " Error occured and session gone: " + Server.GetLastError().Message + ".", Server.GetLastError().Message + "<br /><br /><br />Stack Trace:<br /><br />" + Server.GetLastError().StackTrace, false, ""); new WebSecurityContext().LogEvent(-1, DateTime.Now, (int)ApplicationLogTypes.EXCEPTION_UNHANDLED, ((Account)Session[HRR.Core.ResourceStrings.Session_Account]).ID, "Error occured and SecurityContext is null. Error Message:<br /><br />" + Server.GetLastError().Message, "", ""); new WebSecurityContext().SignOutUser(); } catch (Exception emailexc) { new WebSecurityContext().SignOutUser(); } } //if in development environment then I want to see the exception. if (!ConfigurationManager.AppSettings["ENVIRONMENT"].Equals("DEVELOPMENT")) { var aes = new ApplicationExceptionServices(); var ae = new HRR.Core.Domain.ApplicationException(); Exception ex = Server.GetLastError(); if (ex != null && !string.IsNullOrEmpty(ex.ToString())) { ae.AccountID = ((Person)SecurityContextManager.Current.CurrentUser).AccountID; ae.ExceptionDate = DateTime.Now; if (!string.IsNullOrEmpty(ex.GetType().Name.ToString())) { ae.ExceptionType = ex.GetType().Name.ToString(); } else { ae.ExceptionType = "Type Not Found"; } if (!string.IsNullOrEmpty(ex.Message)) { ae.Message = ex.Message; } else { ae.Message = "Message Not Found"; } if (!string.IsNullOrEmpty(ex.StackTrace)) { ae.StackTrace = ex.StackTrace; } else { ae.StackTrace = "Stack Trace Not Found"; } if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { ae.InnerMessage = ex.InnerException.Message; } else { ae.InnerMessage = "Inner Message Not Found"; } ae.CurrentURL = HttpContext.Current.Request.Url.ToString(); ae.UserID = SecurityContextManager.Current.CurrentUser.ID; //string session = ""; //int sessioncount = SessionManager.Current.; //for (int i = 0; sessioncount > i; i++) //{ // session += HttpContext.Current.Session[i] + ", "; //} ae.SessionData = SessionManager.Current.ToString(); aes.Save(ae); //Send exception to support StringBuilder sb = new StringBuilder(); sb.Append("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN' >"); sb.Append("<html><body><table width='600px'><tr><td colspan='3'>"); sb.Append("<h4>Unexpected Error: "); sb.Append(ae.ExceptionType); sb.Append("</h4></td></tr>"); sb.Append("<tr><td>"); sb.Append("<b>When:</b> </td><td>"); sb.Append(ae.ExceptionDate); sb.Append("</td></tr><tr><td>"); sb.Append("<b>URL:</b> </td><td>"); sb.Append(ae.CurrentURL); sb.Append("</td></tr><tr><td>"); sb.Append("<b>Message:</b> </td><td>"); sb.Append(ae.Message); sb.Append("</td></tr><tr><td>"); sb.Append("<b>Inner Message:</b> </td><td>"); sb.Append(ae.InnerMessage); sb.Append("</td></tr><tr><td>"); sb.Append("<b>Stack Trace:</b> </td><td>"); sb.Append(ae.StackTrace); sb.Append("</td></tr><tr><td>"); sb.Append("<b>Logged On User:</b> </td><td>"); sb.Append(((Person)SecurityContextManager.Current.CurrentUser).Name); sb.Append("</td></tr><tr><td>"); sb.Append("<b>Session:</b> </td><td>"); sb.Append(ae.SessionData); sb.Append("</td></tr><tr><td>"); sb.Append("</td></tr></table></body></html>"); try { IdeaSeed.Core.Mail.EmailUtils.SendEmail(ConfigurationManager.AppSettings["EMAILSUPPORT_TO"], ConfigurationManager.AppSettings["EMAILSUPPORT_FROM"], "", "", SecurityContextManager.Current.CurrentAccount.Company + " Support. Unexpected Exception: " + ae.ExceptionType + ".", sb.ToString(), false, ""); } catch (Exception emailexc) { } Response.Redirect(ConfigurationManager.AppSettings["CUSTOMERRORSURL"] + "?exceptionid=" + ae.ID.ToString()); } } }
public HRR.Core.Domain.ApplicationException Save(HRR.Core.Domain.ApplicationException item) { return(new ApplicationExceptionRepository().SaveOrUpdate(item)); }