public object GetRegion(string fromLatLng = "")
        {
            string address   = string.Empty;
            string province  = string.Empty;
            string city      = string.Empty;
            string district  = string.Empty;
            string street    = string.Empty;
            string str       = string.Empty;
            string newStreet = string.Empty;

            ShopbranchHelper.GetAddressByLatLng(fromLatLng, ref address, ref province, ref city, ref district, ref street);
            if (district == "" && street != "")
            {
                district = street;
                street   = "";
            }
            string addressComponents = RegionApplication.GetAddress_Components(city, district, street, out newStreet);

            if (addressComponents.Split(',').Length <= 3)
            {
                newStreet = string.Empty;
            }
            return((object)this.Json(new
            {
                fullPath = addressComponents,
                showCity = string.Format("{0} {1} {2}", (object)province, (object)city, (object)district),
                street = newStreet
            }));
        }
示例#2
0
        /// <summary>
        /// 根据搜索地址反向匹配出区域信息
        /// </summary>
        /// <param name="fromLatLng"></param>
        /// <returns></returns>
        public object GetRegion(string fromLatLng = "")
        {
            string address = string.Empty, province = string.Empty, city = string.Empty, district = string.Empty, street = string.Empty, fullPath = string.Empty, newStreet = string.Empty;

            ShopbranchHelper.GetAddressByLatLng(fromLatLng, ref address, ref province, ref city, ref district, ref street);
            if (district == "" && street != "")
            {
                district = street;
                street   = "";
            }
            fullPath = RegionApplication.GetAddress_Components(city, district, street, out newStreet);
            if (fullPath.Split(',').Length <= 3)
            {
                newStreet = string.Empty;                                 //如果无法匹配街道,则置为空
            }
            return(Json(new { fullPath = fullPath, showCity = string.Format("{0} {1} {2}", province, city, district), street = newStreet }));
        }
示例#3
0
        public ActionResult InitRegion(string fromLatLng)
        {
            string address = string.Empty, province = string.Empty, city = string.Empty, district = string.Empty, street = string.Empty, newStreet = string.Empty;

            ShopbranchHelper.GetAddressByLatLng(fromLatLng, ref address, ref province, ref city, ref district, ref street);
            if (district == "" && street != "")
            {
                district = street;
                street   = "";
            }
            string fullPath = RegionApplication.GetAddress_Components(city, district, street, out newStreet);

            if (fullPath.Split(',').Length <= 3)
            {
                newStreet = string.Empty;                                 //如果无法匹配街道,则置为空
            }
            return(SuccessResult <dynamic>(data: new { fullPath = fullPath, showCity = string.Format("{0} {1} {2} {3}", province, city, district, newStreet), street = newStreet }));
        }
示例#4
0
        public ActionResult InitRegion(string fromLatLng)
        {
            string address   = string.Empty;
            string province  = string.Empty;
            string city      = string.Empty;
            string district  = string.Empty;
            string street    = string.Empty;
            string newStreet = string.Empty;

            ShopbranchHelper.GetAddressByLatLng(fromLatLng, ref address, ref province, ref city, ref district, ref street);
            if ((district == "") && (street != ""))
            {
                district = street;
                street   = "";
            }
            string str7 = RegionApplication.GetAddress_Components(city, district, street, out newStreet);

            if (str7.Split(new char[] { ',' }).Length <= 3)
            {
                newStreet = string.Empty;
            }
            return(base.Json(new { fullPath = str7, showCity = string.Format("{0} {1} {2}", province, city, district), street = newStreet }, JsonRequestBehavior.AllowGet));
        }