Exemplo n.º 1
0
        public bool writeXmlData(XmlNode config, DataSet data, ref XmlDocument doc, ref XmlDocument xmlschema, ref string msg, string writetype = "Add")
        {
            doc = null;
            string strDefaultName = "DataTable1";
            string strRootName    = "NewDataSet";
            string ret            = "";
            string strName        = XmlUtil.GetSubNodeText(config, "module/@name");


            Assembly assem = Assembly.GetExecutingAssembly();

            strName = string.Format(strName, writetype);
            try
            {
                Type t = assem.GetType(string.Format("{0}.{1}", assem.FullName.Split(',')[0], strName));
                if (t == null)
                {
                    msg = "无法识别的类型";
                    return(false);
                }

                JdUnion_Bussiness_List_Class jdyreq = Activator.CreateInstance(t) as JdUnion_Bussiness_List_Class;
                ////if (jdyreq is JDYSCM_SaleOrder_Update_Class)
                ////{
                ////    msg = "销售订单外部数据不能修改,只能新增或删除!";
                ////    return false;
                ////}
                jdyreq.InitClass(JdUnion_GlbObject.mlist[t.Name]);
                jdyreq.InitRequestJson();
                XmlDocument   schemadoc = jdyreq.getRequestSchema();
                Json2XmlClass j2x       = new Json2XmlClass(schemadoc);
                //jdyreq.Req_PostData = getRequestJson(jdyreq,data);
                jdyreq.Req_PostData = j2x.getJsonString(data);
                if (JdUnion_GlbObject.mlist[t.Name].RequestMethodUseGET)
                {
                    ret = jdyreq.GetRequest();
                }
                else
                {
                    ret = jdyreq.PostRequest();
                }
                string      strXml = XML_JSON.Json2XML("{\"root\":{0}}".Replace("{0}", ret));
                XmlDocument tmp    = new XmlDocument();
                tmp.LoadXml(strXml);
                ////doc = FillXml(tmp, doc, strRootName, strDefaultName);
                ////xmlschema = getSchema(doc.SelectSingleNode(strRootName), strDefaultName);

                ////doc = ClearSubNode(doc, strRootName, strDefaultName);

                if (!j2x.getDataSetXml(ret, ref doc, ref msg))
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                msg = e.Message;
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
        string getRequestJson(JdUnion_Bussiness_List_Class jc, DataSet ds)
        {
            return(jc.RequestDataSet(ds));

            return(null);
        }