Exemplo n.º 1
0
        void AppendMarcRecords(RecordCollection records,
                               Encoding encoding,
                               int start_index)
        {
            if (records == null)
            {
                return;
            }

            int i = start_index;

            foreach (Record record in records)
            {
                this.AppendHtml("<div class='debug green' >" + (i + 1) + ") ===</div>");

                if (string.IsNullOrEmpty(record.m_strDiagSetID) == false)
                {
                    // 这是诊断记录

                    this.AppendHtml("<div>" + HttpUtility.HtmlEncode(record.ToString()).Replace("\r\n", "<br/>") + "</div>");
                    i++;
                    continue;
                }

                // 把byte[]类型的MARC记录转换为机内格式
                // return:
                //		-2	MARC格式错
                //		-1	一般错误
                //		0	正常
                int nRet = MarcUtil.ConvertByteArrayToMarcRecord(record.m_baRecord,
                                                                 encoding == null ? Encoding.GetEncoding(936) : encoding,
                                                                 true,
                                                                 out string strMARC,
                                                                 out string strError);
                if (nRet == -1)
                {
                    this.AppendHtml("<div>" + strError + "</div>");
                    i++;
                    continue;
                }

                // 获得 MARC 记录的 HTML 格式字符串
                string strHtml = MarcUtil.GetHtmlOfMarc(strMARC,
                                                        null,
                                                        null,
                                                        false);

                this.AppendHtml(strHtml);
                i++;
            }
        }
Exemplo n.º 2
0
        void AppendMarcRecords(RecordCollection records,
                               Encoding encoding,
                               int start_index)
        {
            if (records == null)
            {
                return;
            }

            int i = start_index;

            foreach (Record record in records)
            {
                this.AppendHtml("<div class='debug green' >" + (i + 1) + ") ===</div>");

                // 把byte[]类型的MARC记录转换为机内格式
                // return:
                //		-2	MARC格式错
                //		-1	一般错误
                //		0	正常
                int nRet = MarcUtil.ConvertByteArrayToMarcRecord(record.m_baRecord,
                                                                 encoding,
                                                                 true,
                                                                 out string strMARC,
                                                                 out string strError);
                if (nRet == -1)
                {
                    this.AppendHtml("<div>" + strError + "</div>");
                    i++;
                    continue;
                }

                // 获得 MARC 记录的 HTML 格式字符串
                string strHtml = MarcUtil.GetHtmlOfMarc(strMARC,
                                                        null,
                                                        null,
                                                        false);

                this.AppendHtml(strHtml);
                i++;
            }
        }