Esempio n. 1
0
        public string BuildUserMsg(MBF_ERROR errorCode)
        {
            string msg = "";

            switch (errorCode)
            {
            case MBF_ERROR.ERR_DB_ACCESS: msg = "DB acess error";
                break;

            case MBF_ERROR.ERR_DB_INSERT: msg = "DB insert error";
                break;

            case MBF_ERROR.ERR_DB_UPDATE: msg = "DB update error";
                break;

            case MBF_ERROR.ERR_DB_DELETE: msg = "DB delete error";
                break;

            case MBF_ERROR.ERR_DATA_EMPTY: msg = "Data cannot be empty";
                break;

            //
            default: msg = "undefine error";
                break;
            }
            return(string.Format("{0} - {1}", (int)errorCode, msg));
        }
Esempio n. 2
0
        /// <summary>
        /// Builds the exception message.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <returns></returns>
        public string BuildTraceMessage(MBF_ERROR errorCode, string functionName = "")
        {
            StringBuilder message = new StringBuilder();

            message.AppendLine();
            message.AppendLine("Error in Path : " + HttpContext.Current.Request.Path);
            // Get the QueryString along with the Virtual Path
            message.AppendLine("Raw Url : " + HttpContext.Current.Request.RawUrl);
            // function
            if (!string.IsNullOrEmpty(functionName))
            {
                message.AppendLine("Function : " + functionName);
            }
            // Get the error message
            message.AppendLine("Message : " + BuildUserMsg(errorCode));
            //
            return(message.ToString());
        }