public LineInfo(ChargingItemWrapper wrapper) { this.strAction = wrapper.Item.Action; this.strBarcode = wrapper.Item.ItemBarcode; this.strRecPath = ""; this.strBorrowDate = wrapper.RelatedItem == null ? "" : wrapper.RelatedItem.OperTime; this.strBorrowPeriod = wrapper.RelatedItem == null ? "" : wrapper.RelatedItem.Period; this.strBorrowOperator = wrapper.RelatedItem == null ? "" : wrapper.RelatedItem.Operator; this.strReturnDate = wrapper.Item.OperTime; this.strNo = wrapper.RelatedItem == null ? "" : wrapper.RelatedItem.No; if (this.strNo == "0") { this.strNo = ""; } this.strBiblioRecPath = wrapper.Item.BiblioRecPath; this.strRenewComment = ""; this.strOperator = wrapper.Item.Operator; }
protected override void Render(HtmlTextWriter writer) { int nRet = 0; string strError = ""; List <LineInfo> infos = new List <LineInfo>(); int nPageNo = this.StartIndex / this.PageMaxLines; if (this.DatabaseMode == false) { // return: // -1 出错 // 0 成功 // 1 尚未登录 nRet = this.LoadReaderXml(out strError); if (nRet == -1) { writer.Write(strError); return; } if (nRet == 1) { sessioninfo.LoginCallStack.Push(this.Page.Request.RawUrl); this.Page.Response.Redirect("login.aspx", true); return; } XmlNodeList nodes = ReaderDom.DocumentElement.SelectNodes("borrowHistory/borrow"); SetResultInfo(nodes.Count); for (int i = this.StartIndex; i < this.StartIndex + this.PageMaxLines; i++) { if (i >= nodes.Count) { infos.Add(new LineInfo()); } else { XmlNode node = nodes[i]; infos.Add(new LineInfo(node as XmlElement)); } } } else { List <ChargingItemWrapper> results = null; // return: // -2 尚未登录 // -1 出错 // 其它 符合条件的事项总数 nRet = GetChargingHistory(nPageNo, this.PageMaxLines, out results, out strError); if (nRet == -1) { writer.Write(strError); return; } if (nRet == -2) { sessioninfo.LoginCallStack.Push(this.Page.Request.RawUrl); this.Page.Response.Redirect("login.aspx", true); return; } SetResultInfo(nRet); if (results != null) // 2016/10/30 { for (int i = 0; i < this.PageMaxLines; i++) { if (i >= results.Count) { infos.Add(new LineInfo()); } else { ChargingItemWrapper wrapper = results[i]; LineInfo info = new LineInfo(wrapper); infos.Add(info); } } } } if (infos.Count != 0) { //OpacApplication app = (OpacApplication)this.Page.Application["app"]; //SessionInfo sessioninfo = (SessionInfo)this.Page.Session["sessioninfo"]; // 显示本页中的浏览行 { int i = 0; foreach (LineInfo info in infos) { StringBuilder text = new StringBuilder(); string strBarcodeLink = "<a href='book.aspx?barcode=" + info.strBarcode + "&forcelogin=userid' target='_blank'>" + info.strBarcode + "</a>"; string strItemBarcode = info.strBarcode; if (info.strAction == "read") { if (string.IsNullOrEmpty(strItemBarcode) == true) { strItemBarcode = "@biblioRecPath:" + info.strBiblioRecPath; } strBarcodeLink = "<a href='book.aspx?barcode=" + strItemBarcode + "&forcelogin=userid' target='_blank'>" + strItemBarcode + "</a>"; } string strTrClass = " class='dark content " + info.strAction + "' "; if ((i % 2) == 1) { strTrClass = " class='light content " + info.strAction + "' "; } text.Append("<tr " + strTrClass + ">"); text.Append("<td class='no'>" + (i + this.StartIndex + 1).ToString() + "</td>"); text.Append("<td class='action'>" + HttpUtility.HtmlEncode(GetActionName(info.strAction)) + "</td>"); text.Append("<td class='barcode'>" + strBarcodeLink + "</td>"); text.Append("<td class='summary pending' >" + HttpUtility.HtmlEncode(strItemBarcode) + "</td>"); info.strBorrowPeriod = app.GetDisplayTimePeriodStringEx(info.strBorrowPeriod); if (info.IsEmpty() == true) { text.Append("<td class='borrowinfo'>" + "</td>"); } else { if (info.strAction == "read") { text.Append("<td class='borrowinfo'>" + "<div class='returndate'>" + this.GetString("操作日期") + ":" + info.strReturnDate + "</div>" + "</td>"); } else { text.Append("<td class='borrowinfo'>" + "<div class='borrowno'>" + this.GetString("续借次") + " :" + info.strNo + "</div>" + "<div class='borrowdate'>" + this.GetString("借阅日期") + ":" + info.strBorrowDate + "</div>" + "<div class='borrowperiod'>" + this.GetString("期限") + ": " + info.strBorrowPeriod + "</div>" + "<div class='returndate'>" + this.GetString("还书日期") + ":" + info.strReturnDate + "</div>" + "</td>"); } } text.Append("<td class='renewcomment'>" + HttpUtility.HtmlEncode(info.strRenewComment) + "</td>"); if (this.DatabaseMode == false || info.IsEmpty()) { text.Append("<td class='operator'>" + info.strOperator + "</td>"); } else { if (info.strAction == "read") { text.Append("<td class='operator'>" + HttpUtility.HtmlEncode(info.strOperator) + "</td>"); } else { text.Append("<td class='operator'>" + "<div class='borrowoperator'>" + this.GetString("借") + ": " + HttpUtility.HtmlEncode(info.strBorrowOperator) + "</div>" + "<div class='returnoperator'>" + this.GetString("还") + ": " + HttpUtility.HtmlEncode(info.strOperator) + "</div>" + "</td>"); } } text.Append("</tr>"); PlaceHolder line = (PlaceHolder)this.FindControl("line" + Convert.ToString(i)); if (line == null) { PlaceHolder insertpoint = (PlaceHolder)this.FindControl("insertpoint"); PlaceHolder content = (PlaceHolder)this.FindControl("content"); line = this.NewContentLine(content, i, insertpoint); } LiteralControl contentcontrol = (LiteralControl)this.FindControl("line" + Convert.ToString(i) + "_content"); contentcontrol.Text = text.ToString(); i++; } // end of for } this.LineCount = Math.Max(this.LineCount, this.PageMaxLines); } else { // 显示空行 for (int i = 0; i < this.PageMaxLines; i++) { PlaceHolder line = (PlaceHolder)this.FindControl("line" + Convert.ToString(i)); if (line == null) { continue; } } } base.Render(writer); }
public LineInfo(ChargingItemWrapper wrapper) { this.strAction = wrapper.Item.Action; this.strBarcode = wrapper.Item.ItemBarcode; this.strRecPath = ""; this.strBorrowDate = wrapper.RelatedItem == null ? "" : wrapper.RelatedItem.OperTime; this.strBorrowPeriod = wrapper.RelatedItem == null ? "" : wrapper.RelatedItem.Period; this.strBorrowOperator = wrapper.RelatedItem == null ? "" : wrapper.RelatedItem.Operator; this.strReturnDate = wrapper.Item.OperTime; this.strNo = wrapper.RelatedItem == null ? "" : wrapper.RelatedItem.No; if (this.strNo == "0") this.strNo = ""; this.strBiblioRecPath = wrapper.Item.BiblioRecPath; this.strRenewComment = ""; this.strOperator = wrapper.Item.Operator; }