コード例 #1
0
ファイル: MarcRecord.cs プロジェクト: renyh/dp2mini
        /// <summary>
        /// 由工作单格式创建 MarcRecord 对象
        /// </summary>
        /// <param name="strText">工作单格式文本。注意子字段符号为 'ǂ'</param>
        /// <returns>MarcRecord 对象</returns>
        public static MarcRecord FromWorksheet(string strText)
        {
            MarcRecord record = new MarcRecord();

            if (string.IsNullOrEmpty(strText))
            {
                return(record);
            }

            string[] lines = strText.Replace("\r\n", "\r").Split(new char[] { '\r' });

            // 头标区
            string first_line = lines[0];

            if (first_line.Length < 24)
            {
                first_line = first_line.PadRight(24, ' ');
            }
            record.Header[0, Math.Min(first_line.Length, 24)] = first_line;

            int i = 0;

            foreach (string line in lines)
            {
                if (i > 0)
                {
                    //
                    // record.add(new MarcField("001A1234567"));
                    record.add(new MarcField('ǂ', line));
                }
                i++;
            }

            return(record);
        }
コード例 #2
0
        // 构造一条空白书目记录
        RegisterBiblioInfo BuildBlankBiblioInfo(
            string strRecord,
            string strFrom,
            string strValue)
        {
#if NO
            // 获得一个可以保存新书目记录的服务器地址和书目库名
            string strServerName = "";
            string strBiblioDbName = "";
            // 寻找一个可以创建新书目记录的数据库信息
            // return:
            //      false 没有找到
            //      ture 找到
            GetTargetDatabaseInfo(out strServerName,
                out strBiblioDbName);
#endif

            // 装入一条空白书目记录
            RegisterBiblioInfo info = new RegisterBiblioInfo();

#if NO
            if (string.IsNullOrEmpty(strBiblioDbName) == false)
                info.RecPath = strBiblioDbName + "/?@" + strServerName; 
#endif

            string strISBN = "";
            string strTitle = "";
            string strAuthor = "";
            string strPublisher = "";

            strFrom = strFrom.ToLower();

            if (strFrom == "isbn")
                strISBN = strValue;
            if (strFrom == "书名" || strFrom == "题名")
                strTitle = strValue;
            if (strFrom == "作者" || strFrom == "著者" || strFrom == "责任者")
                strAuthor = strValue;
            if (strFrom == "出版者" || strFrom == "出版社")
                strPublisher = strValue;

            info.MarcSyntax = "unimarc";
            MarcRecord record = new MarcRecord(strRecord);
            if (string.IsNullOrEmpty(strRecord) == true)
            {
                record.add(new MarcField('$', "010  $a" + strISBN + "$dCNY??"));
                record.add(new MarcField('$', "2001 $a"+strTitle+"$f"+strAuthor));
                record.add(new MarcField('$', "210  $a$c"+strPublisher+"$d"));
                record.add(new MarcField('$', "215  $a$d??cm"));
                record.add(new MarcField('$', "690  $a"));
                record.add(new MarcField('$', "701  $a" + strAuthor));

                // record.Header.ForceUNIMARCHeader();
                record.Header[0, 24] = "?????nam0 22?????3i 45  ";
            }
            else
            {
                record.setFirstSubfield("010", "a", strISBN);
                record.setFirstSubfield("200", "a", strTitle);
                record.setFirstSubfield("200", "f", strAuthor);
                record.setFirstSubfield("210", "c", strPublisher);
                record.setFirstSubfield("701", "a", strAuthor);
#if NO
                if (record.select("field[@name='010']").count == 0)
                    record.ChildNodes.insertSequence(new MarcField('$', "010  $a" + strISBN + "$dCNY??"));
                else if (record.select("field[@name='010']/subfield[@name='a']").count == 0)
                    (record.select("field[@name='010']")[0] as MarcField).ChildNodes.insertSequence(new MarcSubfield("a", strISBN));
                else
                    record.select("field[@name='010']/subfield[@name='a']")[0].Content = strISBN;
#endif
            }

            // info.OldXml = record.Text;

            string strError = "";
            string strXml = "";
            int nRet = MarcUtil.Marc2Xml(record.Text,
                info.MarcSyntax,
                out strXml,
                out strError);
            if (nRet == -1)
                throw new Exception(strError);

            info.OldXml = strXml;
            return info;
        }
コード例 #3
0
        // 探测当前用户对一个书目库的访问权限
        public static int DetectAccess(LibraryChannel channel,
            Stop stop,
            string strBiblioDbName,
            string strMarcSyntax,
            out string strBiblioAccess,
            out string strEntityAccess,
            out string strError)
        {
            strError = "";
            strBiblioAccess = "";
            strEntityAccess = "";

            // 样本记录
            MarcRecord record = new MarcRecord();
            record.add(new MarcField('$', "001???????"));
            record.add(new MarcField('$', "200$a书名$f作者"));
            record.add(new MarcField('$', "701$a作者"));

            string strXml = "";
            int nRet = MarcUtil.Marc2Xml(record.Text,
                strMarcSyntax,
                out strXml,
                out strError);
            if (nRet == -1)
                return -1;

            List<string> biblio_access_list = new List<string>();
            List<string> entity_access_list = new List<string>();

            // 模拟书目追加写入
            string strAction = "simulate_new";
            string strPath = strBiblioDbName + "/?";
            string strOutputPath = "";
            byte[] baNewTimestamp = null;
            long lRet = channel.SetBiblioInfo(
    stop,
    strAction,
    strPath,
    "xml",
    strXml,
    null,   // baTimestamp,
    "",
    out strOutputPath,
    out baNewTimestamp,
    out strError);
            if (lRet == -1)
            {
                // 注意检查部分允许写入的报错
                if (channel.ErrorCode != ErrorCode.AccessDenied)
                    return -1;
            }
            else
                biblio_access_list.Add("append");

            // 模拟书目覆盖写入
            strAction = "simulate_change";
            strPath = strBiblioDbName + "/0";
            lRet = channel.SetBiblioInfo(
stop,
strAction,
strPath,
"xml",
strXml,
null,   // baTimestamp,
"",
out strOutputPath,
out baNewTimestamp,
out strError);
            if (lRet == -1)
            {
                if (channel.ErrorCode != ErrorCode.AccessDenied)
                    return -1;
            }
            else
            {
                // 注意检查部分允许写入的报错
                if (channel.ErrorCode == ErrorCode.PartialDenied)
                    biblio_access_list.Add("partial_overwrite");
                else
                    biblio_access_list.Add("overwrite");
            }

            // 模拟书目删除
            strAction = "simulate_delete";
            strPath = strBiblioDbName + "/0";
            lRet = channel.SetBiblioInfo(
stop,
strAction,
strPath,
"xml",
strXml,
null,   // baTimestamp,
"",
out strOutputPath,
out baNewTimestamp,
out strError);
            if (lRet == -1)
            {
                if (channel.ErrorCode != ErrorCode.AccessDenied)
                    return -1;
            }
            else
            {
                // 注意检查部分允许写入的报错
                if (channel.ErrorCode == ErrorCode.PartialDenied)
                    biblio_access_list.Add("partial_delete");
                else
                    biblio_access_list.Add("delete");
            }

            strBiblioAccess = StringUtil.MakePathList(biblio_access_list);

            // 模拟实体追加写入
            EntityInfo info = new EntityInfo();
            {
                XmlDocument item_dom = new XmlDocument();
                item_dom.LoadXml("<root />");

                info.Style = "simulate";
                info.RefID = Guid.NewGuid().ToString();

                DomUtil.SetElementText(item_dom.DocumentElement,
                    "parent", "0");

                info.OldRecPath = "";
                info.OldRecord = "";
                info.OldTimestamp = null;

                info.Action = "new";
                info.NewRecPath = "";

                info.NewRecord = item_dom.DocumentElement.OuterXml;
                info.NewTimestamp = null;
            }

            EntityInfo[] entities = new EntityInfo[1];
            entities[0] = info;

            EntityInfo[] errorinfos = null;

            lRet = channel.SetEntities(
     stop,
     strPath,
     entities,
     out errorinfos,
     out strError);
            if (lRet == -1)
            {
                List<string> normal_errors = new List<string>();
                List<string> accessdenied_errors = new List<string>();
                GetErrorInfo(errorinfos, out normal_errors, out accessdenied_errors);
                if (normal_errors.Count > 0)
                {
                    strError = StringUtil.MakePathList(normal_errors, " ; ");
                    return -1;
                }
            }
            else
            {
                entity_access_list.Add("append");
            }

            // 模拟实体覆盖写入
            info.Action = "change";
            lRet = channel.SetEntities(
stop,
strPath,
entities,
out errorinfos,
out strError);
            if (lRet == -1)
            {
                List<string> normal_errors = new List<string>();
                List<string> accessdenied_errors = new List<string>();
                GetErrorInfo(errorinfos, out normal_errors, out accessdenied_errors);
                if (normal_errors.Count > 0)
                {
                    strError = StringUtil.MakePathList(normal_errors, " ; ");
                    return -1;
                }
            }
            else
            {
                entity_access_list.Add("overwrite");
            }

            // 模拟实体删除操作
            info.Action = "delete";

            // 是否要提供旧记录?
            info.OldRecPath = "";
            info.OldRecord = "";
            info.OldTimestamp = null;

            info.NewRecPath = "";
            info.NewRecord = "";
            info.NewTimestamp = null;

            lRet = channel.SetEntities(
stop,
strPath,
entities,
out errorinfos,
out strError);
            if (lRet == -1)
            {
                List<string> normal_errors = new List<string>();
                List<string> accessdenied_errors = new List<string>();
                GetErrorInfo(errorinfos, out normal_errors, out accessdenied_errors);
                if (normal_errors.Count > 0)
                {
                    strError = StringUtil.MakePathList(normal_errors, " ; ");
                    return -1;
                }
            }
            else
            {
                entity_access_list.Add("delete");
            }

            strEntityAccess = StringUtil.MakePathList(entity_access_list);
            return 0;
        }
コード例 #4
0
ファイル: TestMarcKernel.cs プロジェクト: renyh1013/dp2
        public void MarcDiff_MergeOldNew_5_6()
        {
            string strUserRights = "level-1";
            string strFieldNameList = "*:***-***"; // 所有字段都允许操作

            MarcRecord old_record = new MarcRecord();
            // 旧记录没有 856 字段
            old_record.add(new MarcField("001A1234567"));
            old_record.add(new MarcField('$', "2001 $atitle$fauthor"));
            old_record.add(new MarcField('$', "701  $aauthor"));

            MarcRecord new_record = new MarcRecord();
            // 新记录增加三个 856 字段
            new_record.add(new MarcField("001A1234567"));
            new_record.add(new MarcField('$', "2001 $atitle$fauthor"));
            new_record.add(new MarcField('$', "85642$3Cover image 1$uURL1$qimage/jpeg$xtype:FrontCover.SmallImage"));
            new_record.add(new MarcField('$', "85642$3Cover image 2$uURL2$qimage/jpeg$xtype:FrontCover.MediumImage"));
            new_record.add(new MarcField('$', "85642$3Cover image 3$uURL3$qimage/jpeg$xtype:FrontCover.LargeImage;rights:group"));
            new_record.add(new MarcField('$', "701  $aauthor"));

            MarcRecord target_record = new MarcRecord();
            // 结果记录有二个 856 字段。其中一个打算增加的被拒绝了
            target_record.add(new MarcField("001A1234567"));
            target_record.add(new MarcField('$', "2001 $atitle$fauthor"));
            target_record.add(new MarcField('$', "85642$3Cover image 1$uURL1$qimage/jpeg$xtype:FrontCover.SmallImage"));
            target_record.add(new MarcField('$', "85642$3Cover image 2$uURL2$qimage/jpeg$xtype:FrontCover.MediumImage"));
            target_record.add(new MarcField('$', "701  $aauthor"));

            MarcDiff_MergeOldNew(
            strUserRights,
            strFieldNameList,
            old_record,
            new_record,
            target_record,
            "856!");
        }
コード例 #5
0
        RegisterBiblioInfo BuildBlankBiblioInfo(string strISBN)
        {
            // 获得一个可以保存新书目记录的服务器地址和书目库名
            string strServerName = "";
            string strBiblioDbName = "";
            // 寻找一个可以创建新书目记录的数据库信息
            // return:
            //      false 没有找到
            //      ture 找到
            GetTargetDatabaseInfo(out strServerName,
                out strBiblioDbName);


            // 装入一条空白书目记录
            RegisterBiblioInfo info = new RegisterBiblioInfo();

#if NO
            if (string.IsNullOrEmpty(strBiblioDbName) == false)
                info.RecPath = strBiblioDbName + "/?@" + strServerName; 
#endif

            info.MarcSyntax = "unimarc";
            MarcRecord record = new MarcRecord();
            record.add(new MarcField('$', "010  $a" + strISBN + "$dCNY??"));
            record.add(new MarcField('$', "2001 $a$f"));
            record.add(new MarcField('$', "210  $a$c$d"));
            record.add(new MarcField('$', "215  $a$d??cm"));
            record.add(new MarcField('$', "690  $a"));
            record.add(new MarcField('$', "701  $a"));
            info.OldXml = record.Text;

            return info;
        }
コード例 #6
0
ファイル: TestMarcKernel.cs プロジェクト: renyh1013/dp2
        public void MarcDiff_MergeOldNew_4_1()
        {
            string strUserRights = "level-1";
            string strFieldNameList = "*:***-***"; // 所有字段都允许操作

            MarcRecord old_record = new MarcRecord();
            // 旧记录没有 856 字段
            old_record.add(new MarcField("001A1234567"));
            old_record.add(new MarcField('$', "2001 $atitle$fauthor"));
            old_record.add(new MarcField('$', "701  $aauthor"));

            MarcRecord new_record = new MarcRecord();
            // 新记录增加一个 856 字段
            new_record.add(new MarcField("001A1234567"));
            new_record.add(new MarcField('$', "2001 $atitle$fauthor"));
            new_record.add(new MarcField('$', "85642$3Cover image 1$uURL1$qimage/jpeg$xtype:FrontCover.SmallImage;rights:level-1"));
            new_record.add(new MarcField('$', "701  $aauthor"));

            MarcRecord target_record = new MarcRecord();
            // 结果记录有一个 856 字段
            target_record.add(new MarcField("001A1234567"));
            target_record.add(new MarcField('$', "2001 $atitle$fauthor"));
            target_record.add(new MarcField('$', "85642$3Cover image 1$uURL1$qimage/jpeg$xtype:FrontCover.SmallImage;rights:level-1"));
            target_record.add(new MarcField('$', "701  $aauthor"));

            MarcDiff_MergeOldNew(
            strUserRights,
            strFieldNameList,
            old_record,
            new_record,
            target_record,
            "{null}");
        }
コード例 #7
0
ファイル: TestMarcKernel.cs プロジェクト: renyh1013/dp2
        public void MarcDiff_MergeOldNew_3_3()
        {
            string strUserRights = "level-1";
            string strFieldNameList = "*:***-***"; // 所有字段都允许操作

            MarcRecord old_record = new MarcRecord();
            // 旧记录有三个 856 字段,第一个的权限允许当前用户访问
            old_record.add(new MarcField("001A1234567"));
            old_record.add(new MarcField('$', "2001 $atitle$fauthor"));
            old_record.add(new MarcField('$', "85642$3Cover image 1$uURL1$qimage/jpeg$xtype:FrontCover.SmallImage;rights:level-1"));
            old_record.add(new MarcField('$', "85642$3Cover image 2$uURL2$qimage/jpeg$xtype:FrontCover.MediumImage"));
            old_record.add(new MarcField('$', "85642$3Cover image 3$uURL3$qimage/jpeg$xtype:FrontCover.LargeImage"));
            old_record.add(new MarcField('$', "701  $aauthor"));

            MarcRecord new_record = new MarcRecord();
            // 新记录的第三个字段被删除
            new_record.add(new MarcField("001A1234567"));
            new_record.add(new MarcField('$', "2001 $atitle$fauthor"));
            new_record.add(new MarcField('$', "85642$3Cover image 1$uURL1$qimage/jpeg$xtype:FrontCover.SmallImage;rights:level-1"));
            new_record.add(new MarcField('$', "85642$3Cover image 2$uURL2$qimage/jpeg$xtype:FrontCover.MediumImage"));
            new_record.add(new MarcField('$', "701  $aauthor"));

            MarcRecord target_record = new MarcRecord();
            // 结果记录有二个 856 字段
            target_record.add(new MarcField("001A1234567"));
            target_record.add(new MarcField('$', "2001 $atitle$fauthor"));
            target_record.add(new MarcField('$', "85642$3Cover image 1$uURL1$qimage/jpeg$xtype:FrontCover.SmallImage;rights:level-1"));
            target_record.add(new MarcField('$', "85642$3Cover image 2$uURL2$qimage/jpeg$xtype:FrontCover.MediumImage"));
            target_record.add(new MarcField('$', "701  $aauthor"));

            MarcDiff_MergeOldNew(
            strUserRights,
            strFieldNameList,
            old_record,
            new_record,
            target_record,
            "{null}");
        }
コード例 #8
0
ファイル: TestMarcKernel.cs プロジェクト: renyh1013/dp2
        public void MarcDiff_MergeOldNew_1_1()
        {
            string strComment = "";
            string strError = "";
            int nRet = 0;

            string strUserRights = "level-1";
            string strFieldNameList = "*:***-***"; // 所有字段都允许操作

            MarcRecord old_record = new MarcRecord();
            // 旧记录有三个 856 字段,第一个的权限禁止当前用户访问
            old_record.add(new MarcField("001A1234567"));
            old_record.add(new MarcField('$', "2001 $atitle$fauthor"));
            old_record.add(new MarcField('$', "85642$3Cover image 1$uURL1$qimage/jpeg$xtype:FrontCover.SmallImage;rights:group"));
            old_record.add(new MarcField('$', "85642$3Cover image 2$uURL2$qimage/jpeg$xtype:FrontCover.MediumImage"));
            old_record.add(new MarcField('$', "85642$3Cover image 3$uURL3$qimage/jpeg$xtype:FrontCover.LargeImage"));
            old_record.add(new MarcField('$', "701  $aauthor"));
#if NO
            string strOldMarc = old_record.Text;

            nRet = LibraryApplication.MaskCantGet856(
    strUserRights,
    ref strOldMarc,
    out strError);
            if (nRet == -1)
                throw new Exception(strError);
            Assert.AreEqual(nRet, 1, "应当是只标记了一个 856 字段");
#endif

            MarcRecord new_record = new MarcRecord();
            // 新记录有两个 856 字段,相当于丢失了旧记录的第一个 856 字段,这模仿了权限不足的用户编辑修改保存的过程。
            // 新记录的第一个 856 字段被修改了,增加了 $zZZZ
            new_record.add(new MarcField("001A1234567"));
            new_record.add(new MarcField('$', "2001 $atitle$fauthor"));
            new_record.add(new MarcField('$', "85642$3Cover image 2$uURL2$qimage/jpeg$xtype:FrontCover.MediumImage$zZZZ"));
            new_record.add(new MarcField('$', "85642$3Cover image 3$uURL3$qimage/jpeg$xtype:FrontCover.LargeImage"));
            new_record.add(new MarcField('$', "701  $aauthor"));
#if NO
            string strNewMarc = new_record.Text;

            // 对 strNewMarc 进行过滤,将那些当前用户无法读取的 856 字段删除
            // 对 MARC 记录进行过滤,将那些当前用户无法读取的 856 字段删除
            // return:
            //      -1  出错
            //      其他  滤除的 856 字段个数
            nRet = LibraryApplication.MaskCantGet856(
                strUserRights,
                ref strNewMarc,
                out strError);
            if (nRet == -1)
                throw new Exception(strError);
            Assert.AreEqual(nRet, 0, "应当没有标记任何 856 字段");
#endif

            MarcRecord target_record = new MarcRecord();
            // 结果记录有三个 856 字段
            // 结果记录的第二个 856 字段兑现了修改,增加了 $zZZZ。旧记录的第一个 856 字段得到了保护
            target_record.add(new MarcField("001A1234567"));
            target_record.add(new MarcField('$', "2001 $atitle$fauthor"));
            target_record.add(new MarcField('$', "85642$3Cover image 1$uURL1$qimage/jpeg$xtype:FrontCover.SmallImage;rights:group"));
            target_record.add(new MarcField('$', "85642$3Cover image 2$uURL2$qimage/jpeg$xtype:FrontCover.MediumImage$zZZZ"));
            target_record.add(new MarcField('$', "85642$3Cover image 3$uURL3$qimage/jpeg$xtype:FrontCover.LargeImage"));
            target_record.add(new MarcField('$', "701  $aauthor"));

            MarcDiff_MergeOldNew(
            strUserRights,
            strFieldNameList,
            old_record,
            new_record,
            target_record,
            "{null}");

#if NO
            // 按照字段修改权限定义,合并新旧两个 MARC 记录
            // parameters:
            //      strDefaultOperation   insert/replace/delete 之一或者逗号间隔组合
            // return:
            //      -1  出错
            //      0   成功
            //      1   有部分修改要求被拒绝
            nRet = MarcDiff.MergeOldNew(
                "insert,replace,delete",
                strFieldNameList,
                strOldMarc,
                ref strNewMarc,
                out strComment,
                out strError);
            if (nRet == -1)
                throw new Exception(strError);

            // 检查 strNewMarc
            if (strNewMarc != target_record.Text)
                throw new Exception("和期望的结果不符合");

            // 检查 strComment
#endif

        }
コード例 #9
0
ファイル: TestMarcKernel.cs プロジェクト: renyh1013/dp2
        public void MarcDiff_MergeOldNew_1_3()
        {
            string strUserRights = "level-1";
            string strFieldNameList = "*:***-***"; // 所有字段都允许操作

            MarcRecord old_record = new MarcRecord();
            // 旧记录有三个 856 字段,第一个的权限禁止当前用户访问
            old_record.add(new MarcField("001A1234567"));
            old_record.add(new MarcField('$', "2001 $atitle$fauthor"));
            old_record.add(new MarcField('$', "85642$3Cover image 1$uURL1$qimage/jpeg$xtype:FrontCover.SmallImage;rights:group"));
            old_record.add(new MarcField('$', "85642$3Cover image 2$uURL2$qimage/jpeg$xtype:FrontCover.MediumImage"));
            old_record.add(new MarcField('$', "85642$3Cover image 3$uURL3$qimage/jpeg$xtype:FrontCover.LargeImage"));
            old_record.add(new MarcField('$', "701  $aauthor"));

            MarcRecord new_record = new MarcRecord();
            // 新记录有两个 856 字段,相当于丢失了旧记录的第一个 856 字段,这模仿了权限不足的用户编辑修改保存的过程。
            // 新记录的最后一个字段被修改了
            new_record.add(new MarcField("001A1234567"));
            new_record.add(new MarcField('$', "2001 $atitle$fauthor"));
            new_record.add(new MarcField('$', "85642$3Cover image 2$uURL2$qimage/jpeg$xtype:FrontCover.MediumImage"));
            new_record.add(new MarcField('$', "85642$3Cover image 3$uURL3$qimage/jpeg$xtype:FrontCover.LargeImage$zZZZ3"));
            new_record.add(new MarcField('$', "701  $aauthor"));

            MarcRecord target_record = new MarcRecord();
            // 结果记录有三个 856 字段
            target_record.add(new MarcField("001A1234567"));
            target_record.add(new MarcField('$', "2001 $atitle$fauthor"));
            target_record.add(new MarcField('$', "85642$3Cover image 1$uURL1$qimage/jpeg$xtype:FrontCover.SmallImage;rights:group"));
            target_record.add(new MarcField('$', "85642$3Cover image 2$uURL2$qimage/jpeg$xtype:FrontCover.MediumImage"));
            target_record.add(new MarcField('$', "85642$3Cover image 3$uURL3$qimage/jpeg$xtype:FrontCover.LargeImage$zZZZ3"));
            target_record.add(new MarcField('$', "701  $aauthor"));

            MarcDiff_MergeOldNew(
            strUserRights,
            strFieldNameList,
            old_record,
            new_record,
            target_record,
            "{null}");
        }
コード例 #10
0
        // 从列表中选择一条书目记录装入编辑模板
        public int SelectBiblio(int index, 
            out string strError)
        {
            strError = "";

            if (this.InvokeRequired)
            {
                Delegate_SelectBiblio d = new Delegate_SelectBiblio(SelectBiblio);
                object[] args = new object[2];
                args[0] = index;
                args[1] = strError;
                int result = (int)this.Invoke(d, args);

                // 取出out参数值
                strError = (string)args[1];
                return result;
            }

            if (index >= this.dpTable_browseLines.Rows.Count)
            {
                strError = "index 超过范围";
                goto ERROR1;
            }

            if (this.BiblioChanged == true)
            {
                DialogResult result = MessageBox.Show(this,
"当前书目记录修改后尚未保存。如果此时装入新记录内容,先前的修改将会丢失。\r\n\r\n是否装入新记录?",
"BiblioRegisterControl",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2);
                if (result == DialogResult.No)
                    return 0;
            }

            // 警告那些从原书目记录下属装入的册记录修改。但新增的册不会被清除
            if (HasEntitiesChanged("normal") == true)
            {
                DialogResult result = MessageBox.Show(this,
"当前有册记录修改后尚未保存。如果此时装入新记录内容,先前的修改将会丢失。\r\n\r\n是否装入新记录?",
"BiblioRegisterControl",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2);
                if (result == DialogResult.No)
                    return 0;
            }

            // this.ClearEntityEditControls("normal");

            DpRow row = this.dpTable_browseLines.Rows[index];
            RegisterBiblioInfo info = row.Tag as RegisterBiblioInfo;

            if (info == null)
            {
                strError = "这是提示信息行";
                return -1;
#if NO
                if (row[0].ImageIndex == TYPE_ERROR)
                {
                    strError = "这是提示信息行";
                    return -1;
                }
                // 装入一条空白书目记录
                info = new RegisterBiblioInfo();
                info.MarcSyntax = "unimarc";
                MarcRecord record = new MarcRecord();
                record.add(new MarcField('$', "010  $a" + this.BiblioBarcode));
                record.add(new MarcField('$', "2001 $a$f"));
                record.add(new MarcField('$', "210  $a$c$d"));
                record.add(new MarcField('$', "215  $a$d"));
                record.add(new MarcField('$', "690  $a"));
                record.add(new MarcField('$', "701  $a"));
                info.OldXml = record.Text;
#endif
            }

            this.OldMARC = info.OldXml;
            this.Timestamp = info.Timestamp;

            string strPath = "";
            string strServerName = "";
            StringUtil.ParseTwoPart(info.RecPath, "@", out strPath, out strServerName);
            this.ServerName = strServerName;
            this.BiblioRecPath = strPath;

            this.MarcSyntax = info.MarcSyntax;

            this.easyMarcControl1.SetMarc(info.OldXml);
            Debug.Assert(this.BiblioChanged == false, "");

            // 设置封面图像
            // SetCoverImage(row);
            string strMARC = info.OldXml;
            if (string.IsNullOrEmpty(strMARC) == false)
            {
                this.ImageUrl = ScriptUtil.GetCoverImageUrl(strMARC);
                this.CoverImageRequested = false;
            }

            this.SetDisplayMode("detail");

            if (this.LoadEntities != null)
                this.LoadEntities(this, new EventArgs());

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