示例#1
0
        internal override void DomToMember(string strRecPath)
        {
            this.PublishTime = DomUtil.GetElementText(this._dataDom.DocumentElement, "publishTime");
            this.State       = DomUtil.GetElementText(this._dataDom.DocumentElement, "state");
            this.Issue       = DomUtil.GetElementText(this._dataDom.DocumentElement, "issue");
            this.Zong        = DomUtil.GetElementText(this._dataDom.DocumentElement, "zong");
            this.Volume      = DomUtil.GetElementText(this._dataDom.DocumentElement, "volume");

            // 2008/12/23 changed

            /*
             * XmlNode nodeOrderInfo = this.RecordDom.DocumentElement.SelectSingleNode("orderInfo");
             * if (nodeOrderInfo != null)
             *  this.OrderInfo = nodeOrderInfo.InnerXml;
             * else
             *  this.OrderInfo = "";
             * */
            this.OrderInfo = DomUtil.GetElementInnerXml(this._dataDom.DocumentElement, "orderInfo");


            this.Comment = DomUtil.GetElementText(this._dataDom.DocumentElement, "comment");
            this.BatchNo = DomUtil.GetElementText(this._dataDom.DocumentElement, "batchNo");

            this.ParentId   = DomUtil.GetElementText(this._dataDom.DocumentElement, "parent");
            this.RefID      = DomUtil.GetElementText(this._dataDom.DocumentElement, "refID");
            this.Operations = DomUtil.GetElementInnerXml(this._dataDom.DocumentElement, "operations");

            this.RecPath = strRecPath;
        }
示例#2
0
        internal override void DomToMember(string strRecPath)
        {
            this.Index = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                "index");
            this.State = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                "state");
            this.TypeString = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                     "type");
            this.OrderSuggestion = GetOrderSuggestionCaption(DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                                                    "orderSuggestion"));
            this.Title = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                "title");
            this.Creator = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                  "creator");
            this.Subject = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                  "subject");
            this.Summary = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                  "summary");
            this.Content = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                  "content").Replace("\\r", "\r\n");
            this.CreateTime = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                     "createTime");
            this.LastModified = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                       "lastModified");
            this.ParentId = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                   "parent");
            this.RefID = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                "refID");
            this.Operations = DomUtil.GetElementInnerXml(this._dataDom.DocumentElement,
                                                         "operations");

            this.RecPath = strRecPath;
        }
示例#3
0
        internal override void DomToMember(string strRecPath)
        {
            this.Index = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                "index");
            this.State = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                "state");
            this.CatalogNo = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                    "catalogNo");
            this.Seller = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                 "seller");
            this.Source = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                 "source");
            this.Range = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                "range");
            this.IssueCount = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                     "issueCount");
            this.Copy = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                               "copy");
            this.Price = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                "price");
            this.TotalPrice = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                     "totalPrice");
            this.FixedPrice = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                     "fixedPrice");
            this.Discount = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                   "discount");
            this.OrderTime = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                    "orderTime");
            this.OrderID = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                  "orderID");
            this.Distribute = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                     "distribute");
            this.Class = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                "class");
            this.SellerAddress = DomUtil.GetElementInnerXml(this._dataDom.DocumentElement,
                                                            "sellerAddress");

            this.Comment = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                  "comment");
            this.BatchNo = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                  "batchNo");

            this.ParentId = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                   "parent");

            this.RefID = DomUtil.GetElementText(this._dataDom.DocumentElement,
                                                "refID");
            this.Operations = DomUtil.GetElementInnerXml(this._dataDom.DocumentElement,
                                                         "operations");

            this.RecPath = strRecPath;
        }
示例#4
0
        // 可能会抛出异常
        public string GetData(string dataElement)
        {
            // 一般 XML 元素 content
            if (dataElement.IndexOf(":") == -1)
            {
                return(DomUtil.GetElementText(this.RecordDom.DocumentElement, dataElement));
            }

            var    parts = StringUtil.ParseTwoPart(dataElement, ":");
            string name  = parts[0];
            string type  = parts[1];

            if (type == "innerXml")
            {
                return(DomUtil.GetElementInnerXml(this.RecordDom.DocumentElement, name));
            }
            if (type == "this")
            {
                {
                    var info = this.GetType().GetProperty(name);
                    if (info != null)
                    {
                        return((string)info.GetValue(this));
                    }
                }
                {
                    var info = this.GetType().GetField(name);
                    if (info == null)
                    {
                        throw new Exception($"BookItem 对象中没有 {name} 成员");
                    }
                    return((string)info.GetValue(this));
                }
            }

            throw new Exception($"未知的类型 '{type}'");
        }
示例#5
0
        /// <summary>
        /// 设置数据
        /// </summary>
        /// <param name="strXml">评注记录 XML</param>
        /// <param name="strRecPath">评注记录路径</param>
        /// <param name="timestamp">时间戳</param>
        /// <param name="strError">返回出错信息</param>
        /// <returns>-1: 出错; 0: 成功</returns>
        public int SetData(string strXml,
                           string strRecPath,
                           byte[] timestamp,
                           out string strError)
        {
            strError = "";

            this.OldRecord = strXml;
            this.Timestamp = timestamp;

            this.RecordDom = new XmlDocument();

            try
            {
                this.RecordDom.LoadXml(strXml);
            }
            catch (Exception ex)
            {
                strError = "XML数据装载到DOM时出错" + ex.Message;
                return(-1);
            }

            this.Initializing = true;

            this.Index = DomUtil.GetElementText(this.RecordDom.DocumentElement,
                                                "index");
            this.State = DomUtil.GetElementText(this.RecordDom.DocumentElement,
                                                "state");
            this.TypeString = DomUtil.GetElementText(this.RecordDom.DocumentElement,
                                                     "type");
            this.OrderSuggestion = GetOrderSuggestionCaption(DomUtil.GetElementText(this.RecordDom.DocumentElement,
                                                                                    "orderSuggestion"));
            this.Title = DomUtil.GetElementText(this.RecordDom.DocumentElement,
                                                "title");
            this.Creator = DomUtil.GetElementText(this.RecordDom.DocumentElement,
                                                  "creator");
            this.Subject = DomUtil.GetElementText(this.RecordDom.DocumentElement,
                                                  "subject");
            this.Summary = DomUtil.GetElementText(this.RecordDom.DocumentElement,
                                                  "summary");
            this.Content = DomUtil.GetElementText(this.RecordDom.DocumentElement,
                                                  "content").Replace("\\r", "\r\n");
            this.CreateTime = DomUtil.GetElementText(this.RecordDom.DocumentElement,
                                                     "createTime");
            this.LastModified = DomUtil.GetElementText(this.RecordDom.DocumentElement,
                                                       "lastModified");
            this.ParentId = DomUtil.GetElementText(this.RecordDom.DocumentElement,
                                                   "parent");
            this.RefID = DomUtil.GetElementText(this.RecordDom.DocumentElement,
                                                "refID");
            this.Operations = DomUtil.GetElementInnerXml(this.RecordDom.DocumentElement,
                                                         "operations");

            this.RecPath = strRecPath;

            this.Initializing = false;

            this.Changed = false;

            return(0);
        }
示例#6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (WebUtil.PrepareEnvironment(this,
                                       ref app,
                                       ref sessioninfo) == false)
        {
            return;
        }

        // 是否登录?
        if (sessioninfo.UserID == "")
        {
            sessioninfo.UserID   = "public";
            sessioninfo.IsReader = false;
        }

        string strError = "";
        int    nRet     = 0;

#if NO
        SessionInfo temp_sessioninfo = new SessionInfo(app);
        temp_sessioninfo.UserID   = app.ManagerUserName;
        temp_sessioninfo.Password = app.ManagerPassword;
        temp_sessioninfo.IsReader = false;
#endif
        LibraryChannel channel = app.GetChannel();

        try
        {
            bool   bHintDisplayName = false; // []暗示为显示名
            string strDisplayName   = this.Request["displayName"];
            string strBarcode       = this.Request["barcode"];
            string strEncyptBarcode = Request.QueryString["encrypt_barcode"];

            string strText = "";

            // 如果为加密的条码形态
            if (String.IsNullOrEmpty(strEncyptBarcode) == false)
            {
                strBarcode = OpacApplication.DecryptPassword(strEncyptBarcode);
                if (strBarcode == null)
                {
                    strError = "encrypt_barcode参数值格式错误";
                    goto ERROR1;
                }
                bHintDisplayName = true;
                goto SEARCH_COMMENT;
            }

            {
                if (String.IsNullOrEmpty(strDisplayName) == false)
                {
                    if (strDisplayName.IndexOfAny(new char[] { '[', ']' }) != -1)
                    {
                        bHintDisplayName = true;
                    }
                    strDisplayName = strDisplayName.Replace("[", "").Trim();
                    strDisplayName = strDisplayName.Replace("]", "").Trim();
                }

                nRet = 0;
                string strReaderXml        = "";
                string strOutputReaderPath = "";

                if (String.IsNullOrEmpty(strDisplayName) == false)
                {
                    byte[] timestamp = null;

                    string[] results = null;
                    long     lRet    = // temp_sessioninfo.Channel.
                                       channel.GetReaderInfo(
                        null,
                        "@displayName:" + strDisplayName,
                        "xml",
                        out results,
                        out strOutputReaderPath,
                        out timestamp,
                        out strError);
                    if (lRet == -1)
                    {
                        goto ERROR1;
                    }
                    if (lRet == 0 && bHintDisplayName == true)
                    {
                        strBarcode = "";
                        goto SEARCH_COMMENT;
                    }
                    strReaderXml = results[0];

                    // CONTINUE1:
                    if (nRet == 0)
                    {
                        strBarcode = strDisplayName;
                    }
                }

                // SEARCH_BARCODE:
                if (nRet == 0 && String.IsNullOrEmpty(strBarcode) == false)
                {
                    strReaderXml = "";
                    byte[] timestamp = null;

                    string[] results = null;
                    long     lRet    = // temp_sessioninfo.Channel.
                                       channel.GetReaderInfo(
                        null,
                        strBarcode,
                        "xml",
                        out results,
                        out strOutputReaderPath,
                        out timestamp,
                        out strError);
                    if (lRet == -1)
                    {
                        goto ERROR1;
                    }
                    if (lRet == 0)
                    {
                        goto SEARCH_COMMENT;
                    }
                    strReaderXml = results[0];
                }

                if (nRet == 0)
                {
                    /*
                     * strError = "读者显示名或者证条码号 '" + strDisplayName + "' 不存在";
                     * goto ERROR1;
                     * */
                    if (String.IsNullOrEmpty(strBarcode) == true)
                    {
                        strBarcode = strDisplayName;
                    }
                    goto SEARCH_COMMENT;
                }

                XmlDocument readerdom = null;
                nRet = OpacApplication.LoadToDom(strReaderXml,
                                                 out readerdom,
                                                 out strError);
                if (nRet == -1)
                {
                    strError = "装载读者记录 '" + strOutputReaderPath + "' 进入XML DOM时发生错误: " + strError;
                    goto ERROR1;
                }

                strDisplayName = DomUtil.GetElementText(readerdom.DocumentElement,
                                                        "displayName");

                strBarcode = DomUtil.GetElementInnerXml(readerdom.DocumentElement,
                                                        "barcode");
            }
SEARCH_COMMENT:
            strText = strDisplayName;
            if (String.IsNullOrEmpty(strText) == true)
            {
                strText = strBarcode;
            }

            this.Label_name.Text = strText;

            string strRecipient = "";

            /*
             * if (String.IsNullOrEmpty(strDisplayName) == false)
             * {
             *  if (strDisplayName.IndexOf("[") == -1)
             *      strRecipient = "[" + strDisplayName + "]";
             *  else
             *      strRecipient = strDisplayName;
             *  if (String.IsNullOrEmpty(strEncyptBarcode) == false)
             *      strRecipient += " encrypt_barcode:" + strEncyptBarcode;
             * }
             * else
             *  strRecipient = strBarcode;
             * */
            strRecipient = BoxesInfo.BuildOneAddress(strDisplayName, strBarcode);

            string strSendMessageUrl = "./message.aspx?recipient=" + HttpUtility.UrlEncode(strRecipient);
            this.Button_sendMessage.OnClientClick = "window.open('" + strSendMessageUrl + "','_blank'); return cancelClick();";

            LoginState loginstate = GlobalUtil.GetLoginState(this.Page);
            if (loginstate == LoginState.NotLogin || loginstate == LoginState.Public)
            {
                this.Button_sendMessage.Enabled = false;
            }

            this.BrowseSearchResultControl1.Title = strText + " 所发表的书评";

            if (String.IsNullOrEmpty(strEncyptBarcode) == false)
            {
                this.Image_photo.ImageUrl = "./getphoto.aspx?encrypt_barcode=" + HttpUtility.UrlEncode(strEncyptBarcode) + "&displayName=" + HttpUtility.UrlEncode(strDisplayName);
            }
            else
            {
                this.Image_photo.ImageUrl = "./getphoto.aspx?barcode=" + HttpUtility.UrlEncode(strBarcode);
            }

            this.Image_photo.Width  = 128;
            this.Image_photo.Height = 128;

            if (this.IsPostBack == false)
            {
                string strXml = "";
                if (String.IsNullOrEmpty(strDisplayName) == false &&
                    String.IsNullOrEmpty(strBarcode) == false)
                {
                    // 创建评注记录XML检索式
                    // 用作者和作者显示名共同限定检索
                    nRet = ItemSearchControl.BuildCommentQueryXml(
                        app,
                        strDisplayName,
                        strBarcode,
                        "<全部>",
                        15000,   // app.SearchMaxResultCount
                        true,
                        out strXml,
                        out strError);
                    if (nRet == -1)
                    {
                        goto ERROR1;
                    }
                }
                else if (String.IsNullOrEmpty(strBarcode) == false)
                {
                    // 创建XML检索式
                    nRet = ItemSearchControl.BuildQueryXml(
                        this.app,
                        "comment",
                        strBarcode,
                        "<全部>",
                        "作者",
                        "exact",
                        15000,   // app.SearchMaxResultCount
                        true,
                        out strXml,
                        out strError);
                    if (nRet == -1)
                    {
                        goto ERROR1;
                    }
                }
                else if (String.IsNullOrEmpty(strDisplayName) == false)
                {
                    // 创建XML检索式
                    nRet = ItemSearchControl.BuildQueryXml(
                        this.app,
                        "comment",
                        strDisplayName,
                        "<全部>",
                        "作者显示名",
                        "exact",
                        15000,   // app.SearchMaxResultCount
                        true,
                        out strXml,
                        out strError);
                    if (nRet == -1)
                    {
                        goto ERROR1;
                    }
                }
                else
                {
                    strError = "strBarcode和strDisplayName均为空,无法进行检索";
                    goto ERROR1;
                }

                string strResultSetName = "opac_userinfo";

                // sessioninfo.Channel.
                channel.Idle += new IdleEventHandler(channel_Idle);
                try
                {
                    long lRet = //sessioninfo.Channel.
                                channel.Search(
                        null,
                        strXml,
                        strResultSetName,
                        "", // strOutputStyle
                        out strError);
                    if (lRet == -1)
                    {
                        goto ERROR1;
                    }

                    // not found
                    if (lRet == 0)
                    {
                        this.BrowseSearchResultControl1.Title = strText + " 没有发表过任何书评";
                    }
                    else
                    {
                        this.BrowseSearchResultControl1.ResultSetName = strResultSetName;
                        this.BrowseSearchResultControl1.ResultCount   = (int)lRet;
                        this.BrowseSearchResultControl1.StartIndex    = 0;
                    }
                    return;
                }
                finally
                {
                    //sessioninfo.Channel.
                    channel.Idle -= new IdleEventHandler(channel_Idle);
                }
            }
            return;

ERROR1:
            Response.Write(HttpUtility.HtmlEncode(strError));
            Response.End();
        }
        finally
        {
#if NO
            temp_sessioninfo.CloseSession();
#endif
            app.ReturnChannel(channel);
        }
    }
示例#7
0
        /// <summary>
        /// 设置数据
        /// </summary>
        /// <param name="strXml">期记录 XML</param>
        /// <param name="strRecPath">期记录路径</param>
        /// <param name="timestamp">时间戳</param>
        /// <param name="strError">返回出错信息</param>
        /// <returns>-1: 出错; 0: 成功</returns>
        public int SetData(string strXml,
                           string strRecPath,
                           byte[] timestamp,
                           out string strError)
        {
            strError = "";

            this.OldRecord = strXml;
            this.Timestamp = timestamp;

            this.RecordDom = new XmlDocument();

            try
            {
                if (string.IsNullOrEmpty(strXml) == true)
                {
                    this.RecordDom.LoadXml("<root />");
                }
                else
                {
                    this.RecordDom.LoadXml(strXml);
                }
            }
            catch (Exception ex)
            {
                strError = "XML数据装载到DOM时出错" + ex.Message;
                return(-1);
            }

            this.Initializing = true;

            this.PublishTime = DomUtil.GetElementText(this.RecordDom.DocumentElement, "publishTime");
            this.State       = DomUtil.GetElementText(this.RecordDom.DocumentElement, "state");
            this.Issue       = DomUtil.GetElementText(this.RecordDom.DocumentElement, "issue");
            this.Zong        = DomUtil.GetElementText(this.RecordDom.DocumentElement, "zong");
            this.Volume      = DomUtil.GetElementText(this.RecordDom.DocumentElement, "volume");

            // 2008/12/23 changed

            /*
             * XmlNode nodeOrderInfo = this.RecordDom.DocumentElement.SelectSingleNode("orderInfo");
             * if (nodeOrderInfo != null)
             *  this.OrderInfo = nodeOrderInfo.InnerXml;
             * else
             *  this.OrderInfo = "";
             * */
            this.OrderInfo = DomUtil.GetElementInnerXml(this.RecordDom.DocumentElement, "orderInfo");


            this.Comment = DomUtil.GetElementText(this.RecordDom.DocumentElement, "comment");
            this.BatchNo = DomUtil.GetElementText(this.RecordDom.DocumentElement, "batchNo");

            this.ParentId   = DomUtil.GetElementText(this.RecordDom.DocumentElement, "parent");
            this.RefID      = DomUtil.GetElementText(this.RecordDom.DocumentElement, "refID");
            this.Operations = DomUtil.GetElementInnerXml(this.RecordDom.DocumentElement, "operations");

            this.RecPath = strRecPath;

            this.Initializing = false;

            this.Changed = false;

            return(0);
        }