Beispiel #1
0
        // 创建书目库
        private void ToolStripMenuItem_createBiblioDatabase_Click(object sender, EventArgs e)
        {
            BiblioDatabaseDialog dlg = new BiblioDatabaseDialog();
            MainForm.SetControlFont(dlg, this.Font, false);

            dlg.Text = "创建新书目库";
            dlg.ManagerForm = this;
            dlg.CreateMode = true;
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);


            if (dlg.DialogResult != DialogResult.OK)
                return;

            // 刷新库名列表
            string strError = "";
            int nRet = ListAllDatabases(out strError);
            if (nRet == -1)
            {
                MessageBox.Show(this, strError);
            }

            // 选定刚创建的数据库
            SelectDatabaseLine(dlg.BiblioDatabaseName);

            // 重新获得各种库名、列表
            this.MainForm.StartPrepareNames(false, false);
        }
Beispiel #2
0
        // 修改数据库特性
        private void toolStripButton_modifyDatabase_Click(object sender, EventArgs e)
        {
            string strError = "";
            int nRet = 0;

            if (this.listView_databases.SelectedItems.Count == 0)
            {
                strError = "尚未选定要修改的数据库";
                goto ERROR1;
            }
            ListViewItem item = this.listView_databases.SelectedItems[0];
            string strTypeName = ListViewUtil.GetItemText(item, 1);
            string strName = item.Text;

            string strType = GetTypeString(strTypeName);
            if (strType == null)
                strType = strTypeName;

            if (strType == "biblio")
            {
                BiblioDatabaseDialog dlg = new BiblioDatabaseDialog();
                MainForm.SetControlFont(dlg, this.Font, false);

                dlg.Text = "修改书目库特性";
                dlg.ManagerForm = this;
                dlg.CreateMode = false;
                dlg.StartPosition = FormStartPosition.CenterScreen;

                nRet = dlg.Initial((string)item.Tag,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;

                dlg.ShowDialog(this);

                if (dlg.DialogResult != DialogResult.OK)
                    return;

                // 刷新库名列表
                nRet = ListAllDatabases(out strError);
                if (nRet == -1)
                {
                    MessageBox.Show(this, strError);
                }

                // 选定刚修改的数据库
                SelectDatabaseLine(dlg.BiblioDatabaseName);

                RefreshOpacDatabaseList();
                RefreshOpacBrowseFormatTree();

                // 重新获得各种库名、列表
                this.MainForm.StartPrepareNames(false, false);
            }
            else if (strType == "reader")
            {
                ReaderDatabaseDialog dlg = new ReaderDatabaseDialog();
                MainForm.SetControlFont(dlg, this.Font, false);

                dlg.Text = "修改读者库特性";
                dlg.ManagerForm = this;
                dlg.LibraryCodeList = this.GetLibraryCodeList();
                dlg.CreateMode = false;
                dlg.StartPosition = FormStartPosition.CenterScreen;

                nRet = dlg.Initial((string)item.Tag,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;

                dlg.ShowDialog(this);

                if (dlg.DialogResult != DialogResult.OK)
                    return;

                // 刷新库名列表
                nRet = ListAllDatabases(out strError);
                if (nRet == -1)
                {
                    MessageBox.Show(this, strError);
                }

                // 选定刚修改的数据库
                SelectDatabaseLine(dlg.ReaderDatabaseName);

                // 重新获得各种库名、列表
                this.MainForm.StartPrepareNames(false, false);

                RefreshOpacDatabaseList();
                RefreshOpacBrowseFormatTree();
            }
            else if (strType == "message"
                || strType == "amerce"
                || strType == "invoice"
                || strType == "arrived"
                || strType == "zhongcihao"
                || strType == "publisher"
                || strType == "dictionary"
                || strType == "inventory")
            {
                SimpleDatabaseDialog dlg = new SimpleDatabaseDialog();
                MainForm.SetControlFont(dlg, this.Font, false);

                /*
                string strTypeName = GetTypeName(strType);
                if (strTypeName == null)
                    strTypeName = strType;
                 * */

                dlg.Text = "修改" + strTypeName + "库特性";
                dlg.ManagerForm = this;
                dlg.CreateMode = false;
                dlg.StartPosition = FormStartPosition.CenterScreen;

                nRet = dlg.Initial(
                    strType,
                    (string)item.Tag,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;

                dlg.ShowDialog(this);

                if (dlg.DialogResult != DialogResult.OK)
                    return;

                // 刷新库名列表
                nRet = ListAllDatabases(out strError);
                if (nRet == -1)
                {
                    MessageBox.Show(this, strError);
                }

                // 选定刚修改的数据库
                SelectDatabaseLine(dlg.DatabaseName);

                RefreshOpacDatabaseList();
                RefreshOpacBrowseFormatTree();

                // 重新获得各种库名、列表
                this.MainForm.StartPrepareNames(false, false);
            }

            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }