/// <summary> /// 获取公司常用国家省份城市县区 /// </summary> /// <param name="companyId">公司编号</param> /// <returns></returns> IList <MSysCountry> GetAllCity(string companyId) { if (string.IsNullOrEmpty(companyId)) { return(null); } //缓存中存在数据,则缓存中获取,否则表里获取,再添加到缓存 string cacheName = string.Format(EyouSoft.Cache.Tag.TagName.ComCity, companyId); IList <MSysCountry> list = (IList <MSysCountry>)EyouSoft.Cache.Facade.EyouSoftCache.GetCache(cacheName); if (list == null) { list = dal.GetAllCity(companyId); if (list != null && list.Count > 0) { EyouSoft.Cache.Facade.EyouSoftCache.Add(cacheName, list); } else { list = new EyouSoft.BLL.SysStructure.BGeography().GetAllList(); } } return(list); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string getType = Utils.GetQueryStringValue("get"); StringBuilder sb = new StringBuilder(); int gID = Utils.GetInt(Utils.GetQueryStringValue("gid")); int pID = Utils.GetInt(Utils.GetQueryStringValue("pid")); int cID = Utils.GetInt(Utils.GetQueryStringValue("cid")); int xID = Utils.GetInt(Utils.GetQueryStringValue("xid")); string companyID = Utils.GetQueryStringValue("companyID"); EyouSoft.BLL.ComStructure.BComCity bll = new EyouSoft.BLL.ComStructure.BComCity(); switch (getType) { case "g": IList <EyouSoft.Model.SysStructure.MSysCountry> gList = new EyouSoft.BLL.SysStructure.BGeography().GetCountryByCom(companyID); if (gList != null && gList.Count > 0) { sb.Append("["); for (int i = 0; i < gList.Count; i++) { sb.Append("{id:'" + gList[i].CountryId.ToString() + "',name:'" + gList[i].Name + "'},"); } if (sb.Length > 1) { sb.Remove(sb.Length - 1, 1); } sb.Append("]"); } break; case "p": IList <EyouSoft.Model.SysStructure.MSysProvince> pList = bll.GetProvince(gID, companyID); if (pList != null && pList.Count > 0) { sb.Append("["); for (int i = 0; i < pList.Count; i++) { sb.Append("{id:'" + pList[i].ProvinceId.ToString() + "',name:'" + pList[i].Name + "'},"); } if (sb.Length > 1) { sb.Remove(sb.Length - 1, 1); } sb.Append("]"); } break; case "c": IList <EyouSoft.Model.SysStructure.MSysCity> cList = bll.GetCity(pID, companyID); if (cList != null && cList.Count > 0) { sb.Append("["); for (int i = 0; i < cList.Count; i++) { sb.Append("{id:'" + cList[i].CityId.ToString() + "',name:'" + cList[i].Name + "'},"); } if (sb.Length > 1) { sb.Remove(sb.Length - 1, 1); } sb.Append("]"); } break; case "x": IList <EyouSoft.Model.SysStructure.MSysDistrict> xList = bll.GetDistrict(cID, companyID); if (xList != null && xList.Count > 0) { sb.Append("["); for (int i = 0; i < xList.Count; i++) { sb.Append("{id:'" + xList[i].DistrictId.ToString() + "',name:'" + xList[i].Name + "'},"); } if (sb.Length > 1) { sb.Remove(sb.Length - 1, 1); } sb.Append("]"); } break; } context.Response.Write(sb.ToString()); }