Error executing template "Designs/exhibition_site/eCom/Product/MCH365-exhibitor.cshtml"
System.Exception: Product is not of type Co3.MCH.Website.Frontend.Models.Frontend.MCH365.Profile. Check asset type of product id : TSPf1d398fbd57377c7b54768ca69a.
at Co3.MCH.Website.Frontend.Models.Frontend.Ecommerce.ProfileProduct.Populate(ProductSettings settings) in C:\Data\Development\git\mch-master\Co3.MCH.Website.Frontend\Models\Frontend\Ecommerce\ProfileProduct.cs:line 67
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 45
at CompiledRazorTemplates.Dynamic.RazorEngine_6361db7f0532483ab084195affc5e8cb.Execute() in E:\dynamicweb.net\Solutions\mch365.espresso5.dk\Files\Templates\Designs\exhibition_site\eCom\Product\MCH365-exhibitor.cshtml:line 12
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.Text.RegularExpressions 3 @using Co3.Espresso.Website.Services 4 @using Co3.Espresso.Website.Models.FrontEnd 5 @using Co3.Espresso.Website.Models.FrontEnd.Settings 6 @using Co3.MCH.Website.Frontend.Helpers 7 @using Co3.MCH.Website.Frontend.Models.Frontend 8 @using Co3.MCH.Website.Frontend.Models.Frontend.Ecommerce 9 @using Dynamicweb.Core 10 11 @{ 12 ProfileProduct espressoProduct = Co3.MCH.Website.Frontend.Services.Ecommerce.ProductService.Instance.GetEspressoProduct( 13 new ProductSettings() 14 { 15 Id = GetString("Ecom:Product.ID"), 16 VariantId = GetString("Ecom:Product.VariantID"), 17 PrimaryVariantId = GetString("Ecom:Product.DefaultVariantComboID"), 18 EmbeddedInModelList = false 19 }, nameof(ProfileProduct) 20 ) as ProfileProduct; 21 22 // EXAMPLE 23 bool hasPresentation = espressoProduct.HasPresentation; 24 int presentationContactPersons = 0; 25 if (hasPresentation) 26 { 27 presentationContactPersons = espressoProduct.Presentation.ContactPersons.Products.Count(); 28 } 29 30 // CUSTOM COMPANY FIELDS 31 string companyColor = ""; 32 33 if (espressoProduct.Company.BrandColor.IsNullOrEmpty()) 34 { 35 companyColor = MCH365Context.Current.TradeShowDetails.PrimaryColor; 36 } 37 else 38 { 39 companyColor = espressoProduct.Company.BrandColor; 40 } 41 42 // CUSTOM COMPANY COLOR SCHEME 43 Regex hexcodeRegex = new Regex(@"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"); 44 companyColor = hexcodeRegex.IsMatch( companyColor ) ? companyColor : "#000000"; 45 ColorHelper.HSL brandExhibitor = ColorHelper.Instance.HexToHsl(companyColor); 46 47 // VIDEO 48 string presentationVideo = ""; 49 50 if (espressoProduct.Presentation != null && espressoProduct.Presentation.Video != null && !string.IsNullOrEmpty(espressoProduct.Presentation.Video)) 51 { 52 string presentationVideoRaw = espressoProduct.Presentation.Video; 53 54 if (presentationVideoRaw.Contains("https://vimeo.com/")) 55 { 56 presentationVideo = "https://player.vimeo.com/video/" + (presentationVideoRaw.Replace("https://vimeo.com/", "")); 57 } 58 else if (presentationVideoRaw.Contains("https://youtu")) 59 { 60 presentationVideo = ("https://www.youtube.com/embed/" + presentationVideoRaw.Replace("https://youtu.be/", "").Replace("https://www.youtube.com/embed/", "")); 61 } 62 else if (presentationVideoRaw.Contains("https://www.youtube.com/watch?v=")) 63 { 64 presentationVideo = ("https://www.youtube.com/embed/" + presentationVideoRaw.Replace("https://www.youtube.com/watch?v=", "")); 65 } 66 else 67 { 68 presentationVideo = ("https://www.youtube.com/embed/" + presentationVideoRaw); 69 } 70 } 71 } 72 73 <style> 74 :root { 75 --exhibitor-color: @brandExhibitor.ToString(); 76 --exhibitor-color-darken: @brandExhibitor.Darken(10).ToString(); 77 --exhibition-profile-exhibitor-brand-color: hsl(var(--exhibitor-color)); 78 --exhibition-profile-exhibitor-brand-color-darken: hsl(var(--exhibitor-color-darken)); 79 --exhibition-profile-exhibitor-brand-color-opaque: hsla(var(--exhibitor-color), 0.85); 80 } 81 82 .breadcrumb.nav { 83 background-color: var(--exhibition-profile-exhibitor-brand-color-darken); 84 } 85 86 </style> 87 88 @RenderingService.Instance.SectionEnd() 89 @RenderingService.Instance.PartialView("ecom/product/partials/exhibitor-details/MCH365-topsection.cshtml", espressoProduct) 90 @RenderingService.Instance.SectionStart(new SectionSettings 91 { 92 Classes = new ClassList("e-section mch365-custom-product-details-wrapper") 93 }) 94 @RenderingService.Instance.PartialView("ecom/product/partials/exhibitor-details/MCH365-sidebar.cshtml", espressoProduct) 95 <div class="col-12 col-md-8 col-lg-9 p-columns mch365-custom-product-details-wrapper-main-content"> 96 <div class="row mt-2 mt-md-4"> 97 <div class="col-12"> 98 <div class="row"> 99 <div class="col-12 col-lg-8 mb-2 pr-lg-2 pr-xl-3" id="presentation"> 100101 @if (hasPresentation && !string.IsNullOrEmpty(espressoProduct.Presentation.DescriptionFormatted)) 102 { 103 <p>@espressoProduct.Presentation.DescriptionFormatted</p> 104 } 105 else { 106 if( !string.IsNullOrEmpty(espressoProduct.Company.DescriptionFormatted)) { 107 <p>@espressoProduct.Company.DescriptionFormatted</p> 108 } 109 else 110 { 111 <h4>@Translate("MCH365 - Exhibitor details descriptionNoInfoHeader - Heading", "Vi har registreret udstilleren som leverandør eller udstiller på messen.")</h4> 112 <p>@Translate("MCH365 - Exhibitor details descriptionNoInfoText - Text", "Dog har de endnu ikke oplyst yderligere beskrivelse på deres profil.")</p> 113 } 114 } 115116 @if (hasPresentation) 117 { 118 if (!string.IsNullOrEmpty(presentationVideo)) 119 { 120 <div class="video-container mt-5 mb-4"> 121 <iframe class="responsive-iframe" src="@presentationVideo" width="640" height="360" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe> 122 </div> 123 } 124 } 125 </div> 126 @if (espressoProduct.ContactPersons.Products.Any()) 127 { 128 @RenderingService.Instance.PartialView("ecom/product/partials/exhibitor-details/MCH365-contactpersons.cshtml", espressoProduct) 129 } 130 </div> 131132 @if (espressoProduct.Products.Products.Any()) 133 { 134 <div class="row"> 135 @RenderingService.Instance.PartialView("ecom/product/partials/exhibitor-details/MCH365-products.cshtml", espressoProduct) 136 </div> 137 } 138 @if (espressoProduct.Articles.Products.Any()) 139 { 140 <div class="row"> 141 @RenderingService.Instance.PartialView("ecom/product/partials/exhibitor-details/MCH365-articles.cshtml", espressoProduct) 142 </div> 143 } 144 @if (espressoProduct.Cases.Products.Any()) 145 { 146 <div class="row"> 147 @RenderingService.Instance.PartialView("ecom/product/partials/exhibitor-details/MCH365-cases.cshtml", espressoProduct) 148 </div> 149 } 150151152 @if (espressoProduct.Events.Products.Any()) 153 { 154 <div class="row"> 155 @RenderingService.Instance.PartialView("ecom/product/partials/exhibitor-details/MCH365-events.cshtml", espressoProduct) 156 </div> 157 } 158 </div> 159 </div> 160 </div> 161 @RenderingService.Instance.SectionEnd() 162 @RenderingService.Instance.SectionStart(new SectionSettings()) 163
keyboard_arrow_up