public override string Convert(string strXml) { string strError = ""; int nRet = 0; XmlDocument dom = new XmlDocument(); try { dom.LoadXml(strXml); } catch (Exception ex) { return(ex.Message); } string strStyle = ""; // 页面风格名称 例如"_dark" List <string> formats = StringUtil.FindPrefixInList(StringUtil.SplitList(this.Formats, ','), "style_"); if (formats.Count > 0) { strStyle = formats[0].Substring("style".Length); } string strLink = "<link href='%mappeddir%\\styles\\readerhtml" + strStyle + ".css' type='text/css' rel='stylesheet' />" + "<link href=\"%mappeddir%/jquery-ui-1.8.7/css/jquery-ui-1.8.7.css\" rel=\"stylesheet\" type=\"text/css\" />" + "<script type=\"text/javascript\" src=\"%mappeddir%/jquery-ui-1.8.7/js/jquery-1.4.4.min.js\"></script>" + "<script type=\"text/javascript\" src=\"%mappeddir%/jquery-ui-1.8.7/js/jquery-ui-1.8.7.min.js\"></script>" + "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=9\"></meta>" + "<meta http-equiv='Content-type' content='text/html; charset=utf-8' ></meta>" + "<script type='text/javascript' charset='UTF-8' src='%mappeddir%\\scripts\\readerxml2html.js" + "'></script>" + "<script type='text/javascript' charset='UTF-8' src='%mappeddir%\\scripts\\getsummary.js" + "'></script>"; // 证状态 string strReaderState = DomUtil.GetElementText(dom.DocumentElement, "state"); string strExpireDate = DomUtil.GetElementText(dom.DocumentElement, "expireDate"); string strBodyClass = ""; // return: // -1 检测过程发生了错误。应当作不能借阅来处理 // 0 可以借阅 // 1 证已经过了失效期,不能借阅 // 2 证有不让借阅的状态 nRet = this.App.CheckReaderExpireAndState(dom, out strError); if (nRet != 0) { strBodyClass = "warning"; } bool bExpired = false; if (nRet == 1) { bExpired = true; } StringBuilder strResult = new StringBuilder(4096); strResult.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); strResult.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n\t<head>" + strLink + "</head>\r\n\t<body" + (string.IsNullOrEmpty(strBodyClass) == false ? " class='" + strBodyClass + "'" : "") + ">"); // 左右分布的大表格 strResult.Append("\r\n\t\t<table class='layout'>"); strResult.Append("\r\n\t\t\t<tr class='content'>"); string strReaderBarcode = DomUtil.GetElementText(dom.DocumentElement, "barcode"); string strPersonName = DomUtil.GetElementText(dom.DocumentElement, "name"); string strFingerprint = DomUtil.GetElementText(dom.DocumentElement, "fingerprint"); string strWeixinBinding = StringUtil.GetParameterByPrefix(DomUtil.GetElementText(dom.DocumentElement, "email"), "weixinid", ":"); string strPhotoPath = ""; if (this.RecPath != "?") { strPhotoPath = GetPhotoPath(dom, this.RecPath); } strResult.Append("<td class='photo'>"); strResult.Append("<img id='cardphoto' class='pending' name='" + (this.RecPath == "?" ? "?" : "object-path:" + strPhotoPath) // 这里直接用读者证条码号也可以,只不过前端处理速度稍慢 + "' src='%mappeddir%\\images\\ajax-loader.gif' alt='" + HttpUtility.HtmlEncode(strPersonName) + " 的照片'></img>"); string strIcons = ""; if (string.IsNullOrEmpty(strFingerprint) == false) { strIcons += "<img src='%mappeddir%\\images\\fingerprint.png' style='background-color:#ffffff;' alt='有指纹信息'>"; } if (string.IsNullOrEmpty(strWeixinBinding) == false) { strIcons += "<img src='%mappeddir%\\images\\wechat_16.png' alt='有微信绑定信息'>"; } if (string.IsNullOrEmpty(strIcons) == false) { strResult.Append("<br/>" + strIcons); } strResult.Append("</td>"); strResult.Append("<td class='warning' id='insertpoint'></td>"); // 识别信息表格 strResult.Append("\r\n\t\t\t\t<td class='left'><table class='readerinfo'>"); // 证条码号 string strReaderBarcodeLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ReaderInfoForm', this.innerText, true);\">" + strReaderBarcode + "</a>"; strResult.Append("<tr class='content barcode'><td class='name'>读者证条码号</td><td class='value'>" + strReaderBarcodeLink + "</td></tr>"); // 读者类别 string strReaderType = DomUtil.GetElementText(dom.DocumentElement, "readerType"); strResult.Append("<tr class='content readertype'><td class='name'>读者类别</td><td class='value'>" + strReaderType + "</td></tr>"); // 姓名 strResult.Append("<tr class='content name'><td class='name'>姓名</td><td class='value' >" + strPersonName + "</td></tr>"); // 补齐高度 strResult.Append("<tr class='content blank'><td class='name'></td><td class='value' ></td></tr>"); strResult.Append("</table></td>"); strResult.Append("<td class='middle'> </td>"); strResult.Append("<td class='right'>"); strResult.Append("<table class='readerinfo'>"); // 证状态 strResult.Append("<tr class='content state'><td class='name'>证状态</td><td class='value'>" + strReaderState + "</td></tr>"); /* * // 发证日期 * strResult.Append( "<tr class='content createdate'><td class='name'>发证日期</td><td class='value'>" + LocalDate(DomUtil.GetElementText(dom.DocumentElement, "createDate")) + "</td></tr>"); */ // 失效日期 string strExpireDateValueClass = "expiredate"; if (bExpired == true) { strExpireDateValueClass = "expireddate"; } strResult.Append("<tr class='content " + strExpireDateValueClass + "'><td class='name'>失效日期</td><td class='value'>" + LocalDate(strExpireDate) + "</td></tr>"); strResult.Append("<tr class='content department'><td class='name'>单位</td><td class='value'>" + DomUtil.GetElementText(dom.DocumentElement, "department") + "</td></tr>"); strResult.Append("<tr class='content comment'><td class='name'>注释</td><td class='value'><div class='wide'><div>" + DomUtil.GetElementText(dom.DocumentElement, "comment") + "</td></tr>"); // 补齐高度 strResult.Append("<tr class='content blank'><td class='name'></td><td class='value' ></td></tr>"); strResult.Append("</table>"); strResult.Append("</td></tr>"); // 大表格收尾 strResult.Append("</table>"); // 获得日历 Calendar calendar = null; // return: // -1 出错 // 0 没有找到日历 // 1 找到日历 nRet = this.App.GetReaderCalendar(strReaderType, this.LibraryCode, out calendar, out strError); if (nRet == -1 || nRet == 0) { strResult.Append(strError); calendar = null; } string strWarningText = ""; // *** // 违约/交费信息 XmlNodeList nodes = dom.DocumentElement.SelectNodes("overdues/overdue"); if (nodes.Count > 0) { strResult.Append("<div class='tabletitle'>违约/交费信息</div>"); strResult.Append("<table class='overdue'>"); strResult.Append("<tr class='columntitle'><td>册条码号</td><td>说明</td><td>金额</td><td nowrap>以停代金情况</td><td>起点日期</td><td>期限</td><td>终点日期</td><td>ID</td><td>注释</td></tr>"); for (int i = 0; i < nodes.Count; i++) { XmlNode node = nodes[i]; string strBarcode = DomUtil.GetAttr(node, "barcode"); string strOver = DomUtil.GetAttr(node, "reason"); string strBorrowPeriod = DomUtil.GetAttr(node, "borrowPeriod"); string strBorrowDate = LocalDateOrTime(DomUtil.GetAttr(node, "borrowDate"), strBorrowPeriod); string strReturnDate = LocalDateOrTime(DomUtil.GetAttr(node, "returnDate"), strBorrowPeriod); string strID = DomUtil.GetAttr(node, "id"); string strPrice = DomUtil.GetAttr(node, "price"); string strOverduePeriod = DomUtil.GetAttr(node, "overduePeriod"); // 把一行文字变为两行显示 strBorrowDate = strBorrowDate.Replace(" ", "<br/>"); strReturnDate = strReturnDate.Replace(" ", "<br/>"); strID = SplitTwoLine(strID); string strComment = DomUtil.GetAttr(node, "comment"); if (String.IsNullOrEmpty(strComment) == true) { strComment = " "; } // string strBarcodeLink = "<a href='" + App.OpacServerUrl + "/book.aspx?barcode=" + strBarcode + "&forcelogin=userid' target='_blank'>" + strBarcode + "</a>"; string strBarcodeLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ItemInfoForm', this.innerText, true);\" onmouseover=\"window.external.HoverItemProperty(this.innerText);\">" + strBarcode + "</a>"; string strPauseInfo = ""; if (StringUtil.IsInList("pauseBorrowing", this.App.OverdueStyle) == true && String.IsNullOrEmpty(strOverduePeriod) == false) { string strPauseStart = DomUtil.GetAttr(node, "pauseStart"); if (String.IsNullOrEmpty(strPauseStart) == false) { strPauseInfo = "从 " + DateTimeUtil.LocalDate(strPauseStart) + " 开始,"; } string strUnit = ""; long lOverduePeriod = 0; // 分析期限参数 nRet = LibraryApplication.ParsePeriodUnit(strOverduePeriod, out lOverduePeriod, out strUnit, out strError); if (nRet == -1) { strError = "在分析期限参数的过程中发生错误: " + strError; strResult.Append(strError); } long lResultValue = 0; string strPauseCfgString = ""; nRet = this.App.ComputePausePeriodValue(strReaderType, this.LibraryCode, lOverduePeriod, out lResultValue, out strPauseCfgString, out strError); if (nRet == -1) { strError = "在计算以停代金周期的过程中发生错误: " + strError; strResult.Append(strError); } strPauseInfo += "停借期 " + lResultValue.ToString() + LibraryApplication.GetDisplayTimeUnit(strUnit) + " (计算过程如下: 超期 " + lOverduePeriod.ToString() + LibraryApplication.GetDisplayTimeUnit(strUnit) + ",读者类型 " + strReaderType + " 的 以停代金因子 为 " + strPauseCfgString + ")"; } strResult.Append("<tr class='content'>"); strResult.Append("<td class='barcode' >" + strBarcodeLink + "</td>"); strResult.Append("<td class='reason'><div class='wide'></div>" + strOver + "</td>"); strResult.Append("<td class='price' >" + strPrice + "</td>"); strResult.Append("<td class='pauseinfo'>" + strPauseInfo + "</td>"); strResult.Append("<td class='borrowdate' >" + strBorrowDate + "</td>"); strResult.Append("<td class='borrowperiod' >" + LibraryApplication.GetDisplayTimePeriodString(strBorrowPeriod) + "</td>"); strResult.Append("<td class='returndate' >" + strReturnDate + "</td>"); strResult.Append("<td class='id' >" + strID + "</td>"); strResult.Append("<td class='comment' width='30%'>" + strComment + "</td>"); strResult.Append("</tr>"); } if (StringUtil.IsInList("pauseBorrowing", this.App.OverdueStyle) == true) { // 汇报以停代金情况 string strPauseMessage = ""; nRet = App.HasPauseBorrowing( calendar, this.LibraryCode, dom, out strPauseMessage, out strError); if (nRet == -1) { strError = "在计算以停代金的过程中发生错误: " + strError; strResult.Append(strError); } if (nRet == 1) { strResult.Append("<td colspan='8'>" + strPauseMessage + "</td>"); // ??? } } strResult.Append("</table>"); strWarningText += "<div class='warning amerce'><div class='number'>" + nodes.Count.ToString() + "</div><div class='text'>待交费</div></div>"; } // *** // 借阅的册 strResult.Append("<div class='tabletitle'>借阅信息</div>"); nodes = dom.DocumentElement.SelectNodes("borrows/borrow"); int nBorrowCount = nodes.Count; strResult.Append("<table class='borrowinfo'>"); strResult.Append("<tr class='borrow_count'><td colspan='9' class='borrow_count'>"); string strMaxItemCount = GetParam(strReaderType, "", "可借总册数"); strResult.Append("最多可借:" + strMaxItemCount + " "); int nMax = 0; try { nMax = System.Convert.ToInt32(strMaxItemCount); } catch { strResult.Append("当前读者 可借总册数 参数 '" + strMaxItemCount + "' 格式错误"); goto CONTINUE1; } strResult.Append("当前可借:" + System.Convert.ToString(Math.Max(0, nMax - nodes.Count)) + ""); CONTINUE1: int nOverdueCount = 0; strResult.Append("</td></tr>"); if (nodes.Count > 0) { strResult.Append("<tr class='columntitle'><td>册条码号</td><td>摘要</td><td>卷册</td><td>价格</td><td>续借次</td><td>借阅日期</td><td>期限</td><td>操作者</td><td>应还日期</td><td>续借注</td></tr>"); for (int i = 0; i < nodes.Count; i++) { XmlNode node = nodes[i]; string strBarcode = DomUtil.GetAttr(node, "barcode"); string strNo = DomUtil.GetAttr(node, "no"); string strBorrowDate = DomUtil.GetAttr(node, "borrowDate"); string strPeriod = DomUtil.GetAttr(node, "borrowPeriod"); string strOperator = DomUtil.GetAttr(node, "operator"); string strRenewComment = DomUtil.GetAttr(node, "renewComment"); string strConfirmItemRecPath = DomUtil.GetAttr(node, "recPath"); string strBiblioRecPath = DomUtil.GetAttr(node, "biblioRecPath"); string strPrice = DomUtil.GetAttr(node, "price"); string strTimeReturning = DomUtil.GetAttr(node, "timeReturning"); string strVolume = DomUtil.GetAttr(node, "volume"); #if NO string strOverDue = ""; bool bOverdue = false; // 检查超期情况。 // return: // -1 数据格式错误 // 0 没有发现超期 // 1 发现超期 strError中有提示信息 nRet = App.CheckPeriod( calendar, strBorrowDate, strPeriod, out strError); if (nRet == -1) { strOverDue = strError; } else if (nRet == 1) { strOverDue = strError; // "已超期"; bOverdue = true; } else { strOverDue = "<a title='" + strError + "'>" + LocalDate(strTimeReturning) + "</a>"; // strOverDue = strError; // 可能也有一些必要的信息,例如非工作日 } #endif string strOverDue = ""; bool bOverdue = false; // 是否超期 { DateTime timeReturning = DateTime.MinValue; string strTips = ""; DateTime timeNextWorkingDay; long lOver = 0; string strPeriodUnit = ""; // 获得还书日期 // return: // -1 数据格式错误 // 0 没有发现超期 // 1 发现超期 strError中有提示信息 // 2 已经在宽限期内,很容易超期 nRet = this.App.GetReturningTime( calendar, strBorrowDate, strPeriod, out timeReturning, out timeNextWorkingDay, out lOver, out strPeriodUnit, out strError); if (nRet == -1) { strOverDue = strError; } else { strTips = strError; strOverDue = timeReturning.ToString("d"); if (nRet == 1) { nOverdueCount++; bOverdue = true; strOverDue += " (" + string.Format(this.App.GetString("已超期s"), // 已超期 {0} this.App.GetDisplayTimePeriodStringEx(lOver.ToString() + " " + strPeriodUnit)) + ")"; } strOverDue = "<a title='" + strError.Replace("'", "\"") + "'>" + strOverDue + "</a>"; } } // string strBarcodeLink = "<a href='" + App.OpacServerUrl + "/book.aspx?barcode=" + strBarcode + "&borrower=" + strReaderBarcode + "&forcelogin=userid' target='_blank'>" + strBarcode + "</a>"; string strBarcodeLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ItemInfoForm', this.innerText, true);\" onmouseover=\"window.external.HoverItemProperty(this.innerText);\">" + strBarcode + "</a>"; /* strResult.Append( "<tr class='content' "+strColor+" nowrap>"); */ if (bOverdue == true) { strResult.Append("<tr class='content overdue'>"); } else { strResult.Append("<tr class='content'>"); } strResult.Append("<td class='barcode' nowrap>" + strBarcodeLink + "</td>"); strResult.Append("<td class='summary pending'><br/>BC:" + strBarcode + "|" + strConfirmItemRecPath + (string.IsNullOrEmpty(strBiblioRecPath) == true ? "" : "|" + strBiblioRecPath) + "</td>"); strResult.Append("<td class='volume' nowrap>" + HttpUtility.HtmlEncode(strVolume) + "</td>"); strResult.Append("<td class='price' nowrap align='right'>" + strPrice + "</td>"); strResult.Append("<td class='no' nowrap align='right'>" + strNo + "</td>"); strResult.Append("<td class='borrowdate' >" + LocalDateOrTime(strBorrowDate, strPeriod) + "</td>"); strResult.Append("<td class='period' nowrap>" + LibraryApplication.GetDisplayTimePeriodString(strPeriod) + "</td>"); strResult.Append("<td class='operator' nowrap>" + strOperator + "</td>"); strResult.Append("<td class='returndate' width='30%'>" + strOverDue + "</td>"); strResult.Append("<td class='renewcomment' width='30%'>" + strRenewComment.Replace(";", "<br/>") + "</td>"); strResult.Append("</tr>"); } } strResult.Append("</table>"); if (nOverdueCount > 0) { strWarningText += "<div class='warning overdue'><div class='number'>" + nOverdueCount.ToString() + "</div><div class='text'>已超期</div></div>"; } // *** // 预约请求 strResult.Append("<div class='tabletitle'>预约请求</div>"); nodes = dom.DocumentElement.SelectNodes("reservations/request"); if (nodes.Count > 0) { int nArriveCount = 0; strResult.Append("<table class='reservation'>"); strResult.Append("<tr class='columntitle'><td nowrap>册条码号</td><td nowrap>到达情况</td><td nowrap>摘要</td><td nowrap>请求日期</td><td nowrap>操作者</td><td nowrap>配书情况</td></tr>"); foreach (XmlElement node in nodes) { string strBarcodes = DomUtil.GetAttr(node, "items"); string strRequestDate = LocalTime(DomUtil.GetAttr(node, "requestDate")); string strOperator = DomUtil.GetAttr(node, "operator"); string strArrivedItemBarcode = DomUtil.GetAttr(node, "arrivedItemBarcode"); string strSummary = this.App.GetBarcodesSummary( this.SessionInfo, strBarcodes, strArrivedItemBarcode, "html", // "html,forcelogin", "" /*"target='_blank'"*/); string strClass = "content"; int nBarcodesCount = GetBarcodesCount(strBarcodes); // 状态 string strArrivedDate = DomUtil.GetAttr(node, "arrivedDate"); string strState = DomUtil.GetAttr(node, "state"); if (strState == "arrived") { strArrivedDate = ItemConverter.LocalTime(strArrivedDate); strState = "册 " + strArrivedItemBarcode + " 已于 " + strArrivedDate + " 到书"; if (nBarcodesCount > 1) { strState += string.Format("; 同一预约请求中的其余 {0} 册旋即失效", // ";同一预约请求中的其余 {0} 册旋即失效" (nBarcodesCount - 1).ToString()); } strClass = "content active"; nArriveCount++; } string strBox = node.GetAttribute("box"); if (string.IsNullOrEmpty(strBox) == false) { strClass += " boxing"; } strResult.Append("<tr class='" + strClass + "'>"); strResult.Append("<td class='barcode'>" + MakeBarcodeListHyperLink(strBarcodes, strArrivedItemBarcode, ", ") + (nBarcodesCount > 1 ? " 之一" : "") + "</td>"); strResult.Append("<td class='state'>" + strState + "</td>"); strResult.Append("<td class='summary'>" + strSummary + "</td>"); strResult.Append("<td class='requestdate'>" + strRequestDate + "</td>"); strResult.Append("<td class='operator'>" + strOperator + "</td>"); strResult.Append("<td class='boxing'>" + strBox + "</td>"); strResult.Append("</tr>"); } strResult.Append("</table>"); if (nArriveCount > 0) { strWarningText += "<div class='warning arrive'><div class='number'>" + nArriveCount.ToString() + "</div><div class='text'>预约到书</div></div>"; } } if (string.IsNullOrEmpty(strWarningText) == false) { strResult.Append("<div id='warningframe'>" + strWarningText + "</div>"); } // *** // 借阅历史 if (StringUtil.IsInList("noborrowhistory", this.Formats) == false) { strResult.Append("<div class='tabletitle'>借阅历史</div>"); nodes = dom.DocumentElement.SelectNodes("borrowHistory/borrow"); if (nodes.Count > 0) { strResult.Append("<table class='borrowhistory'>"); strResult.Append("<tr class='borrow_count'><td colspan='10' class='borrow_count'>"); XmlNode nodeHistory = dom.DocumentElement.SelectSingleNode("borrowHistory"); string strHistoryCount = ""; if (nodeHistory != null) { strHistoryCount = DomUtil.GetAttr(nodeHistory, "count"); } strResult.Append("共借阅: " + strHistoryCount + " 册 (下面表格中仅显示了最近借阅过的最多 " + this.App.MaxPatronHistoryItems.ToString() + " 册)"); strResult.Append("</td></tr>"); strResult.Append("<tr class='columntitle'><td nowrap>序</td><td nowrap>册条码号</td><td nowrap>摘要</td><td nowrap>卷册</td><td nowrap>续借次</td><td nowrap>借阅日期</td><td nowrap>期限</td><td nowrap>借阅操作者</td><td nowrap>续借注</td><td nowrap>还书日期</td><td nowrap>还书操作者</td></tr>"); for (int i = 0; i < nodes.Count; i++) { XmlNode node = nodes[i]; string strBarcode = DomUtil.GetAttr(node, "barcode"); string strNo = DomUtil.GetAttr(node, "no"); string strBorrowDate = DomUtil.GetAttr(node, "borrowDate"); string strPeriod = DomUtil.GetAttr(node, "borrowPeriod"); string strBorrowOperator = DomUtil.GetAttr(node, "borrowOperator"); // 借书操作者 string strOperator = DomUtil.GetAttr(node, "operator"); // 还书操作者 string strRenewComment = DomUtil.GetAttr(node, "renewComment"); // string strSummary = ""; string strConfirmItemRecPath = DomUtil.GetAttr(node, "recPath"); string strBiblioRecPath = DomUtil.GetAttr(node, "biblioRecPath"); string strReturnDate = DomUtil.GetAttr(node, "returnDate"); string strVolume = DomUtil.GetAttr(node, "volume"); // string strBarcodeLink = "<a href='" + App.OpacServerUrl + "/book.aspx?barcode=" + strBarcode + "&borrower=" + strReaderBarcode + "&forcelogin=userid' target='_blank'>" + strBarcode + "</a>"; string strBarcodeLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ItemInfoForm', this.innerText, true);\" onmouseover=\"OnHover(this.innerText);\">" + strBarcode + "</a>"; strResult.Append("<tr class='content'>"); strResult.Append("<td class='index' nowrap>" + (i + 1).ToString() + "</td>"); strResult.Append("<td class='barcode' nowrap>" + strBarcodeLink + "</td>"); strResult.Append("<td class='summary pending'>BC:" + strBarcode + "|" + strConfirmItemRecPath + (string.IsNullOrEmpty(strBiblioRecPath) == true ? "" : "|" + strBiblioRecPath) + "</td>"); strResult.Append("<td class='volume' nowrap>" + HttpUtility.HtmlEncode(strVolume) + "</td>"); strResult.Append("<td class='no' nowrap align='right'>" + strNo + "</td>"); strResult.Append("<td class='borrowdate' >" + LocalDateOrTime(strBorrowDate, strPeriod) + "</td>"); strResult.Append("<td class='period' nowrap>" + LibraryApplication.GetDisplayTimePeriodString(strPeriod) + "</td>"); strResult.Append("<td class='borrowoperator' nowrap>" + strBorrowOperator + "</td>"); strResult.Append("<td class='renewcomment' width='30%'>" + strRenewComment.Replace(";", "<br/>") + "</td>"); strResult.Append("<td class='returndate' nowrap>" + LocalDateOrTime(strReturnDate, strPeriod) + "</td>"); strResult.Append("<td class='operator' nowrap>" + strOperator + "</td>"); strResult.Append("</tr>"); } strResult.Append("</table>"); } } strResult.Append("</body></html>"); return(strResult.ToString()); }
public override void Item(object sender, ItemConverterEventArgs e) { XmlDocument dom = new XmlDocument(); try { dom.LoadXml(e.Xml); } catch (Exception ex) { e.ResultString = ex.Message; return; } string strResult = "<html>"; strResult += "<head>"; strResult += "<link href='%mappeddir%\\styles\\itemhtml.css' type='text/css' rel='stylesheet' />"; strResult += "<link href=\"%mappeddir%/jquery-ui-1.8.7/css/jquery-ui-1.8.7.css\" rel=\"stylesheet\" type=\"text/css\" />" + "<script type=\"text/javascript\" src=\"%mappeddir%/jquery-ui-1.8.7/js/jquery-1.4.4.min.js\"></script>" + "<script type=\"text/javascript\" src=\"%mappeddir%/jquery-ui-1.8.7/js/jquery-ui-1.8.7.min.js\"></script>" + "<script type='text/javascript' charset='UTF-8' src='%mappeddir%\\scripts\\getsummary.js" + "'></script>"; strResult += "</head>"; strResult += "<body>"; strResult += "<table class='iteminfo'>"; { // 册条码 string strItemBarcode = DomUtil.GetElementText(dom.DocumentElement, "barcode"); /* * string strBarcodeLink = "<a href='" + App.OpacServerUrl + "/book.aspx?barcode=" + strItemBarcode + "&forcelogin=userid' target='_blank'>" + strItemBarcode + "</a>"; * */ string strBarcodeLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ItemInfoForm', this.innerText, true);\">" + strItemBarcode + "</a>"; strResult += GetOneTR("barcode", "册条码号", strBarcodeLink); // 馆藏地点 strResult += GetOneTR(dom.DocumentElement, "location", "馆藏地点"); // 书目摘要 strResult += "<tr class='content summary'>"; strResult += "<td class='name summary' nowrap>"; strResult += "书目摘要"; strResult += "</td>"; strResult += "<td class='value summary pending'>"; strResult += "B:" + strItemBarcode + "|" + e.RecPath; strResult += "</td></tr>"; // 状态 strResult += GetOneTR(dom.DocumentElement, "state", "状态"); // 册价格 strResult += GetOneTR(dom.DocumentElement, "price", "册价格"); // 出版时间 strResult += GetOneTR(dom.DocumentElement, "publishTime", "出版时间"); // 渠道 strResult += GetOneTR(dom.DocumentElement, "seller", "渠道"); // 经费来源 strResult += GetOneTR(dom.DocumentElement, "source", "经费来源"); // 索取号 strResult += GetOneTR(dom.DocumentElement, "accessNo", "索取号"); // 卷 strResult += GetOneTR(dom.DocumentElement, "volume", "卷"); // 册类型 strResult += GetOneTR(dom.DocumentElement, "bookType", "册类型"); // 登录号 strResult += GetOneTR(dom.DocumentElement, "registerNo", "登录号"); // 注释 strResult += GetOneTR(dom.DocumentElement, "comment", "注释"); // 合并注释 strResult += GetOneTR(dom.DocumentElement, "mergeComment", "合并注释"); // 批次号 strResult += GetOneTR(dom.DocumentElement, "batchNo", "批次号"); string strBorrower = DomUtil.GetElementText(dom.DocumentElement, "borrower"); // 借者条码 // 借者姓名 strResult += "<tr class='content patronname'>"; strResult += "<td class='name patronname' nowrap>"; strResult += "借者姓名"; strResult += "</td>"; if (string.IsNullOrEmpty(strBorrower) == false) { strResult += "<td class='value patronname pending'>"; strResult += "P:" + strBorrower; } else { strResult += "<td class='value patronname'>"; strResult += " "; } strResult += "</td></tr>"; // 借者条码 string strBorrowerLink = ""; if (String.IsNullOrEmpty(strBorrower) == false) { /* * strBorrowerLink = "<a href='" + App.OpacServerUrl + "/readerinfo.aspx?barcode=" + strBorrower + "&forcelogin=userid' target='_blank'>" + strBorrower + "</a>"; * */ strBorrowerLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ReaderInfoForm', this.innerText, true);\">" + strBorrower + "</a>"; } else { strBorrowerLink = " "; } strResult += GetOneTR("borrower", "借者证条码号", strBorrowerLink); // 借阅日期 string strBorrowDate = DomUtil.GetElementText(dom.DocumentElement, "borrowDate"); strBorrowDate = LocalTime(strBorrowDate); strResult += GetOneTR("borrowDate", "借阅日期", strBorrowDate); // 借阅期限 string strBorrowPeriod = DomUtil.GetElementText(dom.DocumentElement, "borrowPeriod"); strBorrowPeriod = LibraryApplication.GetDisplayTimePeriodString(strBorrowPeriod); strResult += GetOneTR("borrowPeriod", "借阅期限", strBorrowPeriod); // 参考ID strResult += GetOneTR(dom.DocumentElement, "refID", "参考ID"); // 册记录路径 strResult += GetOneTR("recpath", "册记录路径", e.RecPath); // 册二维码 /* * string strCode = "39code:" + strItemBarcode; * if (string.IsNullOrEmpty(strItemBarcode)) * strCode = "qrcode:@refID:" + DomUtil.GetElementText(dom.DocumentElement, "refID"); */ string strCode = "code=" + HttpUtility.UrlEncode(strItemBarcode) + ",type=code_39,width=300,height=80"; if (string.IsNullOrEmpty(strItemBarcode)) { strCode = "code=@refID:" + HttpUtility.UrlEncode(DomUtil.GetElementText(dom.DocumentElement, "refID")) + ",type=qr_code,width=200,height=200"; } strResult += "<tr class='content qrcode'>"; strResult += "<td class='value qrcode' colspan='2' >"; // strResult += "<img id='qrcode' class='pending' name='"+strCode+"' src='%mappeddir%\\images\\ajax-loader.gif' alt='册记录的二维码' ></img>"; strResult += "<img id='qrcode' src='barcode:" + strCode + "' alt='册记录的二维码' ></img>"; strResult += "</td></tr>"; strResult += "</table>"; } // 借阅历史 XmlNodeList nodes = dom.DocumentElement.SelectNodes("borrowHistory/borrower"); if (nodes.Count > 0) { strResult += "<br/><b>历史</b><br/>"; strResult += "<table class='borrowhistory'>\r\n"; strResult += "<tr class='borrowcount'><td colspan='10' class='borrowcount'>"; XmlNode nodeHistory = dom.DocumentElement.SelectSingleNode("borrowHistory"); string strHistoryCount = ""; if (nodeHistory != null) { strHistoryCount = DomUtil.GetAttr(nodeHistory, "count"); } strResult += "本册共被 " + strHistoryCount + " 位读者借阅过 (下表中最多仅能显示最近 " + this.App.MaxItemHistoryItems.ToString() + " 位)"; strResult += "</td></tr>\r\n"; strResult += "<tr class='columntitle'><td class='index' nowrap>序</td><td class='barcode' nowrap>证条码号</td><td class='summary' nowrap>姓名</td><td class='no' nowrap>续借次</td><td class='borrowdate' nowrap>借阅日期</td><td class='period' nowrap>期限</td><td class='borrowoperator' nowrap>借阅操作者</td><td class='renewcomment' nowrap>续借注</td><td class='returndate' nowrap>还书日期</td><td class='operator' nowrap>还书操作者</td></tr>\r\n"; for (int i = 0; i < nodes.Count; i++) { XmlNode node = nodes[i]; string strBarcode = DomUtil.GetAttr(node, "barcode"); string strNo = DomUtil.GetAttr(node, "no"); string strBorrowDate = DomUtil.GetAttr(node, "borrowDate"); string strPeriod = DomUtil.GetAttr(node, "borrowPeriod"); string strBorrowOperator = DomUtil.GetAttr(node, "borrowOperator"); // 借书操作者 string strOperator = DomUtil.GetAttr(node, "operator"); // 还书操作者 string strRenewComment = DomUtil.GetAttr(node, "renewComment"); // string strSummary = ""; // string strConfirmItemRecPath = DomUtil.GetAttr(node, "recPath"); string strReturnDate = DomUtil.GetAttr(node, "returnDate"); // string strBarcodeLink = "<a href='" + App.OpacServerUrl + "/readerinfo.aspx?barcode=" + strBarcode + "&forcelogin=userid' target='_blank'>" + strBarcode + "</a>"; string strBarcodeLink = "<a href='javascript:void(0);' onclick=\"window.external.OpenForm('ReaderInfoForm', this.innerText, true);\">" + strBarcode + "</a>"; // 表格内容奇数行的类名 string strOdd = ""; if (((i + 1) % 2) != 0) { strOdd = " odd"; } strResult += "<tr class='content" + strOdd + "'>"; strResult += "<td class='index' nowrap>" + (i + 1).ToString() + "</td>"; strResult += "<td class='barcode' nowrap>" + strBarcodeLink + "</td>"; strResult += "<td class='summary pending' nowrap>P:" + strBarcode + "</td>"; strResult += "<td class='no' nowrap align='right'>" + strNo + "</td>"; strResult += "<td class='borrowdate' nowrap>" + LocalDate(strBorrowDate) + "</td>"; strResult += "<td class='period' nowrap>" + LibraryApplication.GetDisplayTimePeriodString(strPeriod) + "</td>"; strResult += "<td class='borrowoperator' nowrap>" + strBorrowOperator + "</td>"; strResult += "<td class='renewcomment' width='30%'>" + strRenewComment.Replace(";", "<br/>") + "</td>"; strResult += "<td class='returndate' nowrap>" + LocalDate(strReturnDate) + "</td>"; strResult += "<td class='operator' nowrap>" + strOperator + "</td>"; strResult += "</tr>\r\n"; } strResult += "</table>\r\n"; } strResult += "</body></html>"; e.ResultString = strResult; }