/// <summary> /// 获取区县列表 /// </summary> /// <param name="cityCode"></param> /// <returns></returns> public static string getDistinceOptions(string cityCode) { BLL.t_distinct pbll = new BLL.t_distinct(); DataTable dt = pbll.GetList("cityCode='" + cityCode + "'").Tables[0]; StringBuilder sb = new StringBuilder(); sb.Append("<option value='0'>请选择</option>"); foreach (DataRow dr in dt.Rows) { sb.AppendFormat("<option value='{0}'>{1}</option>", dr["code"].ToString(), dr["name"].ToString()); } return sb.ToString(); }
/// <summary> /// 根据编码获取地名 /// </summary> /// <param name="addressNo"></param> /// <returns></returns> public static string getAddressNoString(string addressNo) { BLL.t_province pbll = new BLL.t_province(); BLL.t_city cbll = new BLL.t_city(); BLL.t_distinct dbll = new BLL.t_distinct(); string provinceString = pbll.GetList("code='" + addressNo.Substring(0, 2) + "0000'").Tables[0].Rows[0]["name"].ToString(); string cityString = cbll.GetList("code='" + addressNo.Substring(0, 4) + "00'").Tables[0].Rows[0]["name"].ToString(); string distinctString = dbll.GetList("code='" + addressNo + "'").Tables[0].Rows[0]["name"].ToString(); string result = provinceString + " " + cityString + " " + distinctString; return result; }