Continue reading below
 
logo
Error executing template "Designs/TwenteBranding/Paragraph/PartnerInformation.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_a859b6a26421423db21f0aae5e431aa9.Execute() in D:\inetpub\wwwroot\www.twente.com\Files\Templates\Designs\TwenteBranding\Paragraph\PartnerInformation.cshtml:line 30
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.b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @using Dynamicweb.Frontend 2 @using TwenteBranding.Repository.Helpers 3 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 4 @{ 5 if (Model.Item != null) 6 { 7 var title = Model.Item.GetString("Title"); 8 var logo = Model.Item.GetFile("Logo")?.Path; 9 10 var address = Model.Item.GetString("Address"); 11 var phoneNumber = Model.Item.GetString("PhoneNumber"); 12 var emailAddress = Model.Item.GetString("EmailAddress"); 13 var websiteUrl = Model.Item.GetString("WebsiteUrl"); 14 var socialMediaLinks = Model.Item.GetField("SocialMediaLinks"); 15 var paragraphId = string.Format("par-{0}", Model.ID); 16 17 // if item properties are left blank and the item paragraph is placed on an PartnerArticle page, inherit the property values from the partner 18 if (string.IsNullOrWhiteSpace(address)) 19 { 20 var pageView = Dynamicweb.Frontend.PageView.Current(); 21 if (pageView != null && pageView.ID > 0) 22 { 23 var pageService = new Dynamicweb.Content.PageService(); 24 var companyPage = pageService.GetPage(pageView.ID); 25 if (companyPage != null && companyPage.Item != null && companyPage.ItemType.Equals(TwenteBranding.Models.Constants.StringConstants.ItemInstanceType.PartnerArticle)) 26 { 27 address = ItemHelper.GetItemValue<string>(companyPage.Item, TwenteBranding.Models.Constants.StringConstants.CustomItemTypes.PartnerArticle.PartnerFullAddress); 28 if (string.IsNullOrWhiteSpace(logo)) 29 { 30 logo = ItemHelper.GetItemValue<FileViewModel>(companyPage.Item, TwenteBranding.Models.Constants.StringConstants.CustomItemTypes.PartnerArticle.PartnerLogo).Path; 31 logo = $"/Admin/Public/GetImage.ashx?Image={logo}&Format=webp&Width=200&Height=-1&Quality=100&Crop=0&t=2"; 32 } 33 if (string.IsNullOrWhiteSpace(phoneNumber)) 34 { 35 phoneNumber = ItemHelper.GetItemValue<string>(companyPage.Item, TwenteBranding.Models.Constants.StringConstants.CustomItemTypes.PartnerArticle.PartnerPhoneNumber); 36 } 37 if (string.IsNullOrWhiteSpace(emailAddress)) 38 { 39 emailAddress = ItemHelper.GetItemValue<string>(companyPage.Item, TwenteBranding.Models.Constants.StringConstants.CustomItemTypes.PartnerArticle.PartnerEmailAddress); 40 } 41 if (string.IsNullOrWhiteSpace(websiteUrl)) 42 { 43 websiteUrl = ItemHelper.GetItemValue<string>(companyPage.Item, TwenteBranding.Models.Constants.StringConstants.CustomItemTypes.PartnerArticle.PartnerWebsiteUrl); 44 } 45 } 46 } 47 } 48 49 <div class="partner-information"> 50 <a name="@paragraphId" class="jump-to-anchor"></a> 51 <h3 class="partner-information-title info">@title</h3> 52 <div class="partner-information-details"> 53 @if (!string.IsNullOrWhiteSpace(logo)) 54 { 55 <div> 56 <img src="@logo" class="logo" /> 57 </div> 58 } 59 <div> 60 @if (!string.IsNullOrWhiteSpace(address)) 61 { 62 <span class="info address">@address.NewlineToBr()</span> 63 } 64 65 @if (!string.IsNullOrWhiteSpace(phoneNumber)) 66 { 67 <span class="info phoneNumber">@phoneNumber</span> 68 } 69 </div> 70 <div> 71 @if (socialMediaLinks != null) 72 { 73 var links = socialMediaLinks.GetItems(); 74 if (links.Any()) 75 { 76 <div class="social-media-icon-container"> 77 <ul> 78 @foreach (var link in links) 79 { 80 var socialMediaLink = link.GetString("SocialMediaurl"); 81 if (!socialMediaLink.ToLower().StartsWith("http")) 82 { 83 socialMediaLink = string.Format("https://{0}", socialMediaLink); 84 } 85 var socialShareType = link.GetString("SocialShareType"); 86 <li> 87 <a href="@socialMediaLink" title="@socialShareType.JsEncode()" target="_blank"> 88 <div class="font-color--black"> 89 <div class=" @string.Format("icon--sm_{0}", socialShareType.ToLower()) social-media-icon icon-size--x1_5"></div> 90 </div> 91 </a> 92 </li> 93 } 94 </ul> 95 </div> 96 } 97 } 98 @if (!string.IsNullOrWhiteSpace(emailAddress) || !string.IsNullOrWhiteSpace(websiteUrl)) 99 { 100 <div> 101 @if (!string.IsNullOrWhiteSpace(emailAddress)) 102 { 103 <span class="info e-mailaddress"><a href="mailto:@emailAddress" target="_blank">@emailAddress</a></span> 104 } 105 @if (!string.IsNullOrWhiteSpace(websiteUrl)) 106 { 107 var websiteLink = websiteUrl; 108 if (!websiteLink.ToLower().StartsWith("http")) 109 { 110 websiteLink = string.Format("https://{0}", websiteUrl); 111 } 112 <span class="info website-url"><a href="@websiteLink" target="_blank">@websiteUrl</a></span> 113 } 114 </div> 115 } 116 </div> 117 </div> 118 </div> 119 } 120 }
Mentale merkidentiteit
Visuele merkidentiteit
Merkstrategie