示例#1
0
        static string BuildHeaderHtml(bool bModified, string strField)
        {
            if (string.IsNullOrEmpty(strField) == true)
            {
                // return "\r\n<td class='content' colspan='3'></td>";
                return("<td class='fieldname'></td>"
                       + "<td class='indicator'></td>"
                       + "<td class='content'></td>");
            }

            // string strLineClass = "";
            string strFieldName  = "";
            string strIndicatior = "";
            string strContent    = "";

            // strLineClass = "header";
            strField = strField.Replace(' ', '_');

            strContent = MarcUtil.GetHtmlFieldContent(strField, false);

            string strTypeClass = "";

            if (bModified)
            {
                strTypeClass = " modified";
            }
            //
            return("\r\n<td class='fieldname" + strTypeClass + "'>" + strFieldName + "</td>"
                   + "<td class='indicator" + strTypeClass + "'>" + strIndicatior + "</td>"
                   + "<td class='content" + strTypeClass + "'>" + strContent + "</td>");
        }
示例#2
0
        // 创建一个字段的 HTML 局部 三个 <td>
        static string BuildFieldHtml(
            ChangeType type,
            string strField,
            bool bSubfieldReturn = false)
        {
            if (string.IsNullOrEmpty(strField) == true)
            {
                return("\r\n<td class='content' colspan='3'></td>");
            }

            string strLineClass  = "";
            string strFieldName  = "";
            string strIndicatior = "";
            string strContent    = "";

            // 取字段名
            if (strField.Length < 3)
            {
                strFieldName = strField;
                strField     = "";
            }
            else
            {
                strFieldName = strField.Substring(0, 3);
                strField     = strField.Substring(3);
            }

            // 取指示符
            if (MarcUtil.IsControlFieldName(strFieldName) == true)
            {
                strLineClass = "controlfield";
                strField     = strField.Replace(' ', '_');
            }
            else
            {
                if (strField.Length < 2)
                {
                    strIndicatior = strField;
                    strField      = "";
                }
                else
                {
                    strIndicatior = strField.Substring(0, 2);
                    strField      = strField.Substring(2);
                }
                strIndicatior = strIndicatior.Replace(' ', '_');

                strLineClass = "datafield";

                // 1XX字段有定长内容
                if (strFieldName.Length >= 1 && strFieldName[0] == '1')
                {
                    strField      = strField.Replace(' ', '_');
                    strLineClass += " fixedlengthsubfield";
                }
            }

            strContent = MarcUtil.GetHtmlFieldContent(strField,
                                                      bSubfieldReturn);

            string strTypeClass = "";

            if (type == ChangeType.Modified)
            {
                strTypeClass = " modified";
            }
            else if (type == ChangeType.Inserted)
            {
                strTypeClass = " inserted";
            }
            else if (type == ChangeType.Deleted)
            {
                strTypeClass = " deleted";
            }
            else if (type == ChangeType.Imaginary)
            {
                strTypeClass = " imaginary";
            }
            else if (type == ChangeType.Unchanged)
            {
                strTypeClass = " unchanged";
            }

            //
            return("\r\n<td class='fieldname" + strTypeClass + "'>" + strFieldName + "</td>"
                   + "<td class='indicator" + strTypeClass + "'>" + strIndicatior + "</td>"
                   + "<td class='content" + strTypeClass + "'>" + strContent + "</td>");
        }