Error executing template "Designs/exhibition_site/eCom/Product/MCH365-event.cshtml" System.Exception: Product is not of type Co3.MCH.Website.Frontend.Models.Frontend.MCH365.Event. Check asset type of product id : Pa9d63948444684d942ca2a852e446. at Co3.MCH.Website.Frontend.Models.Frontend.Ecommerce.EventProduct.Populate(ProductSettings settings) in C:\Users\CeciliaVejle\Documents\ProjekterDW\co3.mch\Co3.MCH.Website.Frontend\Models\Frontend\Ecommerce\EventProduct.cs:line 135 at Co3.MCH.Website.Frontend.Services.Ecommerce.ProductService.GetEspressoProduct(ProductSettings settings, String key) in C:\Users\CeciliaVejle\Documents\ProjekterDW\co3.mch\Co3.MCH.Website.Frontend\Services\Ecommerce\ProductService.cs:line 59 at CompiledRazorTemplates.Dynamic.RazorEngine_f0533a71768e415881a9906dca11f627.Execute() in E:\dynamicweb.net\Solutions\mch365.espresso5.dk\Files\Templates\Designs\exhibition_site\eCom\Product\MCH365-event.cshtml:line 16 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 Co3.Espresso.Website.TemplateBases.Paragraphs.Module 2 @using System.Globalization 3 @using System.Web 4 @using Co3.Espresso.Website.Services 5 @using Co3.Espresso.Website.Models.FrontEnd 6 @using Co3.Espresso.Website.Models.FrontEnd.Settings 7 @using Co3.MCH.Website.Frontend.Models.Frontend.Ecommerce 8 @using Co3.MCH.Website.Frontend.Models.Frontend.Users 9 @using Co3.MCH.Website.Frontend.Services.MCH365 10 @using Dynamicweb.Frontend 11 @using Co3.Espresso.Base.Extensions 12 @using Co3.MCH.Website.Frontend.Models.Frontend 13 14 15 @{ 16 EventProduct eventProduct = (EventProduct) Co3.MCH.Website.Frontend.Services.Ecommerce.ProductService.Instance.GetEspressoProduct( 17 new ProductSettings() 18 { 19 Id = GetString("Ecom:Product.ID"), 20 VariantId = GetString("Ecom:Product.VariantID"), 21 PrimaryVariantId = GetString("Ecom:Product.DefaultVariantComboID"), 22 EmbeddedInModelList = true 23 }, nameof(EventProduct) 24 ); 25 26 string eventStatusLabel = MCHDataService.GetFieldLabelByValue("EventStatus" ,eventProduct.EventStatus); 27 string eventTypeLabel = MCHDataService.GetFieldLabelByValue("EventType" ,eventProduct.EventType); 28 string latestProductlistPage = SearchEngineFriendlyURLs.GetFriendlyUrl( PageView.Current().Page.Parent.GetPageHrefValue() ); 29 if ( UserContext.Current.LatestProductListPageIds.ContainsKey( "event" ) ) 30 { 31 latestProductlistPage = SearchEngineFriendlyURLs.GetFriendlyUrl( string.Format("Default.aspx?ID={0}", UserContext.Current.LatestProductListPageIds["event"]) ); 32 } 33 34 string eventProductImage = "/admin/public/getimage.ashx?Image=" + eventProduct.Image + "&Width=1280&Height=720&Format=webp&Quality=75&Crop=0"; 35 string eventImage = !string.IsNullOrEmpty(eventProductImage) ? eventProductImage : MCH365Context.Current.TradeShowDetails.Logo; 36 string eventName = eventProduct.Name.Replace("\"", "'"); 37 string productDescriptionFormatted = eventProduct.DescriptionFormatted; 38 string productDescriptionFormattedStrippedHtml = productDescriptionFormatted.StripHtml(); 39 40 string productDescriptionFormattedMetaDesc = !string.IsNullOrEmpty(productDescriptionFormattedStrippedHtml) ? productDescriptionFormattedStrippedHtml : eventName; 41 42 if ( productDescriptionFormattedStrippedHtml.Length > 160 ) 43 { 44 productDescriptionFormattedMetaDesc = !string.IsNullOrEmpty(productDescriptionFormattedStrippedHtml) ? productDescriptionFormattedStrippedHtml.Substring(0, 160) : eventName; 45 } 46 } 47 48 @RenderingService.Instance.SectionEnd() 49 @RenderingService.Instance.SectionStart(new SectionSettings 50 { 51 Classes = new ClassList("e-section mch365-custom-product-details-wrapper") 52 }) 53 54 <div class="col-12 p-columns mch365-custom-product-details-wrapper-main-content"> 55 <div class="row mt-0 mt-md-4"> 56 <div class="col-12"> 57 <div class="row"> 58 <div class="col-12 col-md-7 col-lg-8 mb-5 mb-md-0 p-columns"> 59 <h1 class="mega mb-half mt-0">@eventProduct.Name</h1> 60 <a class="align-self-center arrow-left d-block mb-2 mt-1 small" href="@latestProductlistPage"><i class="material-icons material-icons-large d-none">arrow_back</i>@Translate("MCH365 - To Overview - Link", "Til oversigten")</a> 61 <ul class="mch365-custom-product-product-details-categories-list"> 62 <li> 63 <a href="@(latestProductlistPage)?EventType=@eventProduct.EventType">@eventTypeLabel</a> 64 </li> 65 </ul> 66 67 <div class="row"> 68 <div class="col-12 col-md-11"> 69 @if (eventProduct.Image != "") 70 { 71 <div class="mch365-list-item-image-container image-ratio-16-9 mb-3"> 72 <a class="mch365-download-full-image" href="@eventProduct.Image" download> 73 <i class="material-icons">download</i> 74 <span class="mch365-download-full-image-text">@Translate( "MCH365 - Button - Download full image - Text", "Kun til redaktionelt brug" )</span> 75 </a> 76 <img src="/admin/public/getimage.ashx?Image=@eventProduct.Image&Width=1280&Height=720&Format=webp&Quality=75&Crop=0" class="p-img p-img-corner-rounded" alt=""> 77 </div> 78 } 79 <div class="d-flex align-items-center mb-2"> 80 @if (eventProduct.RegistrationLink != "") 81 { 82 <a href="@eventProduct.RegistrationLink" class="btn btn-secondary mr-2" target="_blank">Tilmeld dig her</a> 83 } 84 <p class="font-family-headings font-weight-bold text-center mb-0 underline-dotted">@eventStatusLabel</p> 85 86 </div> 87 88 @if (eventProduct.DescriptionFormatted != "") 89 { 90 <p> 91 @eventProduct.DescriptionFormatted 92 </p> 93 } 94 </div> 95 </div> 96 </div> 97 98 <div class="col-12 col-md-5 col-lg-4 p-columns"> 99 <div class="row"> 100 <div class="col-12"> 101 <div class="row no-gutters"> 102 <div class="col-12 mb-3"> 103 <div class="mch365-event-datetime-container"> 104 @if ( eventProduct.StartDate.ToString( CultureInfo.InvariantCulture ).IndexOf( "0001", StringComparison.Ordinal ) == -1 ) 105 { 106 <div class="bg-primary border-radius-sm px-2 py-1 e-text-light"> 107 <h4 class="small text-muted">Start</h4> 108 <span class="small d-block">@eventProduct.StartDate.ToString( "dddd" )</span> 109 <span class="h1 mega font-weight-extrabold d-block my-0" style="line-height: 1em">@eventProduct.StartDate.ToString( "d. MMM" )</span> 110 <span class="small d-block">kl. @eventProduct.StartDate.ToString( "HH:mm tt" )</span> 111 </div> 112 } 113114 @if ( eventProduct.EndDate.ToString( CultureInfo.InvariantCulture ).IndexOf( "0001", StringComparison.Ordinal ) == -1 ) 115 { 116 <div class="bg-primary border-radius-sm px-2 py-1 e-text-light"> 117 <h4 class="small text-muted">Slut</h4> 118 <span class="small d-block">@eventProduct.EndDate.ToString( "dddd" )</span> 119 <span class="h1 mega font-weight-extrabold d-block my-0" style="line-height: 1em">@eventProduct.EndDate.ToString( "d. MMM" )</span> 120 <span class="small d-block">kl. @eventProduct.EndDate.ToString( "HH:mm tt" )</span> 121 </div> 122 } 123 </div> 124 </div> 125126 @if (eventProduct.Online) 127 { 128 <div class="col-12 bg-white border-radius-sm px-2 box-shadow-sm py-2 mch365-custom-product-details-sidebar mb-3 text-center small"> 129 <h4>@Translate("MCH365 - Event details PLeaseNotice - Heading", "Bemærk venligst")</h4> 130 <h3 class="text-secondary mb-0">@Translate("MCH365 - Event details PLeaseNoticeOnline - Text", "Dette event afholdes udelukkende online")</h3> 131 </div> 132 } 133134 @if (eventProduct.WebinarLink != "") 135 { 136 <div class="col-12 bg-light border-radius p-2 mch365-custom-product-details-sidebar mb-3"> 137 <h4 class="mt-0 mb-1">@Translate("MCH365 - Event details WebinarLink - Heading", "Genvej til webinar")</h4> 138 <a class="mb-0" href="@eventProduct.WebinarLink" class="text-link">@eventProduct.WebinarLink</a> 139 </div> 140 } 141 @if (eventProduct.EventLocation != "") { 142 <div class="col-12 bg-light border-radius p-2 mch365-custom-product-details-sidebar mb-3"> 143 <h4 class="mt-0 mb-1">@Translate("MCH365 - Event details Location - Heading", "Lokation")</h4> 144 <p class="mb-0">@eventProduct.EventLocation</p> 145 </div> 146 } 147148 @if (eventProduct.EventProvider != "") 149 { 150 <div class="col-12 bg-light border-radius p-2 mch365-custom-product-details-sidebar mb-3"> 151 <h4 class="mt-0 mb-1">@Translate("MCH365 - Event details SolicitedBy - Heading", "Eventet udbydes af:")</h4> 152 <p class="mb-0">@eventProduct.EventProvider</p> 153 </div> 154 } 155156 @if (eventProduct.Profile?.Company?.Name != null) 157 { 158 <div class="col-12 bg-gradient border-radius p-2 mch365-custom-product-details-sidebar mt-4 mb-4" id="companyInfo"> 159 @if (eventProduct?.Profile?.Company?.Logo != null) 160 { 161 string logoImage = eventProduct.Profile.Company.Logo; 162 string companyBackgroundColor = eventProduct.Profile.Company.BrandColor; 163164 string noCompanyInfo = ""; 165 string textLight = "e-text-light"; 166167 if (string.IsNullOrEmpty(logoImage) && string.IsNullOrEmpty(companyBackgroundColor)) 168 { 169 noCompanyInfo = "bg-light"; 170 textLight = "text-muted"; 171 } 172173 string noLogoBackground = ""; 174 if (string.IsNullOrEmpty(logoImage) && !string.IsNullOrEmpty(companyBackgroundColor)) 175 { 176 noLogoBackground = "style=\"background:" + companyBackgroundColor + ";\""; 177 } 178 <span class="d-block px-custom-logo mx-auto mb-3"> 179 <div class="e-productlist-item-image-container border-radius-double @noCompanyInfo" @noLogoBackground> 180181182 <div class="e-productlist-item-image-wrapper justify-content-center align-items-center d-flex @textLight"> 183 @{ 184 if (string.IsNullOrEmpty(logoImage)) 185 { 186 <span class="h1 mb-0">@eventProduct.Profile.Company.Name.Substring(0,1).ToLower()</span> 187 } 188 else 189 { 190 <img alt="@eventProduct.Profile.Company.Name" class="e-productlist-item-image w-100 p-1" src="@(eventProduct.Profile.Company.Logo)"> 191 } 192 } 193 </div> 194 </div> 195 </span> 196 } 197198199 <p class="small mb-half">@Translate("MCH365 - Event details CreatedBy - Heading", "Eventet er oprettet af:")</p> 200 <h4 class="mt-0 mb-2">@eventProduct.Profile.Company.Name</h4> 201 <p class="small line-clamp-10"> 202 @Co3.MCH.Website.Frontend.Services.Ecommerce.ProductService.Instance.GetTruncatedFormattedString(eventProduct.Profile.Company.Description, 600) 203 </p> 204205206 <a class="btn btn-transparent mt-2" href="@eventProduct.Profile.Link"> 207 @Translate("MCH365 - Product details ExhibitorProfile - Link", "Se profil") 208 </a> 209 </div> 210 } 211 </div> 212 </div> 213 </div> 214 </div> 215 </div> 216 </div> 217 </div> 218 </div> 219220221 @RenderingService.Instance.SectionEnd() 222223 @RenderingService.Instance.SectionStart(new SectionSettings()) 224225 @SnippetStart("profileProductCompanyDescription")@productDescriptionFormattedMetaDesc@SnippetEnd("profileProductCompanyDescription") @* Avoid using linebreaks in this snippet, as it will also add linebreaks to the content *@ 226 @SnippetStart("profileProductCompanyName")@eventName@SnippetEnd("profileProductCompanyName") @* Avoid using linebreaks in this snippet, as it will also add linebreaks to the content *@ 227 @SnippetStart("profileProductCompanyLogo")@eventImage@SnippetEnd("profileProductCompanyLogo") @* Avoid using linebreaks in this snippet, as it will also add linebreaks to the content *@ 228