• Voor Beauty Professionals
  • Besteld voor 12u00, volgende dag geleverd
  • Gratis levering boven 200 euro
  • Veilig betalen
Error executing template "Designs/ProNails_generated/Paragraph/PoiUserDetails.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_c8c58d3a44894904838b71ca9a9dc1c2.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\pronails.cloud.dynamicweb-cms.com\files\Templates\Designs\ProNails_generated\Paragraph\PoiUserDetails.cshtml:line 64
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using System.Web; 3 @using System.Xml.Linq; 4 @using System.Device.Location; 5 @using Dynamicweb; 6 @using Dynamicweb.Content.Items; 7 @using Dynamicweb.Configuration; 8 @using Dynamicweb.Security.UserManagement; 9 @using Dynamicweb.Configuration; 10 @using Dynamicweb.Ecommerce.International; 11 @using Bluedesk.DynamicWeb.ItemTypes.Poi; 12 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 13 14 15 @{ 16 PoiUserDetails _data = ItemManager.Storage.GetById<PoiUserDetails>(Pageview.CurrentParagraph.ItemId ?? "0"); 17 var googlemapsAPI = Pageview.Area.Item["FrontendGoogleMapsApiKey"]?.ToString() ?? ""; 18 var countryService = new CountryService(); 19 20 string markerIcon = _data.MarkerIcon; 21 int mapZoom = _data.Zoom; 22 bool disableDefaultUI = _data.disableDefaultUI; 23 bool enableZoomControl = _data.enableZoomControl; 24 25 string userId = HttpContext.Current.Request.QueryString.Get("User") != null ? HttpContext.Current.Request.QueryString.Get("User") : ""; 26 User poiUser = !string.IsNullOrWhiteSpace(userId) ? Dynamicweb.Security.UserManagement.User.GetUserByID(int.Parse(userId)) : null; 27 bool isPoiGroup = poiUser != null ? poiUser.Groups.Any(g => g.CustomFieldValues.FirstOrDefault(c => c.CustomField.SystemName == "AccessUser_POI_Group")?.Value?.ToString() == "True") : false; 28 29 if (poiUser != null && !string.IsNullOrWhiteSpace(poiUser.CustomFieldValues.FirstOrDefault(c => c.CustomField.SystemName == "AccessUser_Poi_locator_name")?.Value?.ToString())) 30 { 31 poiUser.Name = poiUser.CustomFieldValues.FirstOrDefault(c => c.CustomField.SystemName == "AccessUser_Poi_locator_name")?.Value?.ToString(); 32 } 33 if (poiUser != null && !string.IsNullOrWhiteSpace(poiUser.CustomFieldValues.FirstOrDefault(c => c.CustomField.SystemName == "AccessUser_Poi_locator_address")?.Value?.ToString())) 34 { 35 poiUser.Address = poiUser.CustomFieldValues.FirstOrDefault(c => c.CustomField.SystemName == "AccessUser_Poi_locator_address")?.Value?.ToString(); 36 } 37 if (poiUser != null && !string.IsNullOrWhiteSpace(poiUser.CustomFieldValues.FirstOrDefault(c => c.CustomField.SystemName == "AccessUser_Poi_locator_number")?.Value?.ToString())) 38 { 39 poiUser.HouseNumber = poiUser.CustomFieldValues.FirstOrDefault(c => c.CustomField.SystemName == "AccessUser_Poi_locator_number")?.Value?.ToString(); 40 } 41 if (poiUser != null && !string.IsNullOrWhiteSpace(poiUser.CustomFieldValues.FirstOrDefault(c => c.CustomField.SystemName == "AccessUser_Poi_locator_zipcode")?.Value?.ToString())) 42 { 43 poiUser.Zip = poiUser.CustomFieldValues.FirstOrDefault(c => c.CustomField.SystemName == "AccessUser_Poi_locator_zipcode")?.Value?.ToString(); 44 } 45 if (poiUser != null && !string.IsNullOrWhiteSpace(poiUser.CustomFieldValues.FirstOrDefault(c => c.CustomField.SystemName == "AccessUser_Poi_locator_city")?.Value?.ToString())) 46 { 47 poiUser.City = poiUser.CustomFieldValues.FirstOrDefault(c => c.CustomField.SystemName == "AccessUser_Poi_locator_city")?.Value?.ToString(); 48 } 49 if (poiUser != null && !string.IsNullOrWhiteSpace(poiUser.CustomFieldValues.FirstOrDefault(c => c.CustomField.SystemName == "AccessUser_Poi_locator_zipcode")?.Value?.ToString())) 50 { 51 GeoCoordinate alternativeGeoLocation = GetGeoLocationByAdress($"{poiUser.Address} {poiUser.HouseNumber} {poiUser.Zip} { poiUser.City}"); 52 poiUser.GeolocationLatitude = alternativeGeoLocation.Latitude; 53 poiUser.GeolocationLongitude = alternativeGeoLocation.Longitude; 54 } 55 56 if(poiUser != null) { 57 if(!string.IsNullOrWhiteSpace(Pageview.Page.MetaTitle)) { 58 Pageview.Meta.Title = Pageview.Page.MetaTitle.Replace("{0}", poiUser.Name); 59 } else { 60 Pageview.Meta.Title = $"{Pageview.Page.MenuText} - {poiUser.Name}"; 61 } 62 } 63 64 string geolocationLatitude = poiUser.GeolocationLatitude.ToString().Replace(",", "."); 65 string geolocationLongitude = poiUser.GeolocationLongitude.ToString().Replace(",", "."); 66 67 } 68 69 <div> 70 71 @SnippetStart("GoogleMapsScript") 72 @if(!string.IsNullOrWhiteSpace(googlemapsAPI)) 73 { 74 <script src="https://maps.googleapis.com/maps/api/js?key=@googlemapsAPI"></script> 75 } 76 @SnippetEnd("GoogleMapsScript") 77 78 <div class="userpoidetail" data-lat="@geolocationLatitude" data-lng="@poiUser.GeolocationLongitude"> 79 @if(poiUser != null && isPoiGroup) 80 { 81 string userDescription = poiUser.CustomFieldValues.FirstOrDefault(c => c.CustomField.SystemName == "AccessUser_Description").Value.ToString(); 82 string userWebsite = poiUser.CustomFieldValues.FirstOrDefault(c => c.CustomField.SystemName == "AccessUser_Website").Value.ToString(); 83 string countryName = !string.IsNullOrWhiteSpace(poiUser.Country) ? countryService.GetCountry(poiUser.Country) != null ? countryService.GetCountry(poiUser.Country).Name : poiUser.Country : poiUser.Country; 84 85 <div class="container userpoidetail__row"> 86 <section class="userpoidetail__info"> 87 <h1 class="userpoidetail__name">@poiUser.Name</h1> 88 89 @if(!string.IsNullOrWhiteSpace(userDescription)) 90 { 91 <div class="userpoidetail__description"> 92 <p>@userDescription</p> 93 </div> 94 } 95 96 <div class="userpoidetail__address"> 97 <h3>@Translate("UserDetailPoi.Address", "Address")</h3> 98 <p>@poiUser.Address @poiUser.HouseNumber</p> 99 <p>@poiUser.Zip @poiUser.City</p> 100 <p>@countryName</p> 101 </div> 102 103 <div class="userpoidetail__contact"> 104 <h3>@Translate("UserDetailPoi.Contact", "Contact")</h3> 105 @if(!string.IsNullOrWhiteSpace(poiUser.Email)) 106 { 107 <p><strong>@Translate("UserDetailPoi.Email", "Email:")</strong> <a href="mailto:@poiUser.Email">@poiUser.Email</a></p> 108 } 109 @if(!string.IsNullOrWhiteSpace(poiUser.Phone)) 110 { 111 <p><strong>@Translate("UserDetailPoi.Phone", "Phone:")</strong> <a href="tel:@poiUser.Phone">@poiUser.Phone</a></p> 112 } 113 @if(!string.IsNullOrWhiteSpace(userWebsite)) 114 { 115 <p><strong>@Translate("UserDetailPoi.Website", "Website"):</strong> <a href="@userWebsite">@userWebsite</a></p> 116 } 117 </div> 118 </section> 119 <section class="userpoidetail__map"> 120 <div id="map-@userId" data-latitude="@geolocationLatitude" data-longitude="@poiUser.GeolocationLongitude" data-markericon="@markerIcon" data-zoom="@mapZoom" data-disableui="@disableDefaultUI" data-enablezoom="@enableZoomControl" class="poi-map"></div> 121 </section> 122 </div> 123 } 124 </div> 125 </div> 126 127 @functions { 128 private static GeoCoordinate GetGeoLocationByAdress(string address) 129 { 130 // Get Google Maps API key from Settings > Control Panel > Maps 131 // Geocoding API needs to be activated for API key 132 var googlemapsAPI = SystemConfiguration.Instance.GetValue("/Globalsettings/Settings/GoogleMaps/GoogleMapsAPIKey"); 133 134 if (!string.IsNullOrWhiteSpace(googlemapsAPI)) 135 { 136 var geoxml = XDocument.Load("https://maps.google.com/maps/api/geocode/xml" + "?address=" + HttpUtility.UrlEncode(address) + "&sensor=false&key=" + googlemapsAPI); 137 138 if (geoxml.Descendants("result").Descendants("geometry").Descendants("location").Any()) 139 { 140 // Use LINQ to XML to extract the geocode values from the returned XML 141 var location = from part in geoxml.Descendants("result").Descendants("geometry").First().Descendants("location") 142 select new 143 { 144 lat = part.Element("lat").Value, 145 lng = part.Element("lng").Value 146 }; 147 148 if (location.Count() > 0) 149 { 150 double _lat = Double.Parse(location.First().lat, System.Globalization.CultureInfo.InvariantCulture); 151 double _lng = Double.Parse(location.First().lng, System.Globalization.CultureInfo.InvariantCulture); 152 var geo = new GeoCoordinate(_lat, _lng); 153 return geo; 154 } 155 } 156 } 157 158 return null; 159 } 160 }

VIND ONS

ProNails salons in 45 landen

Elk ProNails salon streeft ernaar om klanten hoge kwaliteit en de beste service te bieden. Onze salons zijn altijd op de hoogte van DE nieuwe nageltrends, nieuwe kleuren, nieuwe innovaties zodat jij de mooiste nagels hebt.

Naar boven
Cookies

This website uses cookies to track your behavior and to improve your experience on the site.