Пример #1
0
        public JsonResult GetExpressData(string shipOrderNumber)
        {
            OrderExpressQuery oe = ServiceHelper.Create <IOrderExpressQueryService>().GetOrderExpressById(shipOrderNumber);

            return(Json(oe));
            //string end = "暂时没有此快递单号的信息";
            //if (string.IsNullOrEmpty(expressCompanyName) || string.IsNullOrEmpty(shipOrderNumber))
            //{
            //    return Json(end);
            //}
            //string kuaidi100Code = ServiceHelper.Create<IExpressService>().GetExpress(expressCompanyName).Kuaidi100Code;
            //HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(string.Format("http://www.kuaidi100.com/query?type={0}&postid={1}", kuaidi100Code, shipOrderNumber));
            //httpWebRequest.Timeout = 8000;
            //HttpWebResponse response = (HttpWebResponse)httpWebRequest.GetResponse();
            //if (response.StatusCode == HttpStatusCode.OK)
            //{
            //    Stream responseStream = response.GetResponseStream();
            //    StreamReader streamReader = new StreamReader(responseStream, Encoding.GetEncoding("UTF-8"));
            //    end = streamReader.ReadToEnd();
            //    end = end.Replace("&amp;", "");
            //    end = end.Replace("&nbsp;", "");
            //    end = end.Replace("&", "");
            //}
            //return Json(end);
        }
        public JsonResult GetExpressData(string shipOrderNumber)
        {
            if (string.IsNullOrWhiteSpace(shipOrderNumber))
            {
                throw new HimallException("错误的订单信息");
            }
            OrderExpressQuery oe = ServiceHelper.Create <IOrderExpressQueryService>().GetOrderExpressById(shipOrderNumber);

            return(Json(oe));
        }