示例#1
0
        public JsonResult <List <WeatherCode> > getSupportCity(string ProvinceName)
        {
            #region 方法一
            //string strUrl = Url+"?"+"byProvinceName=" + ProvinceName;

            //#region 方法一获取接口数据 通过WebClient 方法获取
            ////WebClient webClient = new WebClient();
            ////webClient.Encoding = System.Text.Encoding.UTF8;
            //////获取数据
            ////var result = webClient.DownloadString(strUrl);
            //#endregion



            //#region 方法二获取接口数据 通过HTTPWebRequest方法获得
            //string xmlString = WebServiceHelper.Get(strUrl);
            //#endregion
            //List<string> list = new List<string>();

            //// xmlString.Trim();
            //// WeatherCode weatherCode = XMLHelper.XmlDeserialize<WeatherCode>(xmlString);
            #endregion

            List <WeatherCode> weatherCodes = new List <WeatherCode>();
            string[]           strarry      = webService.getSupportCity(ProvinceName);
            weatherCodes = ComonTool.GetWeatherCode(strarry);
            return(Json <List <WeatherCode> >(weatherCodes));
        }
示例#2
0
        public JsonResult <List <Mobile> > getDatabaseInfo()
        {
            List <Mobile> mobiles = new List <Mobile>();

            string[]      strarray        = mobileService.getDatabaseInfo();
            List <int>    RecordNumber    = (List <int>)ComonTool.GetNumberic(strarray);
            List <string> ProvinceAdnCity = (List <string>)ComonTool.GetStrings(strarray);

            for (int i = 0; i < RecordNumber.Count; i++)
            {
                Mobile mobile = new Mobile();
                mobile.Record          = RecordNumber[i];
                mobile.ProvinceAndCity = ProvinceAdnCity[i];
                mobiles.Add(mobile);
            }
            return(Json <List <Mobile> >(mobiles));
        }