Guest User

Untitled

a guest
Jun 25th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. public ActionResult Index() {
  2.  
  3. VerifyUserModel user = new VerifyUserModel();
  4. user.UserName = "Kenneth Baleda";
  5. user.AccountLevel = "MGR";
  6.  
  7. foreach (string w in a.Companies.Where(x => x.IsActive == "Active").Where(x => x.CompanyName != "tbd").Where(x => x.FullCompanyName != "Test")
  8. .Where(x => x.FullCompanyName != "")
  9. .Select(x => x.Address).ToArray())
  10. {
  11. user.CompanyAddress = w;
  12. var location = new GoogleLocationService();
  13. var point = location.GetLatLongFromAddress(w);
  14.  
  15. user.Latitude = point.Latitude;
  16. user.Longtitude = point.Longitude;
  17. }
  18.  
  19. return View(user);
  20. }
  21.  
  22. public class VerifyUserModel
  23. {
  24. public string UserName { get; set; }
  25.  
  26. public string AccountLevel { get; set; }
  27.  
  28. public double Latitude { get; set; }
  29.  
  30. public double Longtitude { get; set; }
  31.  
  32. public string CompanyAddress { get; set; }
  33. }
  34.  
  35. @foreach (var place in Model)
  36. {
  37. <text>
  38. var latlng = new google.maps.LatLng(@Model.Latitude, @Model.Longtitude);
  39. var marker = new google.maps.Marker({
  40. position: latlng,
  41. map: map,
  42. title: 'Latitude: ' + latlng.Ya + ' Longitude :' + latlng.Za,
  43. draggable: true,
  44. icon: image
  45. });
  46. infoWindow = new google.maps.InfoWindow({
  47. content:"-- Test Address --"
  48. });
  49. infoWindow.open(map, marker);
  50. geocoder = new google.maps.Geocoder();
  51. //Update postal address when the marker is dragged
  52. google.maps.event.addListener(marker, 'click', function () { //dragend
  53. geocoder.geocode({ latLng: marker.getPosition() }, function (responses) {
  54. if (responses && responses.length > 0) {
  55. infoWindow.setContent(
  56. "<div style="font-size:smaller;">" + responses[0].formatted_address
  57. + "<br />"
  58. + "Latitude: " + marker.getPosition().lat() + "&nbsp"
  59. + "Longitude: " + marker.getPosition().lng() + "</div>"
  60. );
  61. infoWindow.open(map, marker);
  62. } else {
  63. alert('Error: Google Maps could not determine the address of this location.');
  64. }
  65. });
  66. map.panTo(marker.getPosition());
  67. });
  68. // Close the marker window when being dragged
  69. google.maps.event.addListener(marker, 'dragstart', function () {
  70. infoWindow.close(map, marker);
  71. });
  72. </text>
  73. }
Add Comment
Please, Sign In to add comment