Ejemplo n.º 1
0
        public void RequestSizeAndPage(int pageSize, int page, XmlNode reqnode = null)
        {
            if (this.Module.RequestMethodUseGET)
            {
                Dictionary <string, string> obj = new Dictionary <string, string>();

                obj.Add(string.Format("{0}/pageSize", this.params_360buy.First().Key), pageSize.ToString());
                obj.Add(string.Format("{0}/pageIndex", this.params_360buy.First().Key), page.ToString());
                this.setBussiessItems(obj);
                return;

                //this.ReqJson = string.Format("{0}&pageSize={1}&pageIndex={2}", this.ReqJson, pageSize, page);
                KeyValuePair <string, object> fp = this.params_360buy.First();
                if (fp.Value == null)
                {
                    this.params_360buy[fp.Key] = "";
                }
                if (fp.Value.ToString().StartsWith("{") && fp.Value.ToString().EndsWith("}"))
                {
                    string      xmljson = "{" + string.Format("\"{0}\":{1}", fp.Key, fp.Value) + "}";
                    XmlDocument doc     = new XmlDocument();
                    try
                    {
                        doc.LoadXml(XML_JSON.Json2XML(xmljson));
                        XmlNode root      = doc.SelectSingleNode(fp.Key);
                        XmlNode IndexNode = root.SelectSingleNode("pageIndex");
                        XmlNode SizeNode  = root.SelectSingleNode("pageSize");
                        if (IndexNode == null)
                        {
                            XmlUtil.AddSubNode(root, "pageIndex", page.ToString());
                        }
                        else
                        {
                            IndexNode.InnerText = page.ToString();
                        }
                        if (SizeNode == null)
                        {
                            XmlUtil.AddSubNode(root, "pageIndex", pageSize.ToString());
                        }
                        else
                        {
                            SizeNode.InnerText = pageSize.ToString();
                        }
                        this.params_360buy[fp.Key] = XML_JSON.XML2Json(doc, fp.Key, true);
                    }
                    catch (Exception ce)
                    {
                    }
                }
                return;

                Dictionary <string, object> curr = (fp.Value as Dictionary <string, object>);
                if (curr.ContainsKey("pageSize"))
                {
                    curr["pageSize"] = pageSize;
                }
                else
                {
                    curr.Add("pageSize", pageSize);
                }
                if (curr.ContainsKey("pageIndex"))
                {
                    curr["pageIndex"] = pageSize;
                }
                else
                {
                    curr.Add("pageIndex", pageSize);
                }
                return;
            }
        }