Exemple #1
0
        private void ddl_className_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ddl_className.SelectedIndex < 0)
            {
                return;
            }

            Type   cls = JdUnion_GlbObject.AllModuleClass[ddl_className.Text];
            object obj = Activator.CreateInstance(cls);                   // as;
            JdUnion_Bussiness_Class jdy = obj as JdUnion_Bussiness_Class; // as

            //JDYSCM_Class jdy = jdy_GlbObject.AllModuleClass[ddl_className.SelectedValue.ToString()];
            if (jdy == null)
            {
                return;
            }
            JdUnion_ModuleClass jm = JdUnion_GlbObject.modules.Modules.FindLast(a => a.ClassName == ddl_className.Text);

            if (jm == null)
            {
                return;
            }
            jdy.InitClass(jm);
            if (jdy.defaultRequestJson != null)
            {
                this.txt_PostData.Text = jdy.defaultRequestJson;
            }
            this.ddl_className.Tag = jdy;
            return;

            jdy.InitClass(JdUnion_GlbObject.mlist[ddl_className.Text]);
            ////jdy.app_key = this.txt_app_key.Text.Trim();
            ////jdy.app_secret = this.txt_app_secret.Text.Trim();
            ////jdy.access_token = this.txt_access_token.Text.Trim();
            if (this.txt_params_1_val.Text.Trim().Length > 0)
            {
                jdy.params_360buy.Add(this.txt_params_1_key.Text.Trim(), this.txt_params_1_val.Text.Trim());
            }
            if (this.txt_params_2_val.Text.Trim().Length > 0)
            {
                jdy.params_360buy.Add(this.txt_params_2_key.Text.Trim(), this.txt_params_2_val.Text.Trim());
            }
            if (this.txt_params_3_val.Text.Trim().Length > 0)
            {
                jdy.params_360buy.Add(this.txt_params_3_key.Text.Trim(), this.txt_params_3_val.Text.Trim());
            }
            jdy.InitRequestJson();
            if (jdy is JdUnion_Bussiness_List_Class)
            {
                ////(jdy as JdUnion_Bussiness_List_Class).filter = new JdUnion_Bussiness_List_Class.JdUnion_Bussiness_Filter_Class();
                ////(jdy as JdUnion_Bussiness_List_Class).filter.pageSize = int.Parse(txt_PageSize.Text);
                ////(jdy as JdUnion_Bussiness_List_Class).filter.pageIndex = int.Parse(txt_PageNo.Text);
                ////jdy.Req_PostData = "{\"filter\":" + (jdy as JdUnion_Bussiness_List_Class).filter.ToJson().Replace("null", "\"\"") + "}";
            }
            this.txt_url.Text      = jdy.getUrl();
            this.txt_PostData.Text = jdy.Req_PostData;
        }
        public static JdUnion_Bussiness_Class CreateBusinessClass(Type t)
        {
            Type   cls = JdUnion_GlbObject.AllModuleClass[t.Name];
            object obj = Activator.CreateInstance(cls);                   // as
            JdUnion_Bussiness_Class jdy = obj as JdUnion_Bussiness_Class; // as

            jdy.InitClass(mlist[t.Name]);
            return(jdy);
        }
Exemple #3
0
        public bool getXmlData(XmlNode config, ref XmlDocument doc, ref XmlDocument xmlschemaDoc, ref string msg, XmlNode condition = null)
        {
            string strDefaultName = "DataTable1";
            string strRootName    = "NewDataSet";
            string ret            = "";
            string strName        = XmlUtil.GetSubNodeText(config, "module/@name");
            string strReqJson     = null;

            XmlNode xmlreq = config.SelectSingleNode("req");

            if (condition == null)
            {
                if (xmlreq != null)
                {
                    condition = xmlreq;
                }
            }
            Assembly assem = Assembly.GetExecutingAssembly();

            try
            {
                List <int> list = JdUnion_GlbObject.getElites();
                Dictionary <string, string> cols = null;
                Type t = assem.GetType(string.Format("{0}.{1}", assem.FullName.Split(',')[0], strName));
                if (t == null)
                {
                    msg = "无法识别的外部访问类";
                    return(false);
                }

                JdUnion_Bussiness_Class jgl = JdUnion_GlbObject.CreateBusinessClass(t) as JdUnion_Bussiness_Class;
                JdUnion_ModuleClass     jm  = JdUnion_GlbObject.modules.Modules.FindLast(a => a.ClassName == strName);
                if (jm == null)
                {
                    msg = "未配置正确的模块信息!";
                    return(false);
                }
                jgl.InitClass(jm);
                bool succ = jgl.getBusynessXmlData(condition, ref doc, ref xmlschemaDoc, ref msg);
                return(succ);
            }
            catch (Exception e)
            {
                msg = e.Message;
                return(false);
            }
            return(true);
        }
Exemple #4
0
        private void btn_request_Click(object sender, EventArgs e)
        {
            this.txt_url.Text    = "";
            this.txt_result.Text = "正在准备请求!";
            ////jdy_GlbObject.ResetAccess();
            ////string ret = jdy_GlbObject.Access_token;
            ////this.txt_req_name.Text = ret;
            ////this.txt_bdId.Text = jdy_GlbObject.bdId.ToString();

            JdUnion_Bussiness_Class jdy = ddl_className.Tag as JdUnion_Bussiness_Class;

            if (jdy == null)
            {
                return;
            }
            //////Type cls = JdUnion_GlbObject.AllModuleClass[ddl_className.Text];
            //////object obj = Activator.CreateInstance(cls);// as;
            //////JdUnion_Bussiness_Class jdy = obj as JdUnion_Bussiness_Class;// as
            //JDYSCM_Class jdy = jdy_GlbObject.AllModuleClass[ddl_className.SelectedValue.ToString()];
            if (jdy == null)
            {
                return;
            }
            jdy.InitClass(JdUnion_GlbObject.mlist[ddl_className.Text]);
            this.txt_app_key.Text      = jdy.app_key;
            this.txt_app_secret.Text   = jdy.app_secret;
            this.txt_access_token.Text = jdy.access_token;
            //jdy.timestamp = this.txt_timestamp.Text.Trim();
            //jdy.params_360buy.Clear();
            jdy.sign = null;//必须要置空

            if (this.txt_params_1_val.Text.Trim().Length > 0)
            {
                jdy.setBussiessItems(this.txt_params_1_key.Text, this.txt_params_1_val.Text);
            }
            if (this.txt_params_2_val.Text.Trim().Length > 0)
            {
                jdy.setBussiessItems(this.txt_params_1_key.Text, this.txt_params_1_val.Text);
            }
            if (this.txt_params_3_val.Text.Trim().Length > 0)
            {
                jdy.setBussiessItems(this.txt_params_1_key.Text, this.txt_params_1_val.Text);
            }
            if (txt_PostData.Text.Trim().Length > 0)
            {
                if (jdy.params_360buy.Count == 0)
                {
                    jdy.params_360buy.Add(this.txt_params_1_key.Text, this.txt_PostData.Text);
                }
            }
            if (jdy is JdUnion_Bussiness_List_Class)
            {
                (jdy as JdUnion_Bussiness_List_Class).pager           = new JdUnion_Bussiness_List_Class.JdUnion_Bussiness_Filter_Class();
                (jdy as JdUnion_Bussiness_List_Class).pager.pageIndex = int.Parse(txt_PageNo.Text);
                (jdy as JdUnion_Bussiness_List_Class).pager.pageSize  = int.Parse(txt_PageSize.Text);
            }



            //this.txt_PostData.Text  =
            //jdy.InitRequestJson();
            ////if (jdy is JdUnion_Bussiness_List_Class)
            ////{
            ////    (jdy as JdUnion_Bussiness_List_Class).filter = new JdUnion_Bussiness_List_Class.JdUnion_Bussiness_Filter_Class();
            ////    (jdy as JdUnion_Bussiness_List_Class).filter.pageSize = int.Parse(txt_PageSize.Text);
            ////    (jdy as JdUnion_Bussiness_List_Class).filter.page = int.Parse(txt_PageNo.Text);
            ////    jdy.Req_PostData = "{\"filter\":" + (jdy as JdUnion_Bussiness_List_Class).filter.ToJson().Replace("null", "\"\"") + "}";
            ////}
            //this.txt_url.Text = jdy.getUrl();
            //this.txt_PostData.Text = jdy.Req_PostData;

            //jdy.Req_PostData = this.txt_PostData.Text;
            this.txt_url.Text = jdy.getUrl();
            //this.txt_result.Text = this.chkbox_Post.Checked?jdy.PostRequest():jdy.GetRequest();
            string      msg    = null;
            XmlDocument xmldoc = null;
            XmlDocument schema = null;
            bool        succ   = jdy.getXmlData(ref xmldoc, ref schema, ref msg, false, false);

            if (xmldoc != null)
            {
                this.txt_result.Text = xmldoc.OuterXml;
            }
        }