protected void Submit_Click(object sender, EventArgs e) { locator.locate find = new locator.locate(); string q = txtblood.Text; string r = txtZip.Text; string ab = find.locate0(r, q); string bc = find.locate1(r, q); string cd = find.locate2(r, q); string de = find.counting(r, q); Label1.Text = de; string address = ab + "," + bc + "," + cd + "," + r; string latitude1 = ""; string longitude1 = ""; // Response.Redirect("http://where.yahooapis.com/geocode?location=" +address ); XmlTextReader xtr = new XmlTextReader("http://where.yahooapis.com/geocode?location=" + address); xtr.WhitespaceHandling = WhitespaceHandling.Significant; //Response.Write(xtr.ToString()); try { while (xtr.Read()) { if (xtr.Name.ToString() == "latitude") { latitude1 = xtr.ReadString().ToString(); } if (xtr.Name.ToString() == "longitude") { longitude1 = xtr.ReadString().ToString(); } } GMap2.addGMapUI(new GMapUI()); GMapUIOptions options = new GMapUIOptions(); GLatLng latlong = new GLatLng(double.Parse(latitude1), double.Parse(longitude1)); GMapType.GTypes maptype = GMapType.GTypes.Normal; GMap2.setCenter(latlong, 15, maptype); //GMap2.GZoom = 9; PinLetter pinLetter = new PinLetter("o", Color.Red, Color.Black); GMap2.addGMarker(new GMarker(latlong, new GMarkerOptions(new GIcon(pinLetter.ToString(), pinLetter.Shadow())))); GMarker marker = new GMarker(latlong); GInfoWindowOptions IWoptions = new GInfoWindowOptions(12, maptype); GInfoWindow mbUp = new GInfoWindow(marker, address, IWoptions); GMap2.addInfoWindow(mbUp); } catch (Exception) { Response.Write("invalid adress"); } }
protected void Page_Load(object sender, EventArgs e) { GLatLng latlng = new GLatLng(41, -3.2); GMap1.setCenter(latlng, 5); PinLetter pinLetter = new PinLetter("A", Color.Yellow, Color.Black); XPinLetter xPinLetter = new XPinLetter(PinShapes.pin_star, "B", Color.Blue, Color.White, Color.Chocolate); PinIcon pinIcon = new PinIcon(PinIcons.home, Color.Cyan); XPinIcon xPinIcon = new XPinIcon(PinShapes.pin, PinIcons.home, Color.LightGreen, Color.BlueViolet); SPin sPin = new SPin(0.5, -10, Color.Green, 8, PinFontStyle.normal, "C"); GMap1.Add(new GMarker(latlng, new GMarkerOptions(new GIcon(pinLetter.ToString(), pinLetter.Shadow())))); GMap1.Add(new GMarker(latlng + new GLatLng(2, 2), new GMarkerOptions(new GIcon(xPinLetter.ToString(), xPinLetter.Shadow())))); GMap1.Add(new GMarker(latlng + new GLatLng(2, -2), new GMarkerOptions(new GIcon(pinIcon.ToString(), pinIcon.Shadow())))); GMap1.Add(new GMarker(latlng + new GLatLng(-2, 2), new GMarkerOptions(new GIcon(xPinIcon.ToString(), xPinIcon.Shadow())))); GMap1.Add(new GMarker(latlng + new GLatLng(-2, -2), new GMarkerOptions(new GIcon(sPin.ToString())))); }
protected void btnViewStore_Click(object sender, EventArgs e) { Storewebservice.StoredetailsService st = new Storewebservice.StoredetailsService(); Storewebservice.Storedetails details = st.getstoredetails(txtStore.Text); lblStorename.Text = details.method_storename; lblst.Text = details.method_storestreet; lblstorecity.Text = details.method_storecity; lblstoreZip.Text = details.method_storezip; lblPhnum.Text = details.method_storephone; //string address = details.method_storestreet+", " +details.method_storecity + "," + details.method_storezip; string address = "63rd and holmes, Kansas City, Missouri"; string latitude1 = ""; string longitude1 = ""; // Response.Redirect("http://where.yahooapis.com/geocode?location=" +address ); XmlTextReader xtr = new XmlTextReader("http://where.yahooapis.com/geocode?location=" + address); xtr.WhitespaceHandling = WhitespaceHandling.Significant; //Response.Write(xtr.ToString()); try { while (xtr.Read()) { if (xtr.Name.ToString() == "latitude") { latitude1 = xtr.ReadString().ToString(); } if (xtr.Name.ToString() == "longitude") { longitude1 = xtr.ReadString().ToString(); } } lblLat.Text = latitude1; lblLong.Text = longitude1; GMap1.addGMapUI(new GMapUI()); GMapUIOptions options = new GMapUIOptions(); GLatLng latlong = new GLatLng(double.Parse(latitude1), double.Parse(longitude1)); GMapType.GTypes maptype = GMapType.GTypes.Normal; GMap1.setCenter(latlong, 15, maptype); //GMap1.GZoom = 9; PinLetter pinLetter = new PinLetter("Y", Color.Yellow, Color.Black); GMap1.addGMarker(new GMarker(latlong, new GMarkerOptions(new GIcon(pinLetter.ToString(), pinLetter.Shadow())))); GMarker marker = new GMarker(latlong); GInfoWindowOptions IWoptions = new GInfoWindowOptions(12, maptype); GInfoWindow mbUp = new GInfoWindow(marker, address, IWoptions); GMap1.addInfoWindow(mbUp); //GMarker gm = new GMarker(latlong); //GMap1.addGMarker(gm); // GMap1.addControl(new GControl(GControl.extraBuilt.MarkCenter)); //GMap1.addControl(new GControl(GControl.extraBuilt.TextualCoordinatesControl)); // Response.Redirect("http://maps.google.com/?q=" + latitude1 + "," + longitude1); } catch (Exception) { Response.Write("invalid adress"); } }
private void BindData(SelectedHotelsEntities db, GLatLng point, double distance) { int?hotelTypeId = null; if (Settings["hoteltype"] != null) { hotelTypeId = Convert.ToInt32(Settings["hoteltype"]); } var location = DbGeography.FromText(String.Format("POINT({0} {1})", point.lng, point.lat)); var hotels = from hotel in db.Products.Where(p => !p.IsDeleted).OfType <Hotel>() let dist = hotel.Location.Distance(location) * .00062 where !hotel.IsDeleted && hotel.Location != null && hotel.Location.Latitude != null && hotel.Location.Longitude != null && dist <= distance && (hotelTypeId == null || hotel.HotelTypeId == hotelTypeId) select new HotelView { Id = hotel.Id, Name = hotel.Name, Number = hotel.Number, UnitCost = hotel.UnitCost, Description = hotel.Description, URL = hotel.URL, Image = hotel.Image, ExtraDescription = hotel.ExtraDescription, CurrencyCode = hotel.CurrencyCode, Rooms = hotel.Rooms, Star = hotel.Star, CustomerRating = hotel.CustomerRating, Address = hotel.Address, PostCode = hotel.PostCode, Location = hotel.Location, Distance = dist, GeoName = hotel.GeoName }; if (Session["filter"] != null) { hotels = hotels.Where( p => p.Name.ToLower().Contains(TextBoxFilter.Text.ToLower()) || p.Description.ToLower().Contains(TextBoxFilter.Text.ToLower())); LabelFilteredBy.Text = String.Format("and filtered by \"{0}\"", TextBoxFilter.Text); LabelFilteredBy.Visible = true; ButtonClearFilter.Visible = true; } else { LabelFilteredBy.Visible = false; ButtonClearFilter.Visible = false; } List <HotelView> hotelList = null; Enums.SortCriteriaEnum sortCriteria = (Enums.SortCriteriaEnum)Enum.Parse(typeof(Enums.SortCriteriaEnum), DropDownListSortCriterias.SelectedValue); switch (sortCriteria) { case Enums.SortCriteriaEnum.Name: hotels = hotels.OrderBy(h => h.Name); break; case Enums.SortCriteriaEnum.PriceAsc: hotels = hotels.OrderBy(h => h.UnitCost); break; case Enums.SortCriteriaEnum.PriceDesc: hotels = hotels.OrderByDescending(h => h.UnitCost); break; case Enums.SortCriteriaEnum.RatingAsc: hotels = hotels.OrderBy(h => h.Star); break; case Enums.SortCriteriaEnum.RatingDesc: hotels = hotels.OrderByDescending(h => h.Star); break; case Enums.SortCriteriaEnum.DistanceAsc: hotels = hotels.OrderBy(h => h.Distance); break; case Enums.SortCriteriaEnum.DistanceDesc: hotels = hotels.OrderByDescending(h => h.Distance); break; } ListViewContent.DataSource = hotels.ToList(); ListViewContent.DataBind(); var count = hotels.Count(); DataPagerContent.Visible = count > DataPagerContent.PageSize; DataPagerContent2.Visible = count > DataPagerContent2.PageSize; LabelCount.Text = count.ToString(); int i = DataPagerContent.StartRowIndex + 1; foreach (var hotel in hotels.Skip(DataPagerContent.StartRowIndex).Take(DataPagerContent.PageSize)) { GLatLng gLatLng = new GLatLng(hotel.Location.Latitude.Value, hotel.Location.Longitude.Value); PinLetter pinLetter = new PinLetter(i.ToString(), Color.FromArgb(0xB4, 0x97, 0x59), Color.Black); var markerOptions = new GMarkerOptions(new GIcon(pinLetter.ToString(), pinLetter.Shadow()), hotel.Name.Replace("'", "´")); GMarker marker = new GMarker(gLatLng, markerOptions); StringBuilder sb = new StringBuilder(); sb.Append(hotel.Name); sb.AppendFormat("<br />Address: {0}", hotel.Address); GInfoWindow window = new GInfoWindow(marker, sb.ToString(), false); locationGMap.addInfoWindow(window); i++; } }