Пример #1
0
        private void ShowException(Exception e)
        {
            Exception inner = e.InnerException;

            if (inner != null)
            {
                ShowException(inner);
            }

            string str = textBox3.Text;

            if (e is PosControlException)
            {
                PosControlException pe = (PosControlException)e;

                textBox3.Text =
                    "POSControlException ErrorCode(" +
                    pe.ErrorCode.ToString() +
                    ") ExtendedErrorCode(" +
                    pe.ErrorCodeExtended.ToString(System.Globalization.CultureInfo.CurrentCulture) +
                    ") occurred: " +
                    pe.Message +
                    "\r\n" +
                    str;
            }
            else
            {
                textBox3.Text = e.ToString() + "\r\n" + str;
            }
        }
Пример #2
0
        public string GetErrorCode(PosControlException ex)  //获取错误代码
        {
            string strErrorCodeEx = "";

            switch (ex.ErrorCodeExtended)
            {
            case PosPrinter.ExtendedErrorBadFormat:
            case PosPrinter.ExtendedErrorCoverOpen:
            case PosPrinter.ExtendedErrorJournalEmpty:
            case PosPrinter.ExtendedErrorReceiptEmpty:
            case PosPrinter.ExtendedErrorSlipEmpty:
                strErrorCodeEx = ex.Message;
                break;

            default:
                string strEC  = ex.ErrorCode.ToString();
                string strECE = ex.ErrorCodeExtended.ToString();
                strErrorCodeEx = "ErrorCode =" + strEC + "\nErrorCodeExtended =" + strECE + "\n"
                                 + ex.Message;
                break;
            }
            return(strErrorCodeEx);
        }