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 : AP5bfdae3f27b51bb56ab869ed6ff4. at Co3.MCH.Website.Frontend.Models.Frontend.Ecommerce.EventProduct.Populate(ProductSettings settings) in C:\Data\Development\git\mch-master\Co3.MCH.Website.Frontend\Models\Frontend\Ecommerce\EventProduct.cs:line 129 at Co3.MCH.Website.Frontend.Services.Ecommerce.ProductService.GetEspressoProduct(ProductSettings settings, String key) in C:\Data\Development\git\mch-master\Co3.MCH.Website.Frontend\Services\Ecommerce\ProductService.cs:line 46 at CompiledRazorTemplates.Dynamic.RazorEngine_c3e5a6f9eb0243e6b5ea40347e44a0cd.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 68 <div class="row"> 69 <div class="col-12 col-md-11"> 70 @if (eventProduct.Image != "") 71 { 72 <div class="mch365-list-item-image-container image-ratio-16-9 mb-3"> 73 <a class="mch365-download-full-image" href="@eventProduct.Image" download> 74 <i class="material-icons">download</i> 75 <span class="mch365-download-full-image-text">@Translate( "MCH365 - Button - Download full image - Text", "Kun til redaktionelt brug" )</span> 76 </a> 77 <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=""> 78 </div> 79 } 80 <div class="d-flex align-items-center mb-2"> 81 @if (eventProduct.RegistrationLink != "") 82 { 83 <a href="@eventProduct.RegistrationLink" class="btn btn-secondary mr-2" target="_blank">Tilmeld dig her</a> 84 } 85 <p class="font-family-headings font-weight-bold text-center mb-0 underline-dotted">@eventStatusLabel</p> 86 87 </div> 88 89 @if (eventProduct.DescriptionFormatted != "") 90 { 91 <p> 92 @eventProduct.DescriptionFormatted 93 </p> 94 } 95 </div> 96 </div> 97 </div> 98 99 <div class="col-12 col-md-5 col-lg-4 p-columns"> 100 <div class="row"> 101 <div class="col-12"> 102 <div class="row no-gutters"> 103 <div class="col-12 mb-3"> 104 <div class="mch365-event-datetime-container"> 105 @if ( eventProduct.StartDate.ToString( CultureInfo.InvariantCulture ).IndexOf( "0001", StringComparison.Ordinal ) == -1 ) 106 { 107 <div class="bg-primary border-radius-sm px-2 py-1 e-text-light"> 108 <h4 class="small text-muted">Start</h4> 109 <span class="small d-block">@eventProduct.StartDate.ToString( "dddd" )</span> 110 <span class="h1 mega font-weight-extrabold d-block my-0" style="line-height: 1em">@eventProduct.StartDate.ToString( "d. MMM" )</span> 111 <span class="small d-block">kl. @eventProduct.StartDate.ToString( "HH:mm tt" )</span> 112 </div> 113 } 114115 @if ( eventProduct.EndDate.ToString( CultureInfo.InvariantCulture ).IndexOf( "0001", StringComparison.Ordinal ) == -1 ) 116 { 117 <div class="bg-primary border-radius-sm px-2 py-1 e-text-light"> 118 <h4 class="small text-muted">Slut</h4> 119 <span class="small d-block">@eventProduct.EndDate.ToString( "dddd" )</span> 120 <span class="h1 mega font-weight-extrabold d-block my-0" style="line-height: 1em">@eventProduct.EndDate.ToString( "d. MMM" )</span> 121 <span class="small d-block">kl. @eventProduct.EndDate.ToString( "HH:mm tt" )</span> 122 </div> 123 } 124 </div> 125 </div> 126127 @if (eventProduct.Online) 128 { 129 <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"> 130 <h4>@Translate("MCH365 - Event details PLeaseNotice - Heading", "Bemærk venligst")</h4> 131 <h3 class="text-secondary mb-0">@Translate("MCH365 - Event details PLeaseNoticeOnline - Text", "Dette event afholdes udelukkende online")</h3> 132 </div> 133 } 134135 @if (eventProduct.WebinarLink != "") 136 { 137 <div class="col-12 bg-light border-radius p-2 mch365-custom-product-details-sidebar mb-3"> 138 <h4 class="mt-0 mb-1">@Translate("MCH365 - Event details WebinarLink - Heading", "Genvej til webinar")</h4> 139 <a class="mb-0" href="@eventProduct.WebinarLink" class="text-link">@eventProduct.WebinarLink</a> 140 </div> 141 } 142 @if (eventProduct.EventLocation != "") { 143 <div class="col-12 bg-light border-radius p-2 mch365-custom-product-details-sidebar mb-3"> 144 <h4 class="mt-0 mb-1">@Translate("MCH365 - Event details Location - Heading", "Lokation")</h4> 145 <p class="mb-0">@eventProduct.EventLocation</p> 146 </div> 147 } 148149 @if (eventProduct.EventProvider != "") 150 { 151 <div class="col-12 bg-light border-radius p-2 mch365-custom-product-details-sidebar mb-3"> 152 <h4 class="mt-0 mb-1">@Translate("MCH365 - Event details SolicitedBy - Heading", "Eventet udbydes af:")</h4> 153 <p class="mb-0">@eventProduct.EventProvider</p> 154 </div> 155 } 156157 @if (eventProduct.Profile?.Company?.Name != null) 158 { 159 <div class="col-12 bg-gradient border-radius p-2 mch365-custom-product-details-sidebar mt-4 mb-4" id="companyInfo"> 160 @if (eventProduct?.Profile?.Company?.Logo != null) 161 { 162 string logoImage = eventProduct.Profile.Company.Logo; 163 string companyBackgroundColor = eventProduct.Profile.Company.BrandColor; 164165 string noCompanyInfo = ""; 166 string textLight = "e-text-light"; 167168 if (string.IsNullOrEmpty(logoImage) && string.IsNullOrEmpty(companyBackgroundColor)) 169 { 170 noCompanyInfo = "bg-light"; 171 textLight = "text-muted"; 172 } 173174 string noLogoBackground = ""; 175 if (string.IsNullOrEmpty(logoImage) && !string.IsNullOrEmpty(companyBackgroundColor)) 176 { 177 noLogoBackground = "style=\"background:" + companyBackgroundColor + ";\""; 178 } 179 <span class="d-block px-custom-logo mx-auto mb-3"> 180 <div class="e-productlist-item-image-container border-radius-double @noCompanyInfo" @noLogoBackground> 181182183 <div class="e-productlist-item-image-wrapper justify-content-center align-items-center d-flex @textLight"> 184 @{ 185 if (string.IsNullOrEmpty(logoImage)) 186 { 187 <span class="h1 mb-0">@eventProduct.Profile.Company.Name.Substring(0,1).ToLower()</span> 188 } 189 else 190 { 191 <img alt="@eventProduct.Profile.Company.Name" class="e-productlist-item-image w-100 p-1" src="@(eventProduct.Profile.Company.Logo)"> 192 } 193 } 194 </div> 195 </div> 196 </span> 197 } 198199200 <p class="small mb-half">@Translate("MCH365 - Event details CreatedBy - Heading", "Eventet er oprettet af:")</p> 201 <h4 class="mt-0 mb-2">@eventProduct.Profile.Company.Name</h4> 202 <p class="small line-clamp-10"> 203 @Co3.MCH.Website.Frontend.Services.Ecommerce.ProductService.Instance.GetTruncatedFormattedString(eventProduct.Profile.Company.Description, 600) 204 </p> 205206207 <a class="btn btn-transparent mt-2" href="@eventProduct.Profile.Link"> 208 @Translate("MCH365 - Product details ExhibitorProfile - Link", "Se profil") 209 </a> 210 </div> 211 } 212 </div> 213 </div> 214 </div> 215 </div> 216 </div> 217 </div> 218 </div> 219 </div> 220221222 @RenderingService.Instance.SectionEnd() 223224 @RenderingService.Instance.SectionStart(new SectionSettings()) 225226 @SnippetStart("profileProductCompanyDescription")@productDescriptionFormattedMetaDesc@SnippetEnd("profileProductCompanyDescription") @* Avoid using linebreaks in this snippet, as it will also add linebreaks to the content *@ 227 @SnippetStart("profileProductCompanyName")@eventName@SnippetEnd("profileProductCompanyName") @* Avoid using linebreaks in this snippet, as it will also add linebreaks to the content *@ 228 @SnippetStart("profileProductCompanyLogo")@eventImage@SnippetEnd("profileProductCompanyLogo") @* Avoid using linebreaks in this snippet, as it will also add linebreaks to the content *@ 229