Beispiel #1
0
        public SeOrderResult SendToK3InSe(string loginUrl, string SendJson)
        {
            HttpWebResponse response = HttpWebResponseUtility.CreatePostHttpResponse(loginUrl, SendJson, null, null, Encoding.UTF8, null);

            Stream resStream = response.GetResponseStream();

            StreamReader sr2       = new StreamReader(resStream, Encoding.UTF8);
            string       ReturnMsg = sr2.ReadToEnd();

            new Common().WriteLogs("K3 返回Code:" + ReturnMsg);
            return(new SeOrderResult(ReturnMsg));
        }
        //适用于工程变更的Json 格式
        public T GetPageMol <T>(int TaskID, string APIUrl, string FuncName, string Token, string FileType, string PageNum, string ActionName, string Paramers)
        {
            string          loginUrl  = APIUrl + FuncName + "/" + ActionName + "?Token=" + Token;
            HttpWebResponse response  = HttpWebResponseUtility.CreatePostHttpResponse(loginUrl, Paramers, null, null, Encoding.UTF8, null);
            Stream          resStream = response.GetResponseStream();
            StreamReader    sr        = new StreamReader(resStream, Encoding.UTF8);
            string          htmlCode  = sr.ReadToEnd();//获取返回JSON
            JObject         jobj      = JObject.Parse(htmlCode);

            if (jobj["StatusCode"].ToString() == "200")
            {
                JObject OutData   = JObject.Parse(jobj["Data"].ToString());
                string  JsonPage1 = "{\"" + PageNum + "\":" + OutData[PageNum].ToString().TrimStart('[').TrimEnd(']') + "}";
                return(JsonConvert.DeserializeObject <T>(JsonPage1));
            }
            else
            {
                common.WriteLogs(FileType, TaskID.ToString(), "----获取模板失败--");
                common.WriteLogs(FileType, TaskID.ToString(), jobj["Message"].ToString());
                return(default(T));
            }
        }