protected void Getlocationdetails(object sender, EventArgs e) { LocationServicesReference.Service1Client locationobject = new LocationServicesReference.Service1Client(); string locationdetails = locationobject.GetlocationdetailsAPI(locationtextbox.Text); string[] details = locationdetails.Split(','); longitudelabel.Text = details[1]; latitudelabel.Text = details[0]; zipcodelabel.Text = details[2]; return; }
protected void GetCrimedataOfthePlace(object sender, EventArgs e) { CrimeDataServices.Service1Client crimedataservicesobject = new CrimeDataServices.Service1Client(); LocationServicesReference.Service1Client locationservicesobject = new LocationServicesReference.Service1Client(); string[] latlong = locationservicesobject.GetlocationdetailsAPI(placetextbox.Text).Split(','); HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost:11098/Service1.svc/GetCrimeData?latitude=" + latlong[0] + "&longitude=" + latlong[1]); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); dynamic parsed_JSON = JsonConvert.DeserializeObject <dynamic>(new StreamReader(response.GetResponseStream()).ReadToEnd()); string[] data = Convert.ToString(parsed_JSON).Split(','); voilentcrimeslabel.Text = Convert.ToString(data[0]); propertycrimeslabel.Text = Convert.ToString(data[1]); return; }
protected void Getdistance(object sender, EventArgs e) { LocationServicesReference.Service1Client locationobject = new LocationServicesReference.Service1Client(); string origindetails = locationobject.GetlocationdetailsAPI(origintextbox.Text); string[] details = origindetails.Split(','); double lat1 = Convert.ToDouble(details[0]); double long1 = Convert.ToDouble(details[1]); string destinationdetails = locationobject.GetlocationdetailsAPI(destinationtextbox.Text); string[] details2 = destinationdetails.Split(','); double lat2 = Convert.ToDouble(details2[0]); double long2 = Convert.ToDouble(details2[1]); Distances.Service1Client distanceobject = new Distances.Service1Client(); string[] Distance = distanceobject.GetDistance(lat1, long1, lat2, long2); distancelabel.Text = "Distance Between " + origintextbox.Text + " and " + destinationtextbox.Text + " is " + Distance[0] + " Kilometers or<br>" + Distance[2] + " Miles"; return; }