Exemple #1
0
        static void CrashReport(string strText)
        {
            int    nRet     = 0;
            string strError = "";

            try
            {
                string strSender = "";
                //if (MainForm != null)
                //    strSender = MainForm.GetCurrentUserName() + "@" + MainForm.ServerUID;
                // 崩溃报告

                nRet = LibraryChannel.CrashReport(
                    strSender,
                    $"{ProgramName}",
                    strText,
                    out strError);
            }
            catch (Exception ex)
            {
                strError = "CrashReport() 过程出现异常: " + ExceptionUtil.GetDebugText(ex);
                nRet     = -1;
            }

            if (nRet == -1)
            {
                strError = "向 dp2003.com 发送异常报告时出错,未能发送成功。详细情况: " + strError;
                MessageBox.Show(strError);
                // 写入错误日志
                WriteErrorLog(strError);
            }
        }
Exemple #2
0
        protected void Application_Error(Object sender, EventArgs e)
        {
            // OpacApplication app = (OpacApplication)Application["app"];
            Exception ex = HttpContext.Current.Server.GetLastError();

            string strText = ExceptionUtil.GetDebugText(ex)
                             + "\r\n"
                             + "\r\nUserHostAddress=" + HttpContext.Current.Request.UserHostAddress
                             + "\r\nRequest.RawUrl=" + HttpContext.Current.Request.RawUrl
                             + "\r\nForm Data=" + HttpContext.Current.Request.Form.ToString()
                             + "\r\nForm Data(Decoded)=" + HttpUtility.UrlDecode(HttpContext.Current.Request.Form.ToString())
                             + "\r\n\r\n版本: " + System.Reflection.Assembly.GetAssembly(typeof(OpacApplication)).GetName().ToString();

            string strError = "";

            try
            {
                string strSender = HttpContext.Current.Server.MachineName;
                // 崩溃报告
                int nRet = LibraryChannel.CrashReport(
                    strSender,
                    "dp2OPAC",
                    strText,
                    out strError);
            }
            catch (Exception ex0)
            {
                strError = "CrashReport() 过程出现异常: " + ExceptionUtil.GetDebugText(ex0);
                // nRet = -1;
            }
        }
Exemple #3
0
        static void CrashReport(string strText)
        {
            // MainForm main_form = Form.ActiveForm as MainForm;

            MessageBar _messageBar = null;

            _messageBar         = new MessageBar();
            _messageBar.TopMost = false;
            //_messageBar.BackColor = SystemColors.Info;
            //_messageBar.ForeColor = SystemColors.InfoText;
            _messageBar.Text          = "dp2Circulation 出现异常";
            _messageBar.MessageText   = "正在向 dp2003.com 发送异常报告 ...";
            _messageBar.StartPosition = FormStartPosition.CenterScreen;
            _messageBar.Show(_mainForm);
            _messageBar.Update();

            int    nRet     = 0;
            string strError = "";

            try
            {
                string strSender = "";
                if (_mainForm != null)
                {
                    strSender = _mainForm.GetCurrentUserName() + "@" + _mainForm.ServerUID;
                }
                // 崩溃报告
                nRet = LibraryChannel.CrashReport(
                    strSender,
                    "dp2circulation",
                    strText,
                    out strError);
            }
            catch (Exception ex)
            {
                strError = "CrashReport() 过程出现异常: " + ExceptionUtil.GetDebugText(ex);
                nRet     = -1;
            }
            finally
            {
                _messageBar.Close();
                _messageBar = null;
            }

            if (nRet == -1)
            {
                strError = "向 dp2003.com 发送异常报告时出错,未能发送成功。详细情况: " + strError;
                MessageBox.Show(_mainForm, strError);
                // 写入错误日志
                if (_mainForm != null)
                {
                    _mainForm.WriteErrorLog(strError);
                }
                else
                {
                    WriteWindowsLog(strError, EventLogEntryType.Error);
                }
            }
        }
Exemple #4
0
        static void CrashReport(string strText)
        {
            MessageBar _messageBar = null;

            _messageBar = new MessageBar
            {
                TopMost       = false,
                Text          = $"{ProgramName} 出现异常",
                MessageText   = "正在向 dp2003.com 发送异常报告 ...",
                StartPosition = FormStartPosition.CenterScreen
            };
            _messageBar.Show(MainForm);
            _messageBar.Update();

            int    nRet     = 0;
            string strError = "";

            try
            {
                string strSender = "";
                if (MainForm != null)
                {
                    strSender = MainForm.GetCurrentUserName() + "@" + MainForm.ServerUID;
                }
                // 崩溃报告
                nRet = LibraryChannel.CrashReport(
                    strSender,
                    $"{ProgramName}",
                    strText,
                    out strError);
            }
            catch (Exception ex)
            {
                strError = "CrashReport() 过程出现异常: " + ExceptionUtil.GetDebugText(ex);
                nRet     = -1;
            }
            finally
            {
                _messageBar.Close();
                _messageBar = null;
            }

            if (nRet == -1)
            {
                strError = "向 dp2003.com 发送异常报告时出错,未能发送成功。详细情况: " + strError;
                MessageBox.Show(MainForm, strError);
                // 写入错误日志
                WriteErrorLog(strError);
            }
        }
Exemple #5
0
        // 2015/9/15
        public static void EnvironmentReport(MainForm mainForm)
        {
#if NO
            MessageBar _messageBar = null;

            _messageBar         = new MessageBar();
            _messageBar.TopMost = false;
            //_messageBar.BackColor = SystemColors.Info;
            //_messageBar.ForeColor = SystemColors.InfoText;
            _messageBar.Text          = "dp2Circulation 出现异常";
            _messageBar.MessageText   = "正在向 dp2003.com 发送异常报告 ...";
            _messageBar.StartPosition = FormStartPosition.CenterScreen;
            _messageBar.Show(_mainForm);
            _messageBar.Update();
#endif
            int    nRet     = 0;
            string strError = "";
            try
            {
                string strSender = "";
                if (mainForm != null)
                {
                    strSender = mainForm.GetCurrentUserName() + "@" + mainForm.ServerUID;
                }
                // 崩溃报告
                nRet = LibraryChannel.CrashReport(
                    strSender,
                    "dp2circulation 环境报告",
                    GetEnvironmentDescription().Replace("\t", "    "),
                    out strError);
            }
            catch (Exception ex)
            {
                strError = "CrashReport() 过程出现异常: " + ExceptionUtil.GetDebugText(ex);
                nRet     = -1;
            }
            finally
            {
#if NO
                _messageBar.Close();
                _messageBar = null;
#endif
            }

#if NO
            if (nRet == -1)
            {
                strError = "向 dp2003.com 发送异常报告时出错,未能发送成功。详细情况: " + strError;
                MessageBox.Show(_mainForm, strError);
                // 写入错误日志
                if (_mainForm != null)
                {
                    _mainForm.WriteErrorLog(strError);
                }
                else
                {
                    WriteWindowsLog(strError, EventLogEntryType.Error);
                }
            }
#endif
        }