예제 #1
0
 void Reset360BuyItems(XmlDocument xmldoc)
 {
     if (xmldoc == null)
     {
         return;
     }
     this.params_360buy.Clear();
     foreach (XmlNode node in xmldoc.FirstChild.ChildNodes)
     {
         string name    = node.Name;
         string strPath = string.Format("{0}/{1}", xmldoc.FirstChild.Name, name);
         string strJson = XML_JSON.XML2Json(xmldoc, strPath, true);
         this.params_360buy.Add(name, strJson);
     }
 }
예제 #2
0
        private QuicklookResult GetOrders(string typeId)
        {
            XML_JSON xML_JSON = new XML_JSON();
            Param    param    = new Param();

            param.typeid = typeId;
            // param.usesystem = "30000142";


            try
            {
                string          xml    = EVEApi.QuickLook(param);
                string          json   = xML_JSON.XML2Json(xml, "evec_api/quicklook");
                QuicklookResult result = Newtonsoft.Json.JsonConvert.DeserializeObject <QuicklookResult>(json);
                return(result);
            }
            catch
            {
                return(null);
            }
        }
예제 #3
0
        public virtual string RequestDataSet(DataSet ds)
        {
            XmlDocument doc = getRequestSchema();

            if (doc == null)
            {
                return(null);
            }
            XmlNamespaceManager xmlm = new XmlNamespaceManager(doc.NameTable);

            xmlm.AddNamespace("json", "http://james.newtonking.com/projects/json");//添加命名空间

            XmlNode root = doc.SelectSingleNode(".");

            if (root == null)
            {
                root = doc.CreateElement("req");
            }
            root = doc.SelectSingleNode("req");
            XmlNodeList        tables  = root.SelectNodes("Schema/Table");
            List <TableGuider> tablist = new List <TableGuider>();

            for (int i = 0; i < tables.Count; i++)
            {
                tablist.Add(new TableGuider(tables[i]));
            }
            root.RemoveChild(root.SelectSingleNode("Schema"));
            //root.AppendChild(doc.CreateElement(tablist[0].TableName));
            root = FillXmlByDatable(root, ds, 0, tablist);

            string ret = XML_JSON.XML2Json(doc, root.Name, true);

            tablist.ForEach(a =>
            {
                ret = ret.Replace(string.Format("${0}", a.TableName), a.TableName);
            });
            return(ret);
        }
예제 #4
0
        public virtual string getJsonString(DataSet ds)
        {
            XmlDocument doc = new XmlDocument();

            doc.LoadXml("<root/>");
            if (doc == null)
            {
                return(null);
            }

            XmlNode root = doc.SelectSingleNode("root");

            //root.AppendChild(doc.CreateElement(tablist[0].TableName));
            root = FillXmlByDatable(root, ds, 0, tablist);

            string ret = XML_JSON.XML2Json(doc, root.Name, true);

            tablist.ForEach(a =>
            {
                ret = ret.Replace(string.Format("${0}", a.TableName), a.TableName);
            });
            return(ret);
        }
예제 #5
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;
            }
        }