Exemplo n.º 1
0
        /// <summary>
        /// 根据fxt省份ID获取城市信息
        /// </summary>
        /// <param name="fxtProvinceId"></param>
        /// <returns></returns>
        public static List <FxtApi_SYSCity> GetCityByProvinceId(int fxtProvinceId, FxtAPIClientExtend _fxtApi = null)
        {
            List <FxtApi_SYSCity> list   = new List <FxtApi_SYSCity>();
            FxtAPIClientExtend    fxtApi = new FxtAPIClientExtend(_fxtApi);

            try
            {
                string name                = "GetCity";
                var    para                = new { provinceId = fxtProvinceId };
                string jsonStr             = Convert.ToString(EntranceApi.Entrance(name, para.ToJSONjss(), _fxtApi: fxtApi));
                FxtApi_PublicResult result = FxtApi_PublicResult.ConvertToObj(jsonStr);
                if (result == null || string.IsNullOrEmpty(Convert.ToString(result.data)))
                {
                    fxtApi.Abort();
                    return(new List <FxtApi_SYSCity>());
                }

                list = FxtApi_SYSCity.ConvertToObjList(Convert.ToString(result.data));
                fxtApi.Abort();
            }
            catch (Exception ex)
            {
                fxtApi.Abort();
                log.Error(string.Format(" GetCityByProvinceId(int provinceId:{0})", fxtProvinceId), ex);
            }
            return(list);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取所有城市
        /// </summary>
        /// <param name="_fxtApi"></param>
        /// <returns></returns>
        public static List <FxtApi_SYSCity> GetAllCity(FxtAPIClientExtend _fxtApi = null)
        {
            List <FxtApi_SYSCity> list   = new List <FxtApi_SYSCity>();
            FxtAPIClientExtend    fxtApi = new FxtAPIClientExtend(_fxtApi);

            try
            {
                string name    = "GetAllCity";
                string jsonStr = Convert.ToString(EntranceApi.Entrance(name, "", _fxtApi: fxtApi));
                if (string.IsNullOrEmpty(jsonStr))
                {
                    fxtApi.Abort();
                    return(null);
                }
                list = FxtApi_SYSCity.ConvertToObjList(jsonStr);
                fxtApi.Abort();
            }
            catch (Exception ex)
            {
                fxtApi.Abort();
                log.Error("GetAllCity()", ex);
            }
            return(list);
        }