Beispiel #1
0
        void RenderReservation(LibraryApplication app,
            SessionInfo sessioninfo,
            XmlDocument dom)
        {
            // 预约请求
            PlaceHolder reservation = (PlaceHolder)this.FindControl("reservation");
            this.ReservationBarcodes = new List<string>();

            XmlNodeList nodes = dom.DocumentElement.SelectNodes("reservations/request");
            this.ReservationLineCount = nodes.Count;
            for (int i = 0; i < nodes.Count; i++)
            {
                PlaceHolder line = (PlaceHolder)reservation.FindControl("reservation_line" + Convert.ToString(i));
                if (line == null)
                {
                    Control insertpos = reservation.FindControl("reservation_insertpos");
                    line = NewReservationLine(insertpos.Parent, i, insertpos);
                    //this.ReservationLineCount++;
                }
                line.Visible = true;

                LiteralControl left = (LiteralControl)line.FindControl("reservation_line" + Convert.ToString(i) + "left");
                CheckBox checkbox = (CheckBox)line.FindControl("reservation_line" + Convert.ToString(i) + "checkbox");
                LiteralControl right = (LiteralControl)line.FindControl("reservation_line" + Convert.ToString(i) + "right");


                XmlNode node = nodes[i];
                string strBarcodes = DomUtil.GetAttr(node, "items");

                this.ReservationBarcodes.Add(strBarcodes);

                string strRequestDate = ItemConverter.LocalTime(DomUtil.GetAttr(node, "requestDate"));

                string strResult = "";

                string strClass = " class='roundcontentdark' ";

                if ((i % 2) == 1)
                    strClass = " class='roundcontentlight' ";


                strResult += "<tr " + strClass + "><td nowrap>";

                // 左
                left.Text = strResult;

                // 右开始
                strResult = "&nbsp;";

                //strResult += "" + strBarcodes + "</td>";

                strResult += "" + MakeBarcodeListHyperLink(strBarcodes, ",") + "</td>";

                // 操作者
                string strOperator = DomUtil.GetAttr(node, "operator");
                // 状态
                string strArrivedDate = DomUtil.GetAttr(node, "arrivedDate");
                string strState = DomUtil.GetAttr(node, "state");
                // 2007/1/18
                string strArrivedItemBarcode = DomUtil.GetAttr(node, "arrivedItemBarcode");
                if (strState == "arrived")
                {
                    strArrivedDate = ItemConverter.LocalTime(strArrivedDate);
                    strState = "册 "+strArrivedItemBarcode+" 已于 " + strArrivedDate + " 到书";
                }
                strResult += "<td>" + strState + "</td>";

                string strSummary = app.GetBarcodesSummary(
                    sessioninfo,
                    strBarcodes,
                    "html",
                    "");

                /*
                string strSummary = "";

                string strPrevBiblioRecPath = "";
                string[] barcodes = strBarcodes.Split(new char[] {','});
                for (int j = 0; j < barcodes.Length; j++)
                {
                    string strBarcode = barcodes[j];
                    if (String.IsNullOrEmpty(strBarcode) == true)
                        continue;

                    // 获得摘要
                    string strOneSummary = "";
                    string strBiblioRecPath = "";

                    Result result = app.GetBiblioSummary(sessioninfo,
        strBarcode,
        strPrevBiblioRecPath,   // 前一个path
        out strBiblioRecPath,
        out strOneSummary);
                    if (result.Value == -1 || result.Value == 0)
                        strOneSummary = result.ErrorInfo;

                    if (strOneSummary == "" 
                        && strPrevBiblioRecPath == strBiblioRecPath)
                        strOneSummary = "(同上)";

                    strSummary += strBarcode + " : " + strOneSummary + "<br/>";

                    strPrevBiblioRecPath = strBiblioRecPath;
                }
                 */


                strResult += "<td width='50%'>" + strSummary + "</td>";
                strResult += "<td nowrap>" + strRequestDate + "</td>";
                strResult += "<td nowrap>" + strOperator + "</td>";
                strResult += "</tr>";

                right.Text = strResult;

            }

            // 把多余的行隐藏起来
            for (int i = nodes.Count; ; i++)
            {
                PlaceHolder line = (PlaceHolder)reservation.FindControl("reservation_line" + Convert.ToString(i));
                if (line == null)
                    break;

                line.Visible = false;
            }
        }