示例#1
0
        protected override void Render(HtmlTextWriter output)
        {
            if (this.RecPath == "")
            {
                output.Write("尚未指定记录路径");
                return;
            }

            int    nRet     = 0;
            long   lRet     = 0;
            string strError = "";
            // string strOutputPath = "";

            OpacApplication app         = (OpacApplication)this.Page.Application["app"];
            SessionInfo     sessioninfo = (SessionInfo)this.Page.Session["sessioninfo"];

            string         strBiblioXml = "";
            LibraryChannel channel      = sessioninfo.GetChannel(true);

            try
            {
                lRet = // sessioninfo.Channel.
                       channel.GetBiblioInfo(
                    null,
                    this.RecPath,
                    "",
                    "xml",
                    out strBiblioXml,
                    out strError);

                /*
                 * string strMetaData = "";
                 * byte[] timestamp = null;
                 * lRet = channel.GetRes(this.RecPath,
                 *  out strBiblioXml,
                 *  out strMetaData,
                 *  out timestamp,
                 *  out strOutputPath,
                 *  out strError);
                 * */
                if (lRet == -1)
                {
                    strError = "获得书目记录 '" + this.RecPath + "' 时出错: " + strError;
                    goto ERROR1;
                }
            }
            finally
            {
                sessioninfo.ReturnChannel(channel);
            }

            string strOutMarcSyntax = "";
            string strMarc          = "";

            // 将MARCXML格式的xml记录转换为marc机内格式字符串
            // parameters:
            //		bWarning	==true, 警告后继续转换,不严格对待错误; = false, 非常严格对待错误,遇到错误后不继续转换
            //		strMarcSyntax	指示marc语法,如果=="",则自动识别
            //		strOutMarcSyntax	out参数,返回marc,如果strMarcSyntax == "",返回找到marc语法,否则返回与输入参数strMarcSyntax相同的值
            nRet = MarcUtil.Xml2Marc(strBiblioXml,
                                     true,
                                     "", // this.CurMarcSyntax,
                                     out strOutMarcSyntax,
                                     out strMarc,
                                     out strError);
            if (nRet == -1)
            {
                goto ERROR1;
            }

            // string strBiblioDbName = ResPath.GetDbName(this.RecPath);
            string strPrefix = "";

            if (this.Wrapper == true)
            {
                strPrefix = this.GetPrefixString("MARC", "content_wrapper")
                            + "<div class='biblio_wrapper'>";
            }

            string strPostfix = "";

            if (this.Wrapper == true)
            {
                strPostfix = "</div>" + this.GetPostfixString();
            }


            // output.Write(strBiblio);
            LiteralControl literal = (LiteralControl)this.FindControl("biblio");

            literal.Text = strPrefix + GetHtmlOfMarc(strMarc, this.SubfieldReturn) + strPostfix;

            base.Render(output);
            return;

ERROR1:
            output.Write(strError);
        }