/// <summary> /// Gets the app errors from data reader. Returns an empty collection if no errors are in the data reader. /// </summary> /// <param name="dr">The data reader containing the error records.</param> /// <returns>Returns an IAppErrorCollection.</returns> private static IAppErrorCollection GetAppErrorsFromDataReader(IDataReader dr) { IAppErrorCollection appErrors = new AppErrorCollection(); //SELECT // AppErrorId, FKGalleryId, [TimeStamp], ExceptionType, Message, Source, TargetSite, StackTrace, ExceptionData, // InnerExType, InnerExMessage, InnerExSource, InnerExTargetSite, InnerExStackTrace, InnerExData, Url, // FormVariables, Cookies, SessionVariables, ServerVariables //FROM gs_AppError //WHERE FKGalleryId = @GalleryId while (dr.Read()) { appErrors.Add(new AppError(Int32.Parse(dr["AppErrorId"].ToString(), CultureInfo.InvariantCulture), Int32.Parse(dr["FKGalleryId"].ToString(), CultureInfo.InvariantCulture), ToDateTime(dr["TimeStamp"]), dr["ExceptionType"].ToString(), dr["Message"].ToString(), dr["Source"].ToString(), dr["TargetSite"].ToString(), dr["StackTrace"].ToString(), Deserialize(dr["ExceptionData"].ToString()), dr["InnerExType"].ToString(), dr["InnerExMessage"].ToString(), dr["InnerExSource"].ToString(), dr["InnerExTargetSite"].ToString(), dr["InnerExStackTrace"].ToString(), Deserialize(dr["InnerExData"].ToString()), dr["Url"].ToString(), Deserialize(dr["FormVariables"].ToString()), Deserialize(dr["Cookies"].ToString()), Deserialize(dr["SessionVariables"].ToString()), Deserialize(dr["ServerVariables"].ToString()))); } return appErrors; }
/// <summary> /// Gets the app errors from the DTO objects. Returns an empty collection if no errors. /// </summary> /// <param name="appErrorDtos">An enumerable object containing the app error data transfer objects.</param> /// <returns>Returns an IAppErrorCollection.</returns> private static IAppErrorCollection GetAppErrorsFromDataReader(IEnumerable<AppErrorDto> appErrorDtos) { IAppErrorCollection appErrors = new AppErrorCollection(); foreach (AppErrorDto aeDto in appErrorDtos) { appErrors.Add(new AppError(aeDto.AppErrorId, aeDto.FKGalleryId, ToDateTime(aeDto.TimeStamp), aeDto.ExceptionType, aeDto.Message, aeDto.Source, aeDto.TargetSite, aeDto.StackTrace, Deserialize(aeDto.ExceptionData), aeDto.InnerExType, aeDto.InnerExMessage, aeDto.InnerExSource, aeDto.InnerExTargetSite, aeDto.InnerExStackTrace, Deserialize(aeDto.InnerExData), aeDto.Url, Deserialize(aeDto.FormVariables), Deserialize(aeDto.Cookies), Deserialize(aeDto.SessionVariables), Deserialize(aeDto.ServerVariables))); } return appErrors; }