/// <summary> /// Gets the union city list base. /// </summary> /// <param name="str">The STR.</param> /// <returns></returns> public List <iPow.Application.Union.Dto.UnionCityDto> GetUnionCityListBase(string str) { List <iPow.Application.Union.Dto.UnionCityDto> unionCityList = null; iPow.Application.Union.Dto.UnionCityDto city = null; if (!string.IsNullOrEmpty(str)) { try { unionCityList = new List <iPow.Application.Union.Dto.UnionCityDto>(); Newtonsoft.Json.Linq.JArray ja = Newtonsoft.Json.JsonConvert.DeserializeObject(str) as Newtonsoft.Json.Linq.JArray; foreach (var item in ja) { city = new iPow.Application.Union.Dto.UnionCityDto(); city.citypy = item["citypy"] == null ? string.Empty : item["citypy"].ToString(); city.id = item["id"] == null ? -1 : int.Parse(item["id"].ToString()); city.name = item["name"] == null ? string.Empty : item["name"].ToString(); city.p_name = item["p_name"] == null ? string.Empty : item["p_name"].ToString(); city.pid = item["pid"] == null ? -1 : int.Parse(item["pid"].ToString()); city.total = item["total"] == null ? -1 : int.Parse(item["total"].ToString()); unionCityList.Add(city); System.Diagnostics.Debug.WriteLine(item["name"]); } } catch (Exception ex) { } } return(unionCityList); }
/// <summary> /// Gets the union city list base. /// </summary> /// <param name="str">The STR.</param> /// <returns></returns> public List<iPow.Application.Union.Dto.UnionCityDto> GetUnionCityListBase(string str) { List<iPow.Application.Union.Dto.UnionCityDto> unionCityList = null; iPow.Application.Union.Dto.UnionCityDto city = null; if (!string.IsNullOrEmpty(str)) { try { unionCityList = new List<iPow.Application.Union.Dto.UnionCityDto>(); Newtonsoft.Json.Linq.JArray ja = Newtonsoft.Json.JsonConvert.DeserializeObject(str) as Newtonsoft.Json.Linq.JArray; foreach (var item in ja) { city = new iPow.Application.Union.Dto.UnionCityDto(); city.citypy = item["citypy"] == null ? string.Empty : item["citypy"].ToString(); city.id = item["id"] == null ? -1 : int.Parse(item["id"].ToString()); city.name = item["name"] == null ? string.Empty : item["name"].ToString(); city.p_name = item["p_name"] == null ? string.Empty : item["p_name"].ToString(); city.pid = item["pid"] == null ? -1 : int.Parse(item["pid"].ToString()); city.total = item["total"] == null ? -1 : int.Parse(item["total"].ToString()); unionCityList.Add(city); System.Diagnostics.Debug.WriteLine(item["name"]); } } catch (Exception ex) { } } return unionCityList; }