Ejemplo n.º 1
0
        /// <summary>
        /// 获取服务器信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ServerClick(object sender, RoutedEventArgs e)
        {
            TreeViewExNode item = sender as TreeViewExNode;

            if (!item.IsSelected)
            {
                return;
            }

            var dataBases = new List <string>();

            string connStr = string.Empty;

            var connection = LoadingConnection.GetConnectionById(item.ConnectionId, out connStr);

            item.DataType      = connection.DataType;
            item.ConnectionStr = connStr;

            if (BaseUnity.GetConnection(connection))
            {
                if (connection.DataType == DataTypes.ORACLE)
                {
                    TreeItemClick(item, ItemTypes.DataBase);
                }
                else
                {
                    TreeItemClick(item, ItemTypes.Server);
                }
            }
            else
            {
                MessageBox.Show("无法与目标服务建立链接!");
            }
        }
Ejemplo n.º 2
0
        private void Button_Test(object sender, RoutedEventArgs e)
        {
            var errMSG = LoginCheck();

            if (!string.IsNullOrEmpty(errMSG))
            {
                ErrorMessage.Text = errMSG;
                return;
            }

            var config = new ConnectConfig();

            config.ConnectionName = ConnectionName.Text;
            config.DataBase       = DataBase.Text;
            config.DataType       = _dataType;
            config.DataSource     = DatabaseAddress.Text;
            config.UserID         = LoginName.Text;
            config.PassWord       = PassWord.Password;
            config.Port           = Port.Text;

            if (BaseUnity.GetConnection(config))
            {
                ErrorMessage.Text = "链接成功!";
            }
            else
            {
                ErrorMessage.Text = "链接失败!";
            }
        }