예제 #1
0
파일: Program.cs 프로젝트: zj8487/HyDM
        static void Application_ThreadException(Object seder, System.Threading.ThreadExceptionEventArgs e)
        {
            DialogResult result = DialogResult.Cancel;

            OperationalLogManager.AppendMessage(e.Exception.Message);
            OperationalLogManager.AppendMessage(e.Exception.ToString());

            string errorMsg = "程序出现错误需要关闭,请联系数慧客服,解决此问题! ";

            try
            {
                result = MessageBox.Show(errorMsg, COMMONCONST.MESSAGEBOX_ERROR, MessageBoxButtons.OK,
                                         MessageBoxIcon.Stop);
                // Exits the program when the user clicks Abort.
                if (result == DialogResult.OK)
                {
                    //关闭当前程序
                    System.Environment.Exit(System.Environment.ExitCode);
                }
                //Application.ExitThread();
                //Application.Exit();
            }
            catch
            {
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: zj8487/HyDM
        static void CurrentDomain_UnhandledException(Object seder, System.UnhandledExceptionEventArgs e)
        {
            Exception ex = e.ExceptionObject as Exception;

            OperationalLogManager.AppendMessage(ex.Message);
            OperationalLogManager.AppendMessage(ex.ToString());
        }
예제 #3
0
        /// <summary>
        /// Get_s the sysdb connection.
        /// </summary>
        /// <returns></returns>
        public static IDbConnection GetSysDbConnection()
        {
            try
            {
                if (m_syscon != null && m_syscon.State != ConnectionState.Closed)
                {
                    return(m_syscon);
                }

                string strConn;
                if (string.IsNullOrEmpty(m_SysDbPath))
                {
                    OperationalLogManager.AppendMessage("找不到系统库!请正确设置系统库路径");
                    return(null);
                }

                AccessMDBEncrypt AccessMDB = new AccessMDBEncrypt();
                AccessMDB.FileToUntie(m_SysDbPath);
                strConn = @"PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" + m_SysDbPath + ";Persist Security Info=False";

                m_syscon = m_Dbfactory.CreateConnection();
                m_syscon.ConnectionString = strConn;

                while (m_syscon.State.Equals(ConnectionState.Closed))
                {
                    try
                    {
                        m_syscon.Open();
                    }
                    catch (Exception exp)
                    {
                        OperationalLogManager.AppendMessage(exp.ToString());
                        return(null);
                    }
                }
                AccessMDB.FileToEncrypt(m_SysDbPath);
                return(m_syscon);
            }
            catch (Exception exp)
            {
                OperationalLogManager.AppendMessage(exp.ToString());
                m_syscon = null;
            }
            return(null);
        }