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(); }
private void bindData() { List <SearchResults> results = FacilityManagementSystem.getAPIData(txtName.Text); DataTable dt = new DataTable(); dt.Columns.Add("Building"); dt.Columns.Add("Address"); dt.Columns.Add("Postal"); dt.Columns.Add("x"); dt.Columns.Add("y"); if (results != null) { for (int i = 0; i < results.Count; i++) { dt.Rows.Add(); dt.Rows[i]["Building"] = results.ElementAt(i).building; dt.Rows[i]["Address"] = results.ElementAt(i).address; dt.Rows[i]["Postal"] = results.ElementAt(i).postal; dt.Rows[i]["x"] = results.ElementAt(i).x; dt.Rows[i]["y"] = results.ElementAt(i).y; } } grdFacilities.DataSource = dt; grdFacilities.DataBind(); confirmPopup.Show(); }