using System; using System.Xml; using DigitalPlatform.LibraryServer; using DigitalPlatform.Xml; public class MyConverter : ReaderConverter { public override string Convert(string strXml) { XmlDocument dom = new XmlDocument(); try { dom.LoadXml(strXml); } catch (Exception ex) { return ex.Message; } string strLink = ""; string strResult = ""+strLink+""; // 左右分布的大表格 strResult += ""; strResult += ""; // 大表格收尾 strResult += "
"; // 识别信息表格 strResult += ""; // 标题 // strResult += ""; string strReaderBarcode = DomUtil.GetElementText(dom.DocumentElement, "barcode"); // 证条码 strResult += ""; // 读者类别 string strReaderType = DomUtil.GetElementText(dom.DocumentElement, "readerType"); strResult += ""; // 姓名 strResult += ""; /* strResult += ""; */ strResult += "
读者证条码" + strReaderBarcode + "
读者类别" + strReaderType + "
姓名" + DomUtil.GetElementText(dom.DocumentElement, "name") + "
" + "
"; strResult += "
 "; strResult += ""; strResult += ""; // 证状态 strResult += ""; /* // 发证日期 strResult += ""; */ // 失效日期 strResult += ""; strResult += ""; strResult += "
证状态" + DomUtil.GetElementText(dom.DocumentElement, "state") + "
发证日期" + LocalDate(DomUtil.GetElementText(dom.DocumentElement, "createDate")) + "
失效日期" + LocalDate(DomUtil.GetElementText(dom.DocumentElement, "expireDate")) + "
注释" + DomUtil.GetElementText(dom.DocumentElement, "comment") + "
"; strResult += "
"; // 超期记录 XmlNodeList nodes = dom.DocumentElement.SelectNodes("overdues/overdue"); if (nodes.Count > 0) { strResult += "超期信息
"; strResult += ""; strResult += ""; for(int i=0;i" + strBarcode + ""; strResult += ""; strResult += ""; strResult += ""; strResult += ""; strResult += ""; strResult += ""; strResult += ""; strResult += ""; strResult += ""; } strResult += "
册条码超期情况罚款额借阅日期期限还书日期ID
" + strBarcodeLink + "" + strOver + "" + strPrice + "" + strBorrowDate + "" + strBorrowPeriod + "" + strReturnDate + "" + strID + "
"; } // 获得日历 string strError = ""; Calendar calendar = null; int nRet = this.App.GetReaderCalendar(strReaderType, out calendar, out strError); if (nRet == -1) { strResult += strError; calendar = null; } // 借阅的册 strResult += "
借阅信息
"; nodes = dom.DocumentElement.SelectNodes("borrows/borrow"); strResult += ""; strResult += ""; strResult += ""; for(int i=0;i 25) strSummary = strSummary.Substring(0, 25) + "..."; if (strSummary.Length > 12) strSummary = strSummary.Insert(12, "
"); } string strColor="bgcolor=#ffffff"; if (strBarcode == this.CurrentItemBarcode) { strColor = "bgcolor=#ff9999"; // 当前正在借阅的册 } else if (IsRecentBorrowedItem(strBarcode) == true) { strColor = "bgcolor=#ffff99"; // 先前借阅过的册 } string strOverDue = ""; // 检查超期情况。 // return: // -1 数据格式错误 // 0 没有发现超期 // 1 发现超期 strError中有提示信息 nRet = App.CheckPeriod( calendar, strBorrowDate, strPeriod, out strError); if (nRet == -1) strOverDue = strError; else if (nRet == 1) strOverDue = strError; // "已超期"; else strOverDue = strError; // 可能也有一些必要的信息,例如非工作日 string strBarcodeLink = "" + strBarcode + ""; strResult += "
"; strResult += ""; strResult += ""; strResult += ""; strResult += ""; strResult += ""; strResult += ""; strResult += ""; strResult += ""; strResult += ""; } strResult += "
"; string strMaxItemCount = GetParam(strReaderType, "", "可借总册数"); strResult += "最多可借:" + strMaxItemCount + " "; int nMax = 0; try { nMax = System.Convert.ToInt32(strMaxItemCount); } catch { strResult += "当前读者 可借总册数 参数 '" + strMaxItemCount + "' 格式错误"; goto CONTINUE1; } strResult += "当前可借:" + System.Convert.ToString(Math.Max(0, nMax - nodes.Count)) + ""; strResult += "
册条码摘要续借次借阅日期期限操作者是否超期备注
" + strBarcodeLink + "" + strSummary + "" + strNo + "" + LocalTime(strBorrowDate) + "" + strPeriod + "" + strOperator + "" + strOverDue + "" + strRenewComment.Replace(";", "
") + "
"; CONTINUE1: // 预约请求 strResult += "
预约请求
"; strResult += ""; strResult += ""; nodes = dom.DocumentElement.SelectNodes("reservations/request"); for(int i=0;i"; strResult += ""; strResult += ""; strResult += ""; strResult += ""; strResult += ""; strResult += ""; } strResult += "
册条码到达情况摘要请求日期操作者
" + MakeBarcodeListHyperLink(strBarcodes, ", ") + "" + strState + "" + strSummary + "" + strRequestDate + "" + strOperator + "
"; strResult += ""; return strResult; } string MakeBarcodeListHyperLink(string strBarcodes, string strSep) { string strResult = ""; string[] barcodes = strBarcodes.Split(new char[] { ',' }); for (int i = 0; i < barcodes.Length; i++) { string strBarcode = barcodes[i]; if (String.IsNullOrEmpty(strBarcode) == true) continue; if (strResult != "") strResult += strSep; strResult += "" + strBarcode + ""; } return strResult; } }