Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string GetGetKeyVauleDatas(HttpContext context)
        {
            string type   = context.Request["type"];   //类型
            string preKey = context.Request["prekey"]; //上级

            List <KeyVauleDataInfo> keyVaules = new List <KeyVauleDataInfo>();

            int totoalCount = 0;

            if (type == "province")// 省份
            {
                keyVaules = bllKeyValueData.GetProvinces(out totoalCount);
            }
            else if (type == "city")// 城市
            {
                keyVaules = bllKeyValueData.GetCitys(preKey, out totoalCount);
            }
            else if (type == "district")// 区域
            {
                keyVaules = bllKeyValueData.GetDistricts(preKey, out totoalCount);
            }

            var result = from p in keyVaules
                         select new
            {
                id   = p.DataKey,
                name = p.DataValue
            };

            return(Common.JSONHelper.ObjectToJson(new
            {
                totalcount = totoalCount,
                list = result
            }));
        }