Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets the application errors associated with the specified gallery, optionally including items that are not
        /// associated with any gallery (for example, errors that occur during application initialization that are not
        /// gallery-specific).
        /// </summary>
        /// <param name="galleryId">The gallery ID.</param>
        /// <param name="includeSystemErrors">If set to <c>true</c> include errors that are not associated with a
        /// particular gallery.</param>
        /// <returns>Returns an <see cref="IAppErrorCollection" /> containing errors corresponding to the specified parameters.</returns>
        public IAppErrorCollection FindAllForGallery(int galleryId, bool includeSystemErrors)
        {
            // We know galleryServerRoles is actually a List<IGalleryServerRole> because we passed it to the constructor.
            List <IAppError> appErrors = (List <IAppError>)Items;

            IAppErrorCollection appErrorCollection = new AppErrorCollection();

            if (includeSystemErrors)
            {
                appErrorCollection.AddRange(appErrors.FindAll(delegate(IAppError appError)
                {
                    return((appError.GalleryId == galleryId) || (appError.GalleryId == int.MinValue));
                }));
            }
            else
            {
                appErrorCollection.AddRange(appErrors.FindAll(delegate(IAppError appError)
                {
                    return(appError.GalleryId == galleryId);
                }));
            }

            return(appErrorCollection);
        }