Пример #1
0
        /// <summary>
        /// 连接数据库按钮的点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnTryConnect_Click(object sender, EventArgs e)
        {
            SetDbConnectParam();

            if (CommonUtil.CheckConnectParam(this.txbBlog, this._dbConnectParam))
            {
                if (this.tabWorkFlow.SelectedTabPageIndex == (int)EnumWorkFlow.TablePartition)
                {
                    if (CommonUtil.TryConnect(this.txbBlog, ref this._dbHelper, this._dbConnectParam, EnumWorkFlow.TablePartition))
                    {
                        CommonUtil.BindcmbTablespace(this.cmbTablespace, this._dbHelper);
                    }
                }
                else
                {
                    if (CommonUtil.TryConnect(this.txbBlog, ref this._dbHelper, this._dbConnectParam, EnumWorkFlow.NotTablePartition))
                    {
                        if (this.tabWorkFlow.SelectedTabPageIndex == (int)EnumWorkFlow.DbtuneConfigure)
                        {
                            this.btnImportFeature.Enabled = true;
                            this.lciConnTips_1.Visibility = LayoutVisibility.Never;
                        }
                        else if (this.tabWorkFlow.SelectedTabPageIndex == (int)EnumWorkFlow.DbtuneManage)
                        {
                            this._dbtuneManageHelper = new DbtuneManageHelper(this._dbHelper, Environment.CurrentDirectory);

                            GwWaitForm.Start("正在收集dbtune配置关键字");
                            this.Cursor = Cursors.WaitCursor;
                            CommonUtil.BindcmbDbtuneKeyWord(this.cmbDbtuneKeyWord, dbHelper: this._dbHelper, filePath: Environment.CurrentDirectory);
                            GwWaitForm.Stop();

                            this.cmbDbtuneKeyWord.Enabled = true;
                            this.lciConnTips_2.Visibility = LayoutVisibility.Never;
                        }
                    }
                }
            }
        }
Пример #2
0
 /// <summary>
 /// 移除配置关键字按钮点击事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnRemoveKeyWord_Click(object sender, EventArgs e)
 {
     if (this._dbtuneManageHelper != null)
     {
         if (this.cmbDbtuneKeyWord.SelectedIndex != -1)
         {
             if (DevMessageUtil.ShowMsgYesNo("确定要删除关键字" + this.cmbDbtuneKeyWord.SelectedItem.ToString() + "吗?") == DialogResult.Yes)
             {
                 //如果移除成功,重新绑定配置关键字下拉列表
                 if (this._dbtuneManageHelper.DeleteConfigEX(this.cmbDbtuneKeyWord.SelectedItem.ToString()))
                 {
                     CommonUtil.BindcmbDbtuneKeyWord(this.cmbDbtuneKeyWord);
                     this.cmbDbtuneKeyWord.SelectedIndex = -1;
                     this.txbDbtuneParamValue.Text       = string.Empty;
                 }
                 else
                 {
                     CommonUtil.WriteBlog(this.txbBlog, "删除失败,请检查数据库连接参数或有无权限");
                 }
             }
         }
     }
 }