Exemplo n.º 1
0
        /// <summary>
        /// Get PopupHtml by Code
        /// </summary>
        /// <param name="Code">Code of City or District or Ward</param>
        /// <returns>Html of Popup Info : Country,City,District,Ward</returns>
        public string GetPopupHtmlByCode(string Code)
        {
            string html = "<div class='toggle-detail-property'><span class='glyphicon glyphicon-remove' id='close-popup'></span></div><div class='detail-property-header'><span>Thông tin</span></div><div class='detail-property-content'><div class='section section-info'><div class='item' data-code='null'><table class='table'><thead><tr><td colspan='2' style='font-weight:bold;'><span class='glyphicon glyphicon-tag'></span> Thông tin sơ lược</td></tr></thead><tbody><tr><td>Quốc gia</td><td>Việt Nam</td></tr>";

            if (Code.Length == 12)
            {
                InfoPointViewModel infoPoint = GetInfoPointByWardCode(Code);
                html += $"<tr><td>Tỉnh/Thành phố</td><td>{infoPoint.City}</td></tr><tr><td>Quận/Huyện</td><td>{infoPoint.District}</td></tr><tr><td>Xã/Phường</td><td>{infoPoint.Ward}</td></tr>";
                return(html);
            }
            if (Code.Length == 9)
            {
                string District = GetDistrictByWardCode(Code + "000");
                string City     = GetCityByWardCode(Code + "000");
                html += $"<tr><td>Tỉnh/Thành phố</td><td>{City}</td></tr><tr><td>Quận/Huyện</td><td>{District}</td></tr>";
                return(html);
            }
            if (Code.Length == 6)
            {
                string City = GetCityByWardCode(Code + "000000");
                html += $"<tr><td>Tỉnh/Thành phố</td><td>{City}</td></tr>";
                return(html);
            }
            return(html + "</tbody></table></div></div></div>");
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get InfoPoint by LatLng
        /// </summary>
        /// <param name="lat"></param>
        /// <param name="lng"></param>
        /// <returns></returns>
        public JsonResult GetDetailByLatLng(string lat, string lng, string optimizeValue = "true")
        {
            InfoPointViewModel details = null;
            long timeQuery             = 0;

            if (optimizeValue.Equals("true"))
            {
                details = polygonDetail.GetInfoPointByLatLngOptimize(lat, lng, out timeQuery);
            }
            else
            {
                details = polygonDetail.GetInfoPointByLatLngUnOptimize(lat, lng, out timeQuery);
            }
            return(Json(new
            {
                details,
                timeQuery
            }, JsonRequestBehavior.AllowGet));
        }