internal HistoryException FetchModel(IDataReader reader) { var item = new HistoryException { Id = reader.GetInt32("Id"), Section = reader.GetString("Section"), ExceptionType = reader.GetString("ExceptionType"), ExceptionSource = reader.GetString("ExceptionSource"), ExceptionMessage = reader.GetString("ExceptionMessage"), ExceptionStackTrace = reader.GetString("ExceptionStackTrace"), UserId = reader.GetInt32Nullable("UserId"), DateLogged = reader.GetDateTime("DateLogged") }; return(item); }
public int New(HistoryException model) { var output = this.UnitOfWork.Run(() => { var id = this.UnitOfWork.Scalar( "HistoryException_new", ParametersBuilder.With("Section", model.Section) .And("ExceptionType", model.ExceptionType) .And("ExceptionSource", model.ExceptionSource) .And("ExceptionMessage", model.ExceptionMessage) .And("ExceptionStackTrace", model.ExceptionStackTrace) .And("UserId", model.UserId) ).AsInt(); this.SetHorizontalVerifier(id); this.SetVerticalVerifierClosure(); return(id); }); return(output); }
public void Log(string section, Exception ex, int?userId = null) { var repository = new HistoryExceptionRepository(); userId = userId ?? this.SessionService.CurrentUserId; var item = new HistoryException { Section = section, ExceptionType = ex.GetType().FullName, ExceptionSource = ex.Source, ExceptionMessage = ex.Message, ExceptionStackTrace = ex.StackTrace, UserId = userId, DateLogged = DateTime.Now }; repository.New(item); if (ex.InnerException != null) { this.Log(section, ex.InnerException); } }