Ejemplo n.º 1
0
        private void button_create_Click(object sender, EventArgs e)
        {
            EnableControls(false);

            for (int i = 0; i < this.listView_objects.Items.Count; i++)
            {
                ListViewItem item = this.listView_objects.Items[i];

                if (item.Checked == false)
                {
                    continue;
                }

                string strUrl = item.SubItems[1].Text;

                Template t = (Template)item.Tag;

                if (t.Object.Type == ResTree.RESTYPE_DB)
                {
                    // 创建数据库
                    DatabaseDlg dlg = new DatabaseDlg();
                    dlg.Text      = "根据模板创建新数据库";
                    dlg.IsCreate  = true;
                    dlg.BatchMode = true;
                    // dlg.RefDbName = strRefDbName;
                    dlg.MainForm  = this.MainForm;
                    dlg.RefObject = t.Object;
                    dlg.Initial(strUrl,
                                "");

                    dlg.DatabaseType = t.Type;
                    dlg.SqlDbName    = t.SqlDbName;
                    dlg.KeysDef      = t.KeysDef;
                    dlg.BrowseDef    = t.BrowseDef;
                    dlg.LogicNames   = t.LogicNames;

                    this.MainForm.AppInfo.LinkFormState(dlg, "databasedlg_state");
                    DialogResult result = dlg.ShowDialog(this);
                    this.MainForm.AppInfo.UnlinkFormState(dlg);

                    if (result == DialogResult.Cancel && i < this.listView_objects.Items.Count - 1)
                    {
                        DialogResult resultTemp = MessageBox.Show(this,
                                                                  "是否要中断批处理?",
                                                                  "dp2Manager",
                                                                  MessageBoxButtons.YesNo,
                                                                  MessageBoxIcon.Question,
                                                                  MessageBoxDefaultButton.Button2);
                        if (resultTemp == DialogResult.Yes)
                        {
                            break;
                        }
                    }
                }
            }

            EnableControls(true);
        }
Ejemplo n.º 2
0
        // 创建新数据库
        private void menuItem_newDatabase_Click(object sender, System.EventArgs e)
        {
            if (treeView_res.SelectedNode == null)
            {
                MessageBox.Show("请选择一个服务器或数据库节点");
                return;
            }

            ResPath respath = new ResPath(treeView_res.SelectedNode);

            string strRefDbName = "";

            if (treeView_res.SelectedNode != null &&
                treeView_res.SelectedNode.ImageIndex == ResTree.RESTYPE_DB)
            {
                if (respath.Path != "")
                {
                    string strPath = respath.Path;
                    strRefDbName = StringUtil.GetFirstPartPath(ref strPath);
                }
            }


            DatabaseDlg dlg = new DatabaseDlg();

            MainForm.SetControlFont(dlg, this.DefaultFont);
            dlg.Text          = "创建新数据库";
            dlg.IsCreate      = true;
            dlg.RefDbName     = strRefDbName;
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.MainForm      = this;
            dlg.Initial(respath.Url,
                        "");

            this.AppInfo.LinkFormState(dlg, "databasedlg_state");
            dlg.ShowDialog(this);
            this.AppInfo.UnlinkFormState(dlg);
        }
Ejemplo n.º 3
0
        private void menuItem_databaseManagement_Click(object sender, System.EventArgs e)
        {
            if (treeView_res.SelectedNode == null)
            {
                MessageBox.Show("请选择一个数据库节点");
                return;
            }

            ResPath respath = new ResPath(treeView_res.SelectedNode);

            if (respath.Path == "")
            {
                MessageBox.Show("请选择一个数据库类型的节点");
                return;
            }
            string strPath   = respath.Path;
            string strDbName = StringUtil.GetFirstPartPath(ref strPath);

            if (strDbName == "")
            {
                MessageBox.Show("错误: 数据库名为空");
                return;
            }

            DatabaseDlg dlg = new DatabaseDlg();

            MainForm.SetControlFont(dlg, this.DefaultFont);
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.MainForm      = this;
            dlg.Initial(respath.Url,
                        strDbName);

            this.AppInfo.LinkFormState(dlg, "databasedlg_state");
            dlg.ShowDialog(this);
            this.AppInfo.UnlinkFormState(dlg);
        }