Пример #1
0
        /// <summary>
        /// Given the error, this will attempt to format it and save it into the database.
        /// </summary>
        /// <param name="pvException">The actual exception that happened.</param>
        /// <param name="pvsLocation">The location of the error.</param>
        /// <param name="pvsAddInfo">Any additional information to add to the record.</param>
        /// <param name="pvsSessionID">Unique Identifier to be able to group records.</param>
        public void ProcessError(Exception pvException, string pvsLocation, string pvsAddInfo, string pvsSessionID)
        {
            // First make the error string. We will always do this.
            string lsErrorText = "";
            string lsErrorType = pvException.GetType().ToString();

            ErrorRoutines lobjRoutines = new ErrorRoutines();

            lsErrorText = lobjRoutines.FormatError(lsErrorType, pvException, pvsLocation);

            if (pvsAddInfo.Length == 0)
            {
                pvsAddInfo = pvException.StackTrace;
            }

            HandleError(lsErrorType, lsErrorText, pvsLocation, pvException.StackTrace, pvsAddInfo, pvsSessionID);
        }
Пример #2
0
        /// <summary>
        /// Given the error, this will attempt to format it and save it into the database.
        /// </summary>
        /// <param name="pvSQLException">The actual exception that happened.</param>
        /// <param name="pvsLocation">The location of the error.</param>
        /// <param name="pvsCmd">The SQL Command that was run.</param>
        /// <param name="pvsAddInfo">Any additional info you want displayed.</param>
        public void ProcessError(SqlException pvSQLException, string pvsLocation, SqlCommand pvsCmd, string pvsAddInfo, string sSessionID)
        {
            // First make the error string. We will always do this.
            string lsErrorText = "";
            string lsErrorType = pvSQLException.GetType().ToString();

            ErrorRoutines lobjRoutines = new ErrorRoutines();

            lsErrorText = lobjRoutines.FormatError(lsErrorType, pvSQLException, pvsLocation);

            string lsSQLCmd = lobjRoutines.FormatSQLCmd(pvsCmd);

            if ((!String.IsNullOrEmpty(pvsAddInfo)) &&
                (pvsAddInfo != ""))
            {
                lsSQLCmd += "<br>" + pvsAddInfo.Replace(Environment.NewLine, "<BR>");
            }
            HandleError(lsErrorType, lsErrorText, pvsLocation, pvSQLException.StackTrace, lsSQLCmd, sSessionID);
        }