Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ActionResult Index() {
- VerifyUserModel user = new VerifyUserModel();
- user.UserName = "Kenneth Baleda";
- user.AccountLevel = "MGR";
- foreach (string w in a.Companies.Where(x => x.IsActive == "Active").Where(x => x.CompanyName != "tbd").Where(x => x.FullCompanyName != "Test")
- .Where(x => x.FullCompanyName != "")
- .Select(x => x.Address).ToArray())
- {
- user.CompanyAddress = w;
- var location = new GoogleLocationService();
- var point = location.GetLatLongFromAddress(w);
- user.Latitude = point.Latitude;
- user.Longtitude = point.Longitude;
- }
- return View(user);
- }
- public class VerifyUserModel
- {
- public string UserName { get; set; }
- public string AccountLevel { get; set; }
- public double Latitude { get; set; }
- public double Longtitude { get; set; }
- public string CompanyAddress { get; set; }
- }
- @foreach (var place in Model)
- {
- <text>
- var latlng = new google.maps.LatLng(@Model.Latitude, @Model.Longtitude);
- var marker = new google.maps.Marker({
- position: latlng,
- map: map,
- title: 'Latitude: ' + latlng.Ya + ' Longitude :' + latlng.Za,
- draggable: true,
- icon: image
- });
- infoWindow = new google.maps.InfoWindow({
- content:"-- Test Address --"
- });
- infoWindow.open(map, marker);
- geocoder = new google.maps.Geocoder();
- //Update postal address when the marker is dragged
- google.maps.event.addListener(marker, 'click', function () { //dragend
- geocoder.geocode({ latLng: marker.getPosition() }, function (responses) {
- if (responses && responses.length > 0) {
- infoWindow.setContent(
- "<div style="font-size:smaller;">" + responses[0].formatted_address
- + "<br />"
- + "Latitude: " + marker.getPosition().lat() + " "
- + "Longitude: " + marker.getPosition().lng() + "</div>"
- );
- infoWindow.open(map, marker);
- } else {
- alert('Error: Google Maps could not determine the address of this location.');
- }
- });
- map.panTo(marker.getPosition());
- });
- // Close the marker window when being dragged
- google.maps.event.addListener(marker, 'dragstart', function () {
- infoWindow.close(map, marker);
- });
- </text>
- }
Add Comment
Please, Sign In to add comment