/// <summary> /// Updates the exception handling status. /// </summary> /// <param name="exceptionId">The id of the exception record to update</param> /// <param name="handlingStatus">The new handlig status</param> public static void UpdateExceptionHandlingStatus(long exceptionId, ExceptionHandlingStatus handlingStatus) { DataAccessManager dam = new DataAccessManager(ConnectionString); dam.AddInputParameter("@ExceptionId", exceptionId); dam.AddInputParameter("@HandlingStatus", (byte)handlingStatus); dam.ExecuteNonQuery(GetFormattedStoredProcedureName(SP_EXCEPTIONS_UPDATE)); }
/// <summary> /// Logs an exception. /// </summary> /// <param name="applicationId">The application id.</param> /// <param name="appLocation">The Application location. This parameter should represent where in your application the event occurred, e.g. MyEnum.BusinessLayer or MyEnum.UserCreation</param> /// <param name="handlindStatus">The handling status of this exception.</param> /// <param name="e">The exception to log.</param> /// <param name="authenticatedUserId">The authenticated user id.</param> public static void LogException(int applicationId, int appLocation, ExceptionHandlingStatus handlindStatus, Exception e, string authenticatedUserId) { DataAccessManager dam = new DataAccessManager(ConnectionString); string hashCode = string.Empty; HttpContext context = HttpContext.Current; if (context != null) { hashCode = (appLocation.ToString() + context.Request.Url.PathAndQuery + e.ToString()); dam.AddInputParameter("@ApplicationId", applicationId); dam.AddInputParameter("@AppLocation", appLocation); dam.AddInputParameter("@Exception", e.GetType().ToString()); dam.AddInputParameter("@ExceptionMessage", ConversionHelper.GetFormattedException(string.Empty, e, TextFormat.HTML)); dam.AddInputParameter("@Method", e.TargetSite == null ? string.Empty : e.TargetSite.ToString()); dam.AddInputParameter("@IPAddress", context.Request.UserHostAddress); dam.AddInputParameter("@UserAgent", context.Request.UserAgent); dam.AddInputParameter("@HttpReferrer", context.Request.UrlReferrer == null ? null : context.Request.UrlReferrer.ToString()); dam.AddInputParameter("@HttpVerb", context.Request.HttpMethod); dam.AddInputParameter("@Url", context.Request.Url.ToString()); dam.AddInputParameter("@HashCode", hashCode.GetHashCode()); dam.AddInputParameter("@HandlingStatus", (byte)handlindStatus); dam.AddInputParameter("@AuthenticatedUserId", authenticatedUserId); dam.AddInputParameter("@MachineName", System.Environment.MachineName); } else { hashCode = (appLocation.ToString() + e.ToString()); dam.AddInputParameter("@ApplicationId", applicationId); dam.AddInputParameter("@AppLocation", appLocation); dam.AddInputParameter("@Exception", e.GetType().ToString()); dam.AddInputParameter("@ExceptionMessage", ConversionHelper.GetFormattedException(string.Empty, e, TextFormat.HTML)); dam.AddInputParameter("@Method", e.TargetSite == null ? string.Empty : e.TargetSite.ToString()); dam.AddInputParameter("@IPAddress", null); dam.AddInputParameter("@UserAgent", null); dam.AddInputParameter("@HttpReferrer", null); dam.AddInputParameter("@HttpVerb", null); dam.AddInputParameter("@Url", null); dam.AddInputParameter("@HashCode", hashCode.GetHashCode()); dam.AddInputParameter("@HandlingStatus", (byte)handlindStatus); dam.AddInputParameter("@AuthenticatedUserId", authenticatedUserId); dam.AddInputParameter("@MachineName", System.Environment.MachineName); } dam.ExecuteNonQuery(GetFormattedStoredProcedureName(SP_EXCEPTIONS_INSERT)); }
/// <summary> /// Gets the exception page. /// </summary> /// <param name="applicationId">The application id.</param> /// <param name="pageSize">The amount of record rows to retrieve.</param> /// <param name="pageIndex">The index of the page to retrieve.</param> /// <param name="rowCount">The total amount of rows of the exception table.</param> /// <param name="appLocationFilter">The ApplicationLocation to filter. Set this value to -1 if you don't want to filter by application locations.</param> /// <param name="handlingStatus">The handling status of this exception</param> /// <returns></returns> public static LogDatasets.ExceptionLogDataTable GetExceptionPage(int applicationId, int pageSize, int pageIndex, out int?rowCount, Enum appLocationFilter, ExceptionHandlingStatus handlingStatus) { return(GetExceptionPage(applicationId, pageSize, pageIndex, out rowCount, int.Parse(appLocationFilter.ToString("d")), (int)handlingStatus, ExceptionsOrderBy.DateLastOccurredDesc)); }
/// <summary> /// Logs an exception. /// </summary> /// <param name="applicationId">The application id.</param> /// <param name="appLocation">The Application location. This parameter should represent where in your application the event occurred, e.g. MyEnum.BusinessLayer or MyEnum.UserCreation</param> /// <param name="handlindStatus">The handling status of this exception.</param> /// <param name="e">The exception to log.</param> public static void LogException(int applicationId, int appLocation, ExceptionHandlingStatus handlindStatus, Exception e) { LogException(applicationId, appLocation, handlindStatus, e, null); }
/// <summary> /// Logs an exception. /// </summary> /// <param name="applicationId">The application id.</param> /// <param name="appLocation">The Application location. This parameter should represent where in your application the event occurred, e.g. MyEnum.BusinessLayer or MyEnum.UserCreation</param> /// <param name="handlindStatus">The handling status of this exception.</param> /// <param name="e">The exception to log.</param> /// <param name="authenticatedUserId">The authenticated user id.</param> public static void LogException(int applicationId, Enum appLocation, ExceptionHandlingStatus handlindStatus, Exception e, string authenticatedUserId) { LogException(applicationId, int.Parse(appLocation.ToString("d")), handlindStatus, e, authenticatedUserId); }
/// <summary> /// Logs an exception. /// </summary> /// <param name="applicationId">The application id.</param> /// <param name="appLocation">The Application location. This parameter should represent where in your application the event occurred, e.g. MyEnum.BusinessLayer or MyEnum.UserCreation</param> /// <param name="handlindStatus">The handling status of this exception.</param> /// <param name="e">The exception to log.</param> public static void LogException(int applicationId, Enum appLocation, ExceptionHandlingStatus handlindStatus, Exception e) { LogException(applicationId, int.Parse(appLocation.ToString("d")), handlindStatus, e, null); }