/// <summary>
        ///
        /// </summary>
        /// <param name="ex"></param>
        /// <param name="sourceObject"></param>
        /// <returns></returns>
        public static SecPortalException ProcessException(Exception ex, Type sourceObjectType, String message, String connectionString)
        {
            SecPortalException exception = null;

            if (typeof(SecPortalException) == ex.GetType())
            {
                return((SecPortalException)ex);
            }
            if (ex == null)
            {
                exception = new SecPortalException(message, null);
            }
            else
            {
                if (ex is System.Data.SqlClient.SqlException && exception == null)
                {
                    //if (((SqlException)ex).ErrorCode.Equals(-2146232060))
                    exception = new SecPortalException(String.Concat("SqlException : ", message, "\r\n", ex.Message), ex);

                    exception.ErrorCode = ((SqlException)ex).ErrorCode.ToString();
                }

                if (ex.GetType().Name.Contains("Pop3Exception") && exception == null)
                {
                    exception = new SecPortalException(String.Concat("Pop3Exception : ", message, "\r\n", ex.Message), ex);
                }
            }

            if (exception == null && ex != null)
            {
                exception = new SecPortalException(String.Concat(message, "\r\n", ex.Message), ex);
            }

            if (!String.IsNullOrEmpty(connectionString))
            {
                SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder(connectionString);
                exception.DatabaseServerName = sqlBuilder.DataSource;
                exception.DatabaseName       = sqlBuilder.InitialCatalog;
            }
            if (sourceObjectType != null)
            {
                exception.AssemblyLocation = sourceObjectType.Assembly.Location;
                exception.Class            = sourceObjectType.Name;
            }
            return(exception);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ex"></param>
        /// <param name="sourceObject"></param>
        /// <returns></returns>
        public static SecPortalException ProcessException(Exception ex, Type sourceObjectType, String message, String connectionString)
        {
            SecPortalException exception = null;

            if (typeof(SecPortalException) == ex.GetType())
                return (SecPortalException)ex;
            if (ex == null)
            {
                exception = new SecPortalException(message, null);
            }
            else
            {
                if (ex is System.Data.SqlClient.SqlException && exception == null)
                {
                    //if (((SqlException)ex).ErrorCode.Equals(-2146232060))
                    exception = new SecPortalException(String.Concat("SqlException : ", message, "\r\n", ex.Message), ex);

                    exception.ErrorCode = ((SqlException)ex).ErrorCode.ToString();
                }

                if (ex.GetType().Name.Contains("Pop3Exception") && exception == null)
                {

                    exception = new SecPortalException(String.Concat("Pop3Exception : ", message, "\r\n", ex.Message), ex);
                }
            }

            if (exception == null && ex != null)
            {
                exception = new SecPortalException(String.Concat(message, "\r\n", ex.Message), ex);
            }

            if (!String.IsNullOrEmpty(connectionString))
            {
                SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder(connectionString);
                exception.DatabaseServerName = sqlBuilder.DataSource;
                exception.DatabaseName = sqlBuilder.InitialCatalog;
            }
            if (sourceObjectType != null)
            {
                exception.AssemblyLocation = sourceObjectType.Assembly.Location;
                exception.Class = sourceObjectType.Name;
            }
            return exception;
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="ex"></param>
 /// <param name="sourceObject"></param>
 /// <returns></returns>
 public static SecPortalException ProcessException(Exception ex, object sourceObject)
 {
     return(SecPortalException.ProcessException(ex, sourceObject.GetType(), String.Empty, String.Empty));
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="ex"></param>
        /// <param name="sourceObject"></param>
        /// <param name="connectionString"></param>
        /// <returns></returns>
        public static SecPortalException ProcessException(Exception ex, Type sourceObjectType, string connectionString)
        {
            SecPortalException exception = SecPortalException.ProcessException(ex, sourceObjectType, String.Empty, connectionString);

            return(exception);
        }