/// <summary> /// Loads the exception occurrences panel /// </summary> /// <param name="exceptionId">The Id of the base exception for the grid</param> private void LoadExceptionOccurrences(int exceptionId) { //get the base exception ExceptionLogService exceptionService = new ExceptionLogService(new RockContext()); ExceptionLog exception = exceptionService.Get(exceptionId); //set the summary fields for the base exception if (exception != null) { if (Page.IsPostBack && Page.IsAsync) { this.AddHistory("ExceptionId", exceptionId.ToString(), string.Format("Exception Occurrences {0}", exception.Description)); } hfBaseExceptionID.Value = exceptionId.ToString(); var descriptionList = new Rock.Web.DescriptionList(); // set detail title with formating lDetailTitle.Text = String.Format("Occurrences of {0}", exception.ExceptionType).FormatAsHtmlTitle(); if (!string.IsNullOrEmpty(exception.ExceptionType)) { descriptionList.Add("Type", exception.ExceptionType); } if (exception.Site != null) { descriptionList.Add("Site", exception.Site.Name); } if (exception.Page != null) { descriptionList.Add("Page", exception.Page.InternalName); } lblMainDetails.Text = descriptionList.Html; //Load the occurrences for the selected exception BindExceptionOccurrenceGrid(exception); } }
/// <summary> /// Get the root-level exception of the specified exception. /// </summary> /// <param name="exception">An existing exception.</param> private ExceptionLog GetOutermostException(ExceptionLog exception) { if (exception == null) { return(null); } if (exception.ParentId == null) { return(exception); } var dataContext = GetDataContext(); var exceptionService = new ExceptionLogService(dataContext); ExceptionLog parentException; while (exception != null) { parentException = exceptionService.Get(( int )exception.ParentId); // If the parent exception cannot be found, this is the base exception. if (parentException == null) { return(exception); } if (parentException.ParentId == null) { return(parentException); } exception = parentException; } return(null); }