Exemple #1
0
        public int LoadRecord(string strDirection,
                              bool bForceFull = false)
        {
            string strError = "";

            if (this.LinkedSearchForm == null)
            {
                strError = "没有关联的检索窗";
                goto ERROR1;
            }

            string strPath = this.textBox_tempRecPath.Text;

            if (String.IsNullOrEmpty(strPath) == true)
            {
                strError = "路径为空";
                goto ERROR1;
            }

            // 分离出各个部分
            string strProtocol      = "";
            string strResultsetName = "";
            string strIndex         = "";

            int nRet = MarcDetailForm.ParsePath(strPath,
                                                out strProtocol,
                                                out strResultsetName,
                                                out strIndex,
                                                out strError);

            if (nRet == -1)
            {
                strError = "解析路径 '" + strPath + "' 字符串过程中发生错误: " + strError;
                goto ERROR1;
            }


            if (strProtocol != this.LinkedSearchForm.CurrentProtocol)
            {
                strError = "检索窗的协议已经发生改变";
                goto ERROR1;
            }

            if (strResultsetName != this.LinkedSearchForm.CurrentResultsetPath)
            {
                strError = "结果集已经发生改变";
                goto ERROR1;
            }

            int index = 0;

            index = Convert.ToInt32(strIndex) - 1;


            if (strDirection == "prev")
            {
                index--;
                if (index < 0)
                {
                    strError = "到头";
                    goto ERROR1;
                }
            }
            else if (strDirection == "current")
            {
            }
            else if (strDirection == "next")
            {
                index++;
            }
            else
            {
                strError = "不能识别的strDirection参数值 '" + strDirection + "'";
                goto ERROR1;
            }

            return(LoadRecord(this.LinkedSearchForm, index, bForceFull));

ERROR1:
            MessageBox.Show(this, strError);
            return(-1);
        }
Exemple #2
0
        void LoadDetail(int index)
        {
            // 取出记录路径,析出书目库名,然后看这个书目库的syntax
            // 可能装入MARC和DC两种不同的窗口
            string strError = "";

            // 防止重入
            if (m_bInSearch == true)
            {
                strError = "当前窗口正在被一个未结束的长操作使用,无法装载记录。请稍后再试。";
                goto ERROR1;
            }

            string strSyntax = "";
            int    nRet      = GetOneRecordSyntax(index,
                                                  out strSyntax,
                                                  out strError);

            if (nRet == -1)
            {
                goto ERROR1;
            }

            if (strSyntax == "" || // default = unimarc
                strSyntax.ToLower() == "unimarc" ||
                strSyntax.ToLower() == "usmarc")
            {
                MarcDetailForm form = new MarcDetailForm();

                form.MdiParent = this.MainForm;
                form.MainForm  = this.MainForm;

                // MARC Syntax OID
                // 需要建立数据库配置参数,从中得到MARC格式
                //// form.AutoDetectedMarcSyntaxOID = "1.2.840.10003.5.1";   // UNIMARC

                form.Show();

                form.LoadRecord(this, index);
            }
            else if (strSyntax.ToLower() == "dc")
            {
                DcForm form = new DcForm();

                form.MdiParent = this.MainForm;
                form.MainForm  = this.MainForm;

                form.Show();

                form.LoadRecord(this, index);
            }
            else
            {
                strError = "未知的syntax '" + strSyntax + "'";
                goto ERROR1;
            }

            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
Exemple #3
0
        // 自动根据情况,装载到MARC或者XML记录窗
        void LoadDetail(int index,
            string strFormat)
        {
            // XML格式
            if (strFormat == "xml")
            {
                XmlDetailForm form = new XmlDetailForm();

                form.DisplayOriginPage = false;
                form.MdiParent = this.m_mainForm;
                form.MainForm = this.m_mainForm;
                form.Show();

                form.LoadRecord(this, index);
                return;
            }

            ListViewItem curItem = this.listView_browse.Items[index];
            ItemInfo info = (ItemInfo)curItem.Tag;
            if (info != null)
            {
                if (strFormat == "unimarc")
                    info.PreferSyntaxOID = "1.2.840.10003.5.1"; // UNIMARC
                else if (strFormat == "usmarc")
                    info.PreferSyntaxOID = "1.2.840.10003.5.10"; // USMARC
            }

            {
                MarcDetailForm form = new MarcDetailForm();

                form.MdiParent = this.m_mainForm;
                form.MainForm = this.m_mainForm;

#if NO
                // 继承自动识别的OID
                if (connection.TargetInfo != null
                    && connection.TargetInfo.DetectMarcSyntax == true)
                {
                    form.AutoDetectedMarcSyntaxOID = record.AutoDetectedSyntaxOID;
                }
#endif
                form.Show();

                form.LoadRecord(this, index);
            }
        }
Exemple #4
0
        // 自动根据情况,装载到MARC或者XML记录窗
        void LoadDetail(int index,
            string strFormat)
        {
            // XML格式
            if (strFormat == "xml")
            {
                XmlDetailForm form = new XmlDetailForm();

                form.DisplayOriginPage = false;
                form.MdiParent = this.m_mainForm;
                form.MainForm = this.m_mainForm;
                form.Show();

                form.LoadRecord(this, index);
                return;
            }

            ListViewItem curItem = this.listView_browse.Items[index];
            ItemInfo info = (ItemInfo)curItem.Tag;
            if (info != null)
            {
                if (strFormat == "unimarc")
                    info.PreferSyntaxOID = "1.2.840.10003.5.1"; // UNIMARC
                else if (strFormat == "usmarc")
                    info.PreferSyntaxOID = "1.2.840.10003.5.10"; // USMARC
            }

            {
                MarcDetailForm exist_fixed = this.MainForm.FixedMarcDetailForm;

                MarcDetailForm form = new MarcDetailForm();

                form.MdiParent = this.m_mainForm;
                form.MainForm = this.m_mainForm;

#if NO
                // 继承自动识别的OID
                if (connection.TargetInfo != null
                    && connection.TargetInfo.DetectMarcSyntax == true)
                {
                    form.AutoDetectedMarcSyntaxOID = record.AutoDetectedSyntaxOID;
                }
#endif
                // 在已经有左侧窗口的情况下,普通窗口需要显示在右侧
                if (exist_fixed != null)
                {
                    if (exist_fixed != null)
                        exist_fixed.Activate();

                    form.SupressSizeSetting = true;
                    this.MainForm.SetMdiToNormal();
                }
                form.Show();
                // 在已经有左侧窗口的情况下,普通窗口需要显示在右侧
                if (exist_fixed != null)
                {
                    this.MainForm.SetFixedPosition(form, "right");
                }

                form.LoadRecord(this, index);
            }
        }
Exemple #5
0
        void dtlpdupform_LoadDetail(object sender, LoadDetailEventArgs e)
        {
            string strError = "";
            DtlpSearchForm dtlp_searchform = null;

            /*
            // 要看看this合法不合法?
            if (this.IsValid() == false)
            {
                strError = "依存的MarcDetailForm已经销毁";
                MessageBox.Show(ForegroundWindow.Instance, strError);
                return;
            }*/

            if (this.LinkedSearchForm == null
                || this.LinkedSearchForm.IsValid() == false
                || !(this.LinkedSearchForm is DtlpSearchForm))
            {
                dtlp_searchform = this.GetDtlpSearchForm();

                if (dtlp_searchform == null)
                {
                    strError = "没有连接的或者打开的DTLP检索窗,无法进行LoadRecord()";
                    goto ERROR1;
                }
            }
            else
            {
                dtlp_searchform = (DtlpSearchForm)this.LinkedSearchForm;
            }

            MarcDetailForm detail = new MarcDetailForm();

            detail.MdiParent = this.MainForm;   // 这里不能用this.MdiParent。如果this已经关闭,this.MainForm还可以使用
            detail.MainForm = this.MainForm;
            detail.Show();
            int nRet = detail.LoadAmazonRecord(dtlp_searchform,
                e.RecordPath,
                "current",
                true);
            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }
Exemple #6
0
        void LoadDetail(int index)
        {
            MarcDetailForm form = new MarcDetailForm();

            form.MdiParent = this.MainForm;
            form.MainForm = this.MainForm;

            // MARC Syntax OID
            // 需要建立数据库配置参数,从中得到MARC格式
            ////form.AutoDetectedMarcSyntaxOID = "1.2.840.10003.5.1";   // UNIMARC

            form.Show();

            form.LoadRecord(this, index);
        }
Exemple #7
0
        void LoadDetail(int index)
        {
            // 取出记录路径,析出书目库名,然后看这个书目库的syntax
            // 可能装入MARC和DC两种不同的窗口
            string strError = "";

            // 防止重入
            if (m_bInSearch == true)
            {
                strError = "当前窗口正在被一个未结束的长操作使用,无法装载记录。请稍后再试。";
                goto ERROR1;
            }

            string strSyntax = "";
            int nRet = GetOneRecordSyntax(index,
                out strSyntax,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            if (strSyntax == "" // default = unimarc
                || strSyntax.ToLower() == "unimarc"
                || strSyntax.ToLower() == "usmarc")
            {

                MarcDetailForm form = new MarcDetailForm();

                form.MdiParent = this.MainForm;
                form.MainForm = this.MainForm;

                // MARC Syntax OID
                // 需要建立数据库配置参数,从中得到MARC格式
                //// form.AutoDetectedMarcSyntaxOID = "1.2.840.10003.5.1";   // UNIMARC

                form.Show();

                form.LoadRecord(this, index);
            }
            else if (strSyntax.ToLower() == "dc")
            {

                DcForm form = new DcForm();

                form.MdiParent = this.MainForm;
                form.MainForm = this.MainForm;

                form.Show();

                form.LoadRecord(this, index);
            }
            else
            {
                strError = "未知的syntax '" + strSyntax + "'";
                goto ERROR1;
            }

            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }
Exemple #8
0
        // parameters:
        //      strStyle    打开的风格 new/exist/fixed
        //      bOpendNew   是否打开新的详细窗
        void LoadDetail(int index,
            string strStyle = "new"
            // bool bOpenNew = true
                )
        {
            // 取出记录路径,析出书目库名,然后看这个书目库的syntax
            // 可能装入MARC和DC两种不同的窗口
            string strError = "";

#if NO
            // 防止重入
            if (m_bInSearching == true)
            {
                strError = "当前窗口正在被一个未结束的长操作使用,无法装载记录。请稍后再试。";
                goto ERROR1;
            }
#endif

            string strSyntax = "";
            int nRet = GetOneRecordSyntax(index,
                this.m_bInSearching,
                out strSyntax,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            if (strSyntax == "" // default = unimarc
                || strSyntax.ToLower() == "unimarc"
                || strSyntax.ToLower() == "usmarc")
            {

                MarcDetailForm form = null;
                MarcDetailForm exist_fixed = this.MainForm.FixedMarcDetailForm;

                if (strStyle == "exist")
                    form = this.MainForm.TopMarcDetailForm;
                else if (strStyle == "fixed")
                    form = exist_fixed;

                if (exist_fixed != null)
                    exist_fixed.Activate();

                if (form == null)
                {
                    form = new MarcDetailForm();

                    form.MdiParent = this.MainForm;
                    form.MainForm = this.MainForm;

                    if (strStyle == "fixed")
                    {
                        form.Fixed = true;
                        form.SupressSizeSetting = true;
                        this.MainForm.SetMdiToNormal();
                    }
                    else
                    {
                        // 在已经有左侧窗口的情况下,普通窗口需要显示在右侧
                        if (exist_fixed != null)
                        {
                            form.SupressSizeSetting = true;
                            this.MainForm.SetMdiToNormal();
                        }
                    }
                    form.Show();
                    if (strStyle == "fixed")
                        this.MainForm.SetFixedPosition(form, "left");
                    else
                    {
                        // 在已经有左侧窗口的情况下,普通窗口需要显示在右侧
                        if (exist_fixed != null)
                        {
                            this.MainForm.SetFixedPosition(form, "right");
                        }
                    }
                }
                else
                {
                    form.Activate();
                    if (strStyle == "fixed")
                    {
                        this.MainForm.SetMdiToNormal();
                    }
                    else
                    {
                        // 在已经有左侧窗口的情况下,普通窗口需要显示在右侧
                        if (exist_fixed != null)
                        {
                            this.MainForm.SetMdiToNormal();
                        }
                    }
                }

                // MARC Syntax OID
                // 需要建立数据库配置参数,从中得到MARC格式
                ////form.AutoDetectedMarcSyntaxOID = "1.2.840.10003.5.1";   // UNIMARC

                form.LoadRecord(this, index);
            }
            else if (strSyntax.ToLower() == "dc")
            {
                DcForm form = null;

                if (strStyle == "exist")
                    form = this.MainForm.TopDcForm;

                if (form == null)
                {
                    form = new DcForm();

                    form.MdiParent = this.MainForm;
                    form.MainForm = this.MainForm;

                    form.Show();
                }
                else
                    form.Activate();

                form.LoadRecord(this, index);
            }
            else
            {
                strError = "未知的syntax '" + strSyntax + "'";
                goto ERROR1;
            }

            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }
Exemple #9
0
        // 自动根据情况,装载到MARC或者XML记录窗
        void LoadDetail(int index)
        {
            if (index < 0)
                throw new ArgumentException("index 值不应该小于 0","index");

            ZConnection connection = this.GetCurrentZConnection();
            if (connection == null)
            {
                MessageBox.Show(this, "当前ZConnection为空");
                return;
            }

            DigitalPlatform.Z3950.Record record = null;
            if (index < connection.VirtualItems.Count)
            {
                record = (DigitalPlatform.Z3950.Record)
                    connection.VirtualItems[index].Tag;
            }
            else
            {
                MessageBox.Show(this, "index越界");
                return;
            }

            if (record.m_nDiagCondition != 0)
            {
                MessageBox.Show(this, "这是一条诊断记录");
                return;
            }

            // 2014/5/18
            string strSyntaxOID = record.AutoDetectedSyntaxOID;
            if (string.IsNullOrEmpty(strSyntaxOID) == true)
                strSyntaxOID = record.m_strSyntaxOID;

            // XML格式或者SUTRS格式
            if (strSyntaxOID == "1.2.840.10003.5.109.10"
                || strSyntaxOID == "1.2.840.10003.5.101")
            {
                XmlDetailForm form = new XmlDetailForm();

                form.MdiParent = this.MainForm;
                form.MainForm = this.MainForm;
                form.Show();

                form.LoadRecord(this, index);
                return;
            }

            {
                MarcDetailForm exist_fixed = this.MainForm.FixedMarcDetailForm;
                MarcDetailForm form = new MarcDetailForm();

                form.MdiParent = this.MainForm;
                form.MainForm = this.MainForm;

                // 继承自动识别的OID
                if (connection.TargetInfo != null
                    && connection.TargetInfo.DetectMarcSyntax == true)
                {
                    // form.AutoDetectedMarcSyntaxOID = record.AutoDetectedSyntaxOID;

                    form.UseAutoDetectedMarcSyntaxOID = true;
                }

                // 在已经有左侧窗口的情况下,普通窗口需要显示在右侧
                if (exist_fixed != null)
                {
                    if (exist_fixed != null)
                        exist_fixed.Activate();

                    form.SupressSizeSetting = true;
                    this.MainForm.SetMdiToNormal();
                }
                form.Show();
                // 在已经有左侧窗口的情况下,普通窗口需要显示在右侧
                if (exist_fixed != null)
                {
                    this.MainForm.SetFixedPosition(form, "right");
                }

                form.LoadRecord(this, index);
            }
        }
Exemple #10
0
        void menuItem_loadMarcDetail_Click(object sender, EventArgs e)
        {
            int index = -1;

            ZConnection connection = this.GetCurrentZConnection();
            if (connection == null)
            {
                MessageBox.Show(this, "当前ZConnection为空");
                return;
            }

            if (connection.VirtualItems.SelectedIndices.Count > 0)
                index = connection.VirtualItems.SelectedIndices[0];
            else
            {
                MessageBox.Show(this, "尚未选择要装入的记录");
                return;
            }
            

            DigitalPlatform.Z3950.Record record = null;
            if (index < connection.VirtualItems.Count)
            {
                record = (DigitalPlatform.Z3950.Record)
                    connection.VirtualItems[index].Tag;
                Debug.Assert(record != null, "");
            }
            else
            {
                MessageBox.Show(this, "index越界");
                return;
            }

            MarcDetailForm exist_fixed = this.MainForm.FixedMarcDetailForm;
            MarcDetailForm form = new MarcDetailForm();

            form.MdiParent = this.MainForm;
            form.MainForm = this.MainForm;

            // 继承自动识别的OID
            if (connection.TargetInfo != null
                && connection.TargetInfo.DetectMarcSyntax == true)
            {
                //form.AutoDetectedMarcSyntaxOID = record.AutoDetectedSyntaxOID;
                form.UseAutoDetectedMarcSyntaxOID = true;
            }

            // 在已经有左侧窗口的情况下,普通窗口需要显示在右侧
            if (exist_fixed != null)
            {
                if (exist_fixed != null)
                    exist_fixed.Activate();

                form.SupressSizeSetting = true;
                this.MainForm.SetMdiToNormal();
            }
            form.Show();
            // 在已经有左侧窗口的情况下,普通窗口需要显示在右侧
            if (exist_fixed != null)
            {
                this.MainForm.SetFixedPosition(form, "right");
            }

            form.LoadRecord(this, index);
        }
Exemple #11
0
        // 自动根据情况,装载到MARC或者XML记录窗
        void LoadDetail(int index)
        {
            ZConnection connection = this.GetCurrentZConnection();
            if (connection == null)
            {
                MessageBox.Show(this, "当前ZConnection为空");
                return;
            }

            DigitalPlatform.Z3950.Record record = null;
            if (index < connection.VirtualItems.Count)
            {
                record = (DigitalPlatform.Z3950.Record)
                    connection.VirtualItems[index].Tag;
            }
            else
            {
                MessageBox.Show(this, "index越界");
                return;
            }

            if (record.m_nDiagCondition != 0)
            {
                MessageBox.Show(this, "这是一条诊断记录");
                return;
            }

            // 2014/5/18
            string strSyntaxOID = record.AutoDetectedSyntaxOID;
            if (string.IsNullOrEmpty(strSyntaxOID) == true)
                strSyntaxOID = record.m_strSyntaxOID;

            // XML格式或者SUTRS格式
            if (strSyntaxOID == "1.2.840.10003.5.109.10"
                || strSyntaxOID == "1.2.840.10003.5.101")
            {
                XmlDetailForm form = new XmlDetailForm();

                form.MdiParent = this.m_mainForm;
                form.MainForm = this.m_mainForm;
                form.Show();

                form.LoadRecord(this, index);
                return;
            }


            {
                MarcDetailForm form = new MarcDetailForm();


                form.MdiParent = this.m_mainForm;
                form.MainForm = this.m_mainForm;

                // 继承自动识别的OID
                if (connection.TargetInfo != null
                    && connection.TargetInfo.DetectMarcSyntax == true)
                {
                    // form.AutoDetectedMarcSyntaxOID = record.AutoDetectedSyntaxOID;

                    form.UseAutoDetectedMarcSyntaxOID = true;
                }
                form.Show();

                form.LoadRecord(this, index);
            }
        }
Exemple #12
0
        void menuItem_loadMarcDetail_Click(object sender, EventArgs e)
        {
            int index = -1;

            ZConnection connection = this.GetCurrentZConnection();
            if (connection == null)
            {
                MessageBox.Show(this, "当前ZConnection为空");
                return;
            }

            if (connection.VirtualItems.SelectedIndices.Count > 0)
                index = connection.VirtualItems.SelectedIndices[0];
            else
            {
                MessageBox.Show(this, "尚未选择要装入的记录");
                return;
            }
            

            DigitalPlatform.Z3950.Record record = null;
            if (index < connection.VirtualItems.Count)
            {
                record = (DigitalPlatform.Z3950.Record)
                    connection.VirtualItems[index].Tag;
                Debug.Assert(record != null, "");
            }
            else
            {
                MessageBox.Show(this, "index越界");
                return;
            }

            MarcDetailForm form = new MarcDetailForm();

            form.MdiParent = this.m_mainForm;
            form.MainForm = this.m_mainForm;


            // 继承自动识别的OID
            if (connection.TargetInfo != null
                && connection.TargetInfo.DetectMarcSyntax == true)
            {
                //form.AutoDetectedMarcSyntaxOID = record.AutoDetectedSyntaxOID;
                form.UseAutoDetectedMarcSyntaxOID = true;
            }
            form.Show();

            form.LoadRecord(this, index);
        }