Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(Request.QueryString["q"]))
            {
                return;
            }
            List <SearchResults> locations = FacilityManagementSystem.getAPIData(Uri.EscapeDataString(Request.QueryString["q"]));

            if (locations == null || locations.Count == 0)
            {
                return;
            }

            SearchResults   location   = locations[0];
            List <Facility> facilities = FacilityManagementSystem.SearchNearby(Decimal.Parse(location.x), Decimal.Parse(location.y));

            location_list = facilities.Select(f => Svy21.ComputeLatitudeLongitude((double)f.x, (double)f.y)).ToList();
            this.location = Svy21.ComputeLatitudeLongitude(Double.Parse(location.x), Double.Parse(location.y));
            var points = location_list.Concat(new[] { this.location });

            this.upperbound        = Tuple.Create(points.Select(p => p.Item1).Max(), points.Select(p => p.Item2).Max());
            this.lowerbound        = Tuple.Create(points.Select(p => p.Item1).Min(), points.Select(p => p.Item2).Min());
            listResults.DataSource = facilities;
            listResults.DataBind();
        }