public string DisplayAddress(string stateCode, string cityCode, string countyCode) { StateInfo stateEntity = null; CityInfo cityEntity = null; CountyInfo countyEntity = null; try { stateEntity = MyBLL.GetStateInfoByCode(stateCode); cityEntity = MyBLL.GetCityInfoByCode(cityCode); countyEntity = MyBLL.GetCountyInfoByCode(countyCode); } catch (Exception ex) { throw ex; } string strHTML = string.Empty; if (stateEntity != null) { strHTML = stateEntity.State_CN + " "; } if (cityEntity != null) { strHTML += cityEntity.City_CN + " "; } if (countyEntity != null) { strHTML += countyEntity.County_CN; } return(strHTML.ToString()); }
public string GetDeliveryWayDistricts() { int Delivery_Way_ID = tools.CheckInt(Request.QueryString["Delivery_Way_ID"]); IList <DeliveryWayDistrictInfo> entitys = MyBLL.GetDeliveryWayDistrictsByDWID(Delivery_Way_ID, Public.GetUserPrivilege()); if (entitys != null) { DeliveryWayInfo wayinfo = MyBLL.GetDeliveryWayByID(Delivery_Way_ID, Public.GetUserPrivilege()); StateInfo stateEntity = null; CityInfo cityEntity = null; CountyInfo countyEntity = null; StringBuilder jsonBuilder = new StringBuilder(); jsonBuilder.Append("{\"page\":1,\"total\":1,\"records\":" + entitys.Count + ",\"rows\""); jsonBuilder.Append(":["); foreach (DeliveryWayDistrictInfo entity in entitys) { stateEntity = addrBLL.GetStateInfoByCode(entity.District_State); cityEntity = addrBLL.GetCityInfoByCode(entity.District_City); countyEntity = addrBLL.GetCountyInfoByCode(entity.District_County); jsonBuilder.Append("{\"DeliveryWayDistrictInfo.District_ID\":" + entity.District_ID + ",\"cell\":["); //各字段 jsonBuilder.Append("\""); jsonBuilder.Append(entity.District_ID); jsonBuilder.Append("\","); jsonBuilder.Append("\""); if (wayinfo == null) { jsonBuilder.Append(Delivery_Way_ID); } else { jsonBuilder.Append(wayinfo.Delivery_Way_Name); } jsonBuilder.Append("\","); jsonBuilder.Append("\""); if (entity.District_State == "0" || entity.District_State.Length == 0) { jsonBuilder.Append("全部"); } else { if (stateEntity == null) { jsonBuilder.Append(entity.District_State); } else { jsonBuilder.Append(stateEntity.State_CN); } } jsonBuilder.Append("\","); jsonBuilder.Append("\""); if (entity.District_City == "0" || entity.District_City.Length == 0) { jsonBuilder.Append("全部"); } else { if (cityEntity == null) { jsonBuilder.Append(entity.District_City); } else { jsonBuilder.Append(cityEntity.City_CN); } } jsonBuilder.Append("\","); jsonBuilder.Append("\""); if (entity.District_County == "0" || entity.District_County.Length == 0) { jsonBuilder.Append("全部"); } else { if (countyEntity == null) { jsonBuilder.Append(entity.District_County); } else { jsonBuilder.Append(countyEntity.County_CN); } } jsonBuilder.Append("\","); jsonBuilder.Append("\""); jsonBuilder.Append("<img src=\\\"/images/icon_edit.gif\\\" alt=\\\"修改\\\"> <a href=\\\"district_list.aspx?action=renew&delivery_way_id=" + Delivery_Way_ID + "&district_id=" + entity.District_ID + "\\\" title=\\\"修改\\\">修改</a> <img src=\\\"/images/icon_del.gif\\\" alt=\\\"删除\\\"> <a href=\\\"javascript:void(0);\\\" onclick=\\\"confirmdelete('district_do.aspx?action=move&delivery_way_id=" + Delivery_Way_ID + "&district_id=" + entity.District_ID + "')\\\" title=\\\"删除\\\">删除</a>"); jsonBuilder.Append("\","); jsonBuilder.Remove(jsonBuilder.Length - 1, 1); jsonBuilder.Append("]},"); } jsonBuilder.Remove(jsonBuilder.Length - 1, 1); jsonBuilder.Append("]"); jsonBuilder.Append("}"); return(jsonBuilder.ToString()); } else { return(null); } }