private void button_findDatabaseName_Click(object sender, EventArgs e)
        {
            GetOpacMemberDatabaseNameDialog dlg = new GetOpacMemberDatabaseNameDialog();
            MainForm.SetControlFont(dlg, this.Font, false);

            dlg.ExcludingDbNames = this.ExcludingDbNames;
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.SelectedDatabaseName = this.textBox_databaseName.Text;
            dlg.ManagerForm = this.ManagerForm;
            dlg.AllDatabaseInfoXml = this.ManagerForm.GetAllBiblioDbInfoXml();  //  this.ManagerForm.AllDatabaseInfoXml;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
                return;
            this.textBox_databaseName.Text = dlg.SelectedDatabaseName;
        }
Beispiel #2
0
        private void button_getZhongcihaoDbName_Click(object sender, EventArgs e)
        {
            GetOpacMemberDatabaseNameDialog dlg = new GetOpacMemberDatabaseNameDialog();
            MainForm.SetControlFont(dlg, this.Font, false);
            // dlg.Text = "";
            dlg.AllDatabaseInfoXml = this.AllZhongcihaoDatabaseInfoXml;    // 定义了若干种次号库的XML片段
            dlg.ExcludingDbNames = this.ExcludingDbNames;   // 要排除的、已经被使用了的种次号库名
            dlg.StartPosition = FormStartPosition.CenterScreen;

            dlg.ShowDialog(this);

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

            this.textBox_zhongcihaoDbName.Text = dlg.SelectedDatabaseName;
        }
Beispiel #3
0
        private void button_findDatabaseName_Click(object sender, EventArgs e)
        {
            GetOpacMemberDatabaseNameDialog dlg = new GetOpacMemberDatabaseNameDialog();

            MainForm.SetControlFont(dlg, this.Font, false);

            dlg.ExcludingDbNames     = this.ExcludingDbNames;
            dlg.StartPosition        = FormStartPosition.CenterScreen;
            dlg.SelectedDatabaseName = this.textBox_databaseName.Text;
            dlg.ManagerForm          = this.ManagerForm;
            dlg.AllDatabaseInfoXml   = this.ManagerForm.GetAllBiblioDbInfoXml(); //  this.ManagerForm.AllDatabaseInfoXml;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }
            this.textBox_databaseName.Text = dlg.SelectedDatabaseName;
        }
Beispiel #4
0
        private void button_getZhongcihaoDbName_Click(object sender, EventArgs e)
        {
            GetOpacMemberDatabaseNameDialog dlg = new GetOpacMemberDatabaseNameDialog();

            MainForm.SetControlFont(dlg, this.Font, false);
            // dlg.Text = "";
            dlg.AllDatabaseInfoXml = this.AllZhongcihaoDatabaseInfoXml; // 定义了若干种次号库的XML片段
            dlg.ExcludingDbNames   = this.ExcludingDbNames;             // 要排除的、已经被使用了的种次号库名
            dlg.StartPosition      = FormStartPosition.CenterScreen;

            dlg.ShowDialog(this);

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

            this.textBox_zhongcihaoDbName.Text = dlg.SelectedDatabaseName;
        }
Beispiel #5
0
        private void button_findDatabaseName_Click(object sender, EventArgs e)
        {
            /*
             * // 需要有DTLP资源对话框。需要有DtlpChannels的支持
             * if (this.DupCfgDialog == null)
             * {
             *  MessageBox.Show(this, "DupCfgDialog成员为空,无法打开选择目标数据库的对话框");
             *  return;
             * }
             *
             * GetDtlpResDialog dlg = new GetDtlpResDialog();
             *
             * dlg.Text = "请选择目标数据库";
             * dlg.Initial(this.DupCfgDialog.DtlpChannels,
             *  this.DupCfgDialog.DtlpChannel);
             * dlg.StartPosition = FormStartPosition.CenterScreen;
             * dlg.Path = this.textBox_databaseName.Text;
             * dlg.EnabledIndices = new int[] { DtlpChannel.TypeStdbase };
             * dlg.ShowDialog(this);
             *
             * this.textBox_databaseName.Text = dlg.Path;
             * */

            GetOpacMemberDatabaseNameDialog dlg = new GetOpacMemberDatabaseNameDialog();

            MainForm.SetControlFont(dlg, this.Font, false);

            dlg.Text = "请选择目标数据库";
            dlg.SelectedDatabaseName = this.textBox_databaseName.Text;
            dlg.AllDatabaseInfoXml   = AllBiblioDbInfoXml;
            dlg.ExcludingDbNames     = used_dbnames;
            dlg.StartPosition        = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

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

            this.textBox_databaseName.Text = dlg.SelectedDatabaseName;
        }
Beispiel #6
0
        // 修改一个节点的定义
        private void toolStripButton_zhongcihao_modify_Click(object sender, EventArgs e)
        {
            string strError = "";
            int nRet = 0;

            // 当前节点
            TreeNode current_treenode = this.treeView_zhongcihao.SelectedNode;

            if (current_treenode == null)
            {
                MessageBox.Show(this, "尚未选定要修改的节点");
                return;
            }

            if (current_treenode.ImageIndex == TYPE_ZHONGCIHAO_GROUP)
            {
                // 组节点


                string strXml = (string)current_treenode.Tag;
                if (String.IsNullOrEmpty(strXml) == true)
                {
                    strError = "节点 " + current_treenode.Text + " 没有Tag定义";
                    goto ERROR1;
                }

                XmlDocument dom = new XmlDocument();
                try
                {
                    dom.LoadXml(strXml);
                }
                catch (Exception ex)
                {
                    strError = "<group>节点的XML装入DOM时出错: " + ex.Message;
                    goto ERROR1;
                }

                string strGroupName = DomUtil.GetAttr(dom.DocumentElement,
                    "name");
                string strZhongcihaoDbName = DomUtil.GetAttr(dom.DocumentElement,
                    "zhongcihaodb");

                List<string> used_dbnames = GetAllUsedZhongcihaoDbName(current_treenode);

                ZhongcihaoGroupDialog dlg = new ZhongcihaoGroupDialog();
                MainForm.SetControlFont(dlg, this.Font, false);

                dlg.Text = "修改组特性";
                dlg.ZhongcihaoDbName = strZhongcihaoDbName;
                dlg.GroupName = strGroupName;
                dlg.AllZhongcihaoDatabaseInfoXml = GetAllZhongcihaoDbInfoXml();
                dlg.ExcludingDbNames = used_dbnames;
                dlg.StartPosition = FormStartPosition.CenterScreen;
                dlg.ShowDialog(this);

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

                DomUtil.SetAttr(dom.DocumentElement, "name", dlg.GroupName);
                DomUtil.SetAttr(dom.DocumentElement, "zhongcihaodb", dlg.ZhongcihaoDbName);

                current_treenode.Text = MakeZhongcihaoGroupNodeName(dlg.GroupName, dlg.ZhongcihaoDbName);
                current_treenode.Tag = dom.DocumentElement.OuterXml;    // 2009/3/3

                // 确保展开
                // current_treenode.Parent.Expand();

                this.ZhongcihaoChanged = true;

            }
            else if (current_treenode.ImageIndex == TYPE_ZHONGCIHAO_DATABASE)
            {
                // 书目库节点

                string strXml = (string)current_treenode.Tag;

                if (String.IsNullOrEmpty(strXml) == true)
                {
                    strError = "节点 " + current_treenode.Text + " 没有Tag定义";
                    goto ERROR1;
                }

                XmlDocument dom = new XmlDocument();
                try
                {
                    dom.LoadXml(strXml);
                }
                catch (Exception ex)
                {
                    strError = "<database>节点的XML装入DOM时出错: " + ex.Message;
                    goto ERROR1;
                }

                string strDatabaseName = DomUtil.GetAttr(dom.DocumentElement,
                    "name");

                List<string> used_dbnames = Zhongcihao_GetAllUsedBiblioDbName(current_treenode);
                
                // 新的书目库名
                GetOpacMemberDatabaseNameDialog dlg = new GetOpacMemberDatabaseNameDialog();
                MainForm.SetControlFont(dlg, this.Font, false);

                dlg.Text = "修改书目库名";
                dlg.SelectedDatabaseName = strDatabaseName;
                dlg.AllDatabaseInfoXml = GetAllBiblioDbInfoXml();
                dlg.ExcludingDbNames = used_dbnames;
                dlg.StartPosition = FormStartPosition.CenterScreen;
                dlg.ShowDialog(this);

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

                // 检查对话框中得到的书目库名,是不是被别处用过的书目库名?
                if (used_dbnames.IndexOf(dlg.SelectedDatabaseName) != -1)
                {
                    strError = "您所指定的书目库 '" + dlg.SelectedDatabaseName + "' 已经被其他数据库节点使用过了。放弃本次修改数据库节点操作。";
                    goto ERROR1;
                }

                // 检查指定名字的书目库是否已经创建
                // return:
                //      -2  所指定的书目库名字,实际上是一个已经存在的其他类型的库名
                //      -1  error
                //      0   还没有创建
                //      1   已经创建
                nRet = CheckBiblioDbCreated(dlg.SelectedDatabaseName,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;
                if (nRet == -2)
                    goto ERROR1;
                if (nRet == 0)
                {
                    strError = "书目库 '" + dlg.SelectedDatabaseName + "' 尚未创建。请先创建它,再来修改数据库节点。";
                    goto ERROR1;
                }

                // 获得数据库syntax
                string strSyntax = "";
                // 获得书目库的syntax
                // return:
                //      -1  error
                //      0   not found
                //      1   found
                nRet = GetBiblioSyntax(dlg.SelectedDatabaseName,
                    out strSyntax,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;
                if (nRet == 0)
                {
                    strError = "在调用GetBiblioSyntax()过程中,发现并不存在书目库 '" + dlg.SelectedDatabaseName + "' 的定义";
                    goto ERROR1;
                }

                string strPrefix = "";
                string strUri = "";
                if (strSyntax == "unimarc")
                    strUri = Ns.unimarcxml;
                else if (strSyntax == "usmarc")
                    strUri = Ns.usmarcxml;
                else
                {
                    nRet = ExistingPrefix(strSyntax, out strError);
                    if (nRet == -1)
                        goto ERROR1;
                    if (nRet == 1)
                        strPrefix = strSyntax;
                    Debug.Assert(nRet == 0, "");
                    if (nRet == 0)
                    {
                        strError = "目前名字表中尚未定义书目库格式 '" + strSyntax + "' 所对应的namespace URI,所以无法创建该格式的书目库节点";
                        goto ERROR1;
                    }
                }


                if (String.IsNullOrEmpty(strPrefix) == true)
                {
                    // 根据名字空间URI查找对应的prefix
                    // return:
                    //      -1  error
                    //      0   not found
                    //      1   found
                    nRet = FindNamespacePrefix(strUri,
                        out strPrefix,
                        out strError);
                    if (nRet == -1)
                        goto ERROR1;
                    if (nRet == 0)
                    {
                        strError = "在名字表中没有找到与namespace URI '" + strUri + "' (来源于书目库格式 '" + strSyntax + "') 对应的prefix,无法创建该格式的书目库节点";
                        goto ERROR1;
                    }
                    Debug.Assert(nRet == 1, "");
                }

                DomUtil.SetAttr(dom.DocumentElement, "name", dlg.SelectedDatabaseName);
                DomUtil.SetAttr(dom.DocumentElement, "leftfrom", "索取类号");

                if (strSyntax == "unimarc")
                {
                    DomUtil.SetAttr(dom.DocumentElement,
                                        "rightxpath",
                                        "//" + strPrefix + ":record/" + strPrefix + ":datafield[@tag='905']/" + strPrefix + ":subfield[@code='e']/text()");
                    DomUtil.SetAttr(dom.DocumentElement,
                        "titlexpath",
                        "//" + strPrefix + ":record/" + strPrefix + ":datafield[@tag='200']/" + strPrefix + ":subfield[@code='a']/text()");
                    DomUtil.SetAttr(dom.DocumentElement,
                        "authorxpath",
                        "//" + strPrefix + ":record/" + strPrefix + ":datafield[@tag='200']/" + strPrefix + ":subfield[@code='f' or @code='g']/text()");
                }
                else if (strSyntax == "usmarc")
                {
                    DomUtil.SetAttr(dom.DocumentElement,
                        "rightxpath",
                        "//" + strPrefix + ":record/" + strPrefix + ":datafield[@tag='905']/" + strPrefix + ":subfield[@code='e']/text()");
                    DomUtil.SetAttr(dom.DocumentElement,
                        "titlexpath",
                        "//" + strPrefix + ":record/" + strPrefix + ":datafield[@tag='245']/" + strPrefix + ":subfield[@code='a']/text()");
                    DomUtil.SetAttr(dom.DocumentElement,
                        "authorxpath",
                        "//" + strPrefix + ":record/" + strPrefix + ":datafield[@tag='245']/" + strPrefix + ":subfield[@code='c']/text()");
                }
                else
                {
                    strError = "目前暂时不能处理syntax为 '" + strSyntax + "' 的书目库节点修改...";
                    goto ERROR1;
                }


                string strDisplayText = MakeZhongcihaoDatabaseNodeName(dlg.SelectedDatabaseName);

                current_treenode.Text = strDisplayText;
                current_treenode.Tag = dom.DocumentElement.OuterXml;

                // 确保展开
                current_treenode.Parent.Expand();

                this.ZhongcihaoChanged = true;
            }
            else if (current_treenode.ImageIndex == TYPE_ZHONGCIHAO_NSTABLE)
            {
                // 名字表节点
                string strXml = (string)current_treenode.Tag;
                if (String.IsNullOrEmpty(strXml) == true)
                {
                    strError = "节点 " + current_treenode.Text + " 没有Tag定义";
                    goto ERROR1;
                }

                XmlDocument dom = new XmlDocument();
                try
                {
                    dom.LoadXml(strXml);
                }
                catch (Exception ex)
                {
                    strError = "<nstable>节点的XML装入DOM时出错: " + ex.Message;
                    goto ERROR1;
                }

                ZhongcihaoNstableDialog dlg = new ZhongcihaoNstableDialog();
                MainForm.SetControlFont(dlg, this.Font, false);

                dlg.XmlString = strXml;
                dlg.StartPosition = FormStartPosition.CenterScreen;
                dlg.ShowDialog(this);

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

                dom = new XmlDocument();
                try
                {
                    dom.LoadXml(dlg.XmlString);
                }
                catch (Exception ex)
                {
                    strError = "修改后的的XML装入DOM时出错: " + ex.Message;
                    goto ERROR1;
                }

                string strNstableName = DomUtil.GetAttr(dom.DocumentElement, "name");

                current_treenode.Text = MakeZhongcihaoNstableNodeName(strNstableName);
                current_treenode.Tag = dlg.XmlString;

                // 确保展开
                current_treenode.Parent.Expand();

                this.ZhongcihaoChanged = true;
            }

            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }
Beispiel #7
0
        // 插入<database>类型节点。二级节点
        private void toolStripMenuItem_zhongcihao_insert_database_Click(object sender, EventArgs e)
        {
            string strError = "";
            int nRet = 0;

            // 当前节点
            TreeNode current_treenode = this.treeView_zhongcihao.SelectedNode;

            if (current_treenode == null)
            {
                strError = "尚未选定组或数据库名节点,因此无法插入新的数据库名节点";
                goto ERROR1;
            }

            if (current_treenode.ImageIndex == TYPE_ZHONGCIHAO_NSTABLE)
            {
                strError = "选定的节点不能为名字表节点,而必须是组或数据库名节点,才能插入新的数据库名节点";
                goto ERROR1;
            }

            int index = -1;

            Debug.Assert(current_treenode != null, "");

            // 如果是第一级的节点,则理解为插入到它的儿子的尾部
            if (current_treenode.Parent == null)
            {
                Debug.Assert(current_treenode != null, "");

                index = current_treenode.Nodes.Count;
            }
            else
            {
                index = current_treenode.Parent.Nodes.IndexOf(current_treenode);

                Debug.Assert(index != -1, "");

                index++;

                current_treenode = current_treenode.Parent;
            }

            // 至此,current_treenode为<group>类型的节点了

            List<string> used_dbnames = Zhongcihao_GetAllUsedBiblioDbName(null);

            // 新的数据库名
            GetOpacMemberDatabaseNameDialog dlg = new GetOpacMemberDatabaseNameDialog();
            MainForm.SetControlFont(dlg, this.Font, false);

            dlg.Text = "请选择一个要参与组的书目库";
            dlg.AllDatabaseInfoXml = GetAllBiblioDbInfoXml();
            dlg.ExcludingDbNames = used_dbnames;
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

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

            // 检查对话框中得到的书目库名,是不是被别处用过的书目库名?
            if (used_dbnames.IndexOf(dlg.SelectedDatabaseName) != -1)
            {
                strError = "您所指定的书目库 '" + dlg.SelectedDatabaseName + "' 已经被其他数据库节点使用过了。放弃本次创建数据库节点操作。";
                goto ERROR1;
            }

            // 检查指定名字的书目库是否已经创建
            // return:
            //      -2  所指定的书目库名字,实际上是一个已经存在的其他类型的库名
            //      -1  error
            //      0   还没有创建
            //      1   已经创建
            nRet = CheckBiblioDbCreated(dlg.SelectedDatabaseName,
                out strError);
            if (nRet == -1)
                goto ERROR1;
            if (nRet == -2)
                goto ERROR1;
            if (nRet == 0)
            {
                strError = "书目库 '" + dlg.SelectedDatabaseName + "' 尚未创建。请先创建它,再来创建数据库节点。";
                goto ERROR1;
            }

            // 获得数据库syntax
            string strSyntax = "";
                    // 获得书目库的syntax
        // return:
        //      -1  error
        //      0   not found
        //      1   found
            nRet = GetBiblioSyntax(dlg.SelectedDatabaseName,
                out strSyntax,
                out strError);
            if (nRet == -1)
                goto ERROR1;
            if (nRet == 0)
            {
                strError = "在调用GetBiblioSyntax()过程中,发现并不存在书目库 '" + dlg.SelectedDatabaseName + "' 的定义";
                goto ERROR1;
            }

            string strPrefix = "";
            string strUri = "";
            if (strSyntax == "unimarc")
                strUri = Ns.unimarcxml;
            else if (strSyntax == "usmarc")
                strUri = Ns.usmarcxml;
            else
            {
                nRet = ExistingPrefix(strSyntax, out strError);
                if (nRet == -1)
                    goto ERROR1;
                if (nRet == 1)
                    strPrefix = strSyntax;
                Debug.Assert(nRet == 0, "");
                if (nRet == 0)
                {
                    strError = "目前名字表中尚未定义书目库格式 '" + strSyntax + "' 所对应的namespace URI,所以无法创建该格式的书目库节点";
                    goto ERROR1;
                }
            }


            if (String.IsNullOrEmpty(strPrefix) == true)
            {
                // 根据名字空间URI查找对应的prefix
                // return:
                //      -1  error
                //      0   not found
                //      1   found
                nRet = FindNamespacePrefix(strUri,
                    out strPrefix,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;
                if (nRet == 0)
                {
                    strError = "在名字表中没有找到与namespace URI '"+strUri+"' (来源于书目库格式 '"+strSyntax+"') 对应的prefix,无法创建该格式的书目库节点";
                    goto ERROR1;
                }
                Debug.Assert(nRet == 1, "");
            }


            XmlDocument dom = new XmlDocument();
            dom.LoadXml("<database />");

            DomUtil.SetAttr(dom.DocumentElement, "name", dlg.SelectedDatabaseName);
            DomUtil.SetAttr(dom.DocumentElement, "leftfrom", "索取类号");

            if (strSyntax == "unimarc")
            {
                DomUtil.SetAttr(dom.DocumentElement,
                                    "rightxpath",
                                    "//" + strPrefix + ":record/" + strPrefix + ":datafield[@tag='905']/" + strPrefix + ":subfield[@code='e']/text()");
                DomUtil.SetAttr(dom.DocumentElement,
                    "titlexpath",
                    "//" + strPrefix + ":record/" + strPrefix + ":datafield[@tag='200']/" + strPrefix + ":subfield[@code='a']/text()");
                DomUtil.SetAttr(dom.DocumentElement,
                    "authorxpath",
                    "//" + strPrefix + ":record/" + strPrefix + ":datafield[@tag='200']/" + strPrefix + ":subfield[@code='f' or @code='g']/text()");
            }
            else if (strSyntax == "usmarc")
            {
                DomUtil.SetAttr(dom.DocumentElement,
                    "rightxpath",
                    "//" + strPrefix + ":record/" + strPrefix + ":datafield[@tag='905']/" + strPrefix + ":subfield[@code='e']/text()");
                DomUtil.SetAttr(dom.DocumentElement,
                    "titlexpath",
                    "//" + strPrefix + ":record/" + strPrefix + ":datafield[@tag='245']/" + strPrefix + ":subfield[@code='a']/text()");
                DomUtil.SetAttr(dom.DocumentElement,
                    "authorxpath",
                    "//" + strPrefix + ":record/" + strPrefix + ":datafield[@tag='245']/" + strPrefix + ":subfield[@code='c']/text()");
            }
            else
            {
                strError = "目前暂时不能处理syntax为 '" + strSyntax + "' 的书目库节点创建...";
                goto ERROR1;
            }

            string strDatabaseCaption = MakeZhongcihaoDatabaseNodeName(dlg.SelectedDatabaseName);

            TreeNode new_treenode = new TreeNode(strDatabaseCaption, 
                TYPE_ZHONGCIHAO_DATABASE, TYPE_ZHONGCIHAO_DATABASE);
            new_treenode.Tag = dom.DocumentElement.OuterXml;

            current_treenode.Nodes.Insert(index, new_treenode);

            this.treeView_zhongcihao.SelectedNode = new_treenode;

            this.ZhongcihaoChanged = true;

            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }
Beispiel #8
0
        // 插入一个成员库名
        private void button_insertMemberDatabaseName_Click(object sender, EventArgs e)
        {
            int    nRet     = 0;
            string strError = "";

            /*
             * int x = 0;
             * int y = 0;
             * API.GetEditCurrentCaretPos(
             *  this.textBox_memberDatabases,
             *  out x,
             *  out y);
             *
             * string strLine = "";
             *
             * if (this.textBox_memberDatabases.Lines.Length > 0)
             *  strLine = this.textBox_memberDatabases.Lines[y];
             * */

            // 要排除的数据库名
            // 两类情况:一类为已经作为成员库名使用了的;一类为尚未定义为OPAC普通库的
            List <string> exclude_dbnames = new List <string>();

            for (int i = 0; i < this.textBox_memberDatabases.Lines.Length; i++)
            {
                string strLine = this.textBox_memberDatabases.Lines[i].Trim();
                if (String.IsNullOrEmpty(strLine) == true)
                {
                    continue;
                }

                exclude_dbnames.Add(strLine);
            }

            // 不在OPAC已经定义的普通库名之列,要排除
            List <string> exclude1 = null;

            nRet = GetExcludeDbNames(this.ManagerForm.AllDatabaseInfoXml,
                                     this.ExistingOpacNormalDbNames,
                                     out exclude1,
                                     out strError);
            if (nRet == -1)
            {
                goto ERROR1;
            }

            exclude_dbnames.AddRange(exclude1);

            GetOpacMemberDatabaseNameDialog dlg = new GetOpacMemberDatabaseNameDialog();

            MainForm.SetControlFont(dlg, this.Font, false);

            dlg.SelectedDatabaseName = this.textBox_memberDatabases.SelectedText;
            dlg.ManagerForm          = this.ManagerForm;
            dlg.AllDatabaseInfoXml   = this.ManagerForm.AllDatabaseInfoXml;
            dlg.ExcludingDbNames     = exclude_dbnames;
            dlg.StartPosition        = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

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

            string strNewText = dlg.SelectedDatabaseName.Replace(",", "\r\n");

            // 如果先前没有选定文字范围的话,就要在新插入的内容末尾增加回车换行符号
            if (String.IsNullOrEmpty(this.textBox_memberDatabases.SelectedText) == true)
            {
                strNewText += "\r\n";
            }

            this.textBox_memberDatabases.Paste(strNewText);
            this.textBox_memberDatabases.Focus();

            // SetLineText(this.textBox_memberDatabases, y, dlg.SelectedDatabaseName);
            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
Beispiel #9
0
        private void button_findDatabaseName_Click(object sender, EventArgs e)
        {
            /*
            // 需要有DTLP资源对话框。需要有DtlpChannels的支持
            if (this.DupCfgDialog == null)
            {
                MessageBox.Show(this, "DupCfgDialog成员为空,无法打开选择目标数据库的对话框");
                return;
            }

            GetDtlpResDialog dlg = new GetDtlpResDialog();

            dlg.Text = "请选择目标数据库";
            dlg.Initial(this.DupCfgDialog.DtlpChannels,
                this.DupCfgDialog.DtlpChannel);
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.Path = this.textBox_databaseName.Text;
            dlg.EnabledIndices = new int[] { DtlpChannel.TypeStdbase };
            dlg.ShowDialog(this);

            this.textBox_databaseName.Text = dlg.Path;
             * */

            GetOpacMemberDatabaseNameDialog dlg = new GetOpacMemberDatabaseNameDialog();
                    MainForm.SetControlFont(dlg, this.Font, false);

            dlg.Text = "请选择目标数据库";
            dlg.SelectedDatabaseName = this.textBox_databaseName.Text;
            dlg.AllDatabaseInfoXml = AllBiblioDbInfoXml;
            dlg.ExcludingDbNames = used_dbnames;
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

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

            this.textBox_databaseName.Text = dlg.SelectedDatabaseName;
        }
        // 插入一个成员库名
        private void button_insertMemberDatabaseName_Click(object sender, EventArgs e)
        {
            int nRet = 0;
            string strError = "";
            /*
            int x = 0;
            int y = 0;
            API.GetEditCurrentCaretPos(
                this.textBox_memberDatabases,
                out x,
                out y);

            string strLine = "";

            if (this.textBox_memberDatabases.Lines.Length > 0)
                strLine = this.textBox_memberDatabases.Lines[y];
             * */

            // 要排除的数据库名
            // 两类情况:一类为已经作为成员库名使用了的;一类为尚未定义为OPAC普通库的
            List<string> exclude_dbnames = new List<string>();
            for (int i = 0; i < this.textBox_memberDatabases.Lines.Length; i++)
            {
                string strLine = this.textBox_memberDatabases.Lines[i].Trim();
                if (String.IsNullOrEmpty(strLine) == true)
                    continue;

                exclude_dbnames.Add(strLine);
            }

                // 不在OPAC已经定义的普通库名之列,要排除
            List<string> exclude1 = null;
            nRet = GetExcludeDbNames(this.ManagerForm.AllDatabaseInfoXml,
                this.ExistingOpacNormalDbNames,
                out exclude1,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            exclude_dbnames.AddRange(exclude1);

            GetOpacMemberDatabaseNameDialog dlg = new GetOpacMemberDatabaseNameDialog();
            MainForm.SetControlFont(dlg, this.Font, false);

            dlg.SelectedDatabaseName = this.textBox_memberDatabases.SelectedText;
            dlg.ManagerForm = this.ManagerForm;
            dlg.AllDatabaseInfoXml = this.ManagerForm.AllDatabaseInfoXml;
            dlg.ExcludingDbNames = exclude_dbnames;
            dlg.StartPosition = FormStartPosition.CenterScreen;
            dlg.ShowDialog(this);

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

            string strNewText = dlg.SelectedDatabaseName.Replace(",", "\r\n");

            // 如果先前没有选定文字范围的话,就要在新插入的内容末尾增加回车换行符号
            if (String.IsNullOrEmpty(this.textBox_memberDatabases.SelectedText) == true)
                strNewText += "\r\n";

            this.textBox_memberDatabases.Paste(strNewText);
            this.textBox_memberDatabases.Focus();

            // SetLineText(this.textBox_memberDatabases, y, dlg.SelectedDatabaseName);
            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }