Ejemplo n.º 1
0
        public PanelDbManager(IHost host, PluginParameter data)
        {
            _host         = host;
            _shellData    = (Shell)data[0];
            _shellSqlConn = GetShellSqlConn();

            // init StrRes to translate string
            StrRes.SetHost(_host);
            Init();

            //绑定事件
            _dbManager = new DbManager(_host, _shellData, _shellSqlConn.type);
            _dbManager.ConnectDbCompletedToDo       += DbManagerConnectDbCompletedToDo;
            _dbManager.GetDbNameCompletedToDo       += DbManagerGetDbNameCompletedToDo;
            _dbManager.GetDbTableNameCompletedToDo  += DbManagerGetTableNameCompletedToDo;
            _dbManager.GetColumnTypeCompletedToDo   += DbManagerGetColumnTypeCompletedToDo;
            _dbManager.ExecuteReaderCompletedToDo   += DbManagerExecuteReaderCompletedToDo;
            _dbManager.ExecuteNonQueryCompletedToDo += DbManagerExecuteNonQueryCompletedToDo;

            RefreshServerStatus(false);


            if (string.IsNullOrEmpty(_shellSqlConn.type) || string.IsNullOrEmpty(_shellSqlConn.conn))
            {
                MessageBox.Show("shell's sqlConnection is null or space");
            }
            else
            {
                //连接数据库
                _dbManager.ConnectDb(_shellSqlConn.conn);
            }
        }
Ejemplo n.º 2
0
        public PanelDbManager(IHost host, PluginParameter data)
        {
			_host = host;
			_shellData = (Shell)data[0];
			_shellSqlConn = GetShellSqlConn();

			// init StrRes to translate string
			StrRes.SetHost(_host);
            Init();			

            //绑定事件
			_dbManager = new DbManager(_host, _shellData, _shellSqlConn.type);
			_dbManager.ConnectDbCompletedToDo += DbManagerConnectDbCompletedToDo;
			_dbManager.GetDbNameCompletedToDo += DbManagerGetDbNameCompletedToDo;
			_dbManager.GetDbTableNameCompletedToDo += DbManagerGetTableNameCompletedToDo;
			_dbManager.GetColumnTypeCompletedToDo += DbManagerGetColumnTypeCompletedToDo;
			_dbManager.ExecuteReaderCompletedToDo += DbManagerExecuteReaderCompletedToDo;
			_dbManager.ExecuteNonQueryCompletedToDo += DbManagerExecuteNonQueryCompletedToDo;

			RefreshServerStatus(false);


	        if (string.IsNullOrEmpty(_shellSqlConn.type) || string.IsNullOrEmpty(_shellSqlConn.conn))
	        {
		        MessageBox.Show("shell's sqlConnection is null or space");
	        }
	        else
	        {
				//连接数据库
				_dbManager.ConnectDb(_shellSqlConn.conn);
	        }
        }