Artikler

Error executing template "Designs/exhibition_site/eCom/Product/MCH365-article.cshtml"
System.Exception: Product is not of type Co3.MCH.Website.Frontend.Models.Frontend.MCH365.Article. Check asset type of product id : PP5ed578db788ac177dfd2e6db15fb.
at Co3.MCH.Website.Frontend.Models.Frontend.Ecommerce.ArticleProduct.Populate(ProductSettings settings) in C:\Data\Development\git\mch-master\Co3.MCH.Website.Frontend\Models\Frontend\Ecommerce\ArticleProduct.cs:line 203
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_bbb407cf36ce4b728372182baca5ef8b.Execute() in E:\dynamicweb.net\Solutions\mch365.espresso5.dk\Files\Templates\Designs\exhibition_site\eCom\Product\MCH365-article.cshtml:line 15
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.Web 3 @using Co3.Espresso.Base.Extensions 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.Data.Models.MCH365 8 @using Co3.MCH.Website.Frontend.Models.Frontend 9 @using Co3.MCH.Website.Frontend.Models.Frontend.Ecommerce 10 @using Co3.MCH.Website.Frontend.Models.Frontend.MCH365 11 @using Co3.MCH.Website.Frontend.Models.Frontend.Users 12 @using Dynamicweb.Frontend 13 14 @{ 15 ArticleProduct articleProduct = (ArticleProduct) Co3.MCH.Website.Frontend.Services.Ecommerce.ProductService.Instance.GetEspressoProduct( 16 new ProductSettings() 17 { 18 Id = GetString("Ecom:Product.ID"), 19 VariantId = GetString("Ecom:Product.VariantID"), 20 PrimaryVariantId = GetString("Ecom:Product.DefaultVariantComboID"), 21 EmbeddedInModelList = true 22 }, nameof(ArticleProduct) 23 ); 24 25 string tradeshowName = MCH365Context.Current.TradeShowDetails.Name; 26 string tradeshowCode = PageView.Current().Area.Item[ "TradeShowCode" ].ToString(); 27 bool hasPresentation = articleProduct.Profile?.HasPresentation != null && articleProduct.Profile.HasPresentation && articleProduct.Profile.ContactPersons.Products.Any(); 28 29 string latestProductlistPage = SearchEngineFriendlyURLs.GetFriendlyUrl( PageView.Current().Page.Parent.GetPageHrefValue() ); 30 if ( UserContext.Current.LatestProductListPageIds.ContainsKey( "articlemerge" ) ) 31 { 32 latestProductlistPage = SearchEngineFriendlyURLs.GetFriendlyUrl( string.Format("Default.aspx?ID={0}", UserContext.Current.LatestProductListPageIds["articlemerge"]) ); 33 }else if ( UserContext.Current.LatestProductListPageIds.ContainsKey( "article" ) ) 34 { 35 latestProductlistPage = SearchEngineFriendlyURLs.GetFriendlyUrl( string.Format("Default.aspx?ID={0}", UserContext.Current.LatestProductListPageIds["article"]) ); 36 } 37 38 string articleProductImage = "/admin/public/getimage.ashx?Image=" + articleProduct.Image + "&amp;Width=1280&amp;Height=720&amp;Format=webp&amp;Quality=75&amp;Crop=0"; 39 string articleImage = !string.IsNullOrEmpty(articleProductImage) ? articleProductImage : MCH365Context.Current.TradeShowDetails.Logo; 40 41 string articleName = articleProduct.Name.Replace("\"", "'"); 42 string articleDescriptionFormatted = articleProduct.DescriptionFormatted; 43 string articleDescriptionFormattedStrippedHtml = articleDescriptionFormatted.StripHtml(); 44 45 string articleDescriptionFormattedMetaDesc = !string.IsNullOrEmpty(articleDescriptionFormattedStrippedHtml) ? articleDescriptionFormattedStrippedHtml : articleName; 46 47 if ( articleDescriptionFormattedStrippedHtml.Length > 160 ) 48 { 49 articleDescriptionFormattedMetaDesc = !string.IsNullOrEmpty(articleDescriptionFormattedStrippedHtml) ? articleDescriptionFormattedStrippedHtml.Substring(0, 160) : articleName; 50 } 51 } 52 53 @RenderingService.Instance.SectionEnd() 54 @RenderingService.Instance.SectionStart(new SectionSettings 55 { 56 Classes = new ClassList("e-section mch365-custom-article-details-wrapper") 57 }) 58 59 <div class="col-12 p-columns mch365-custom-product-details-wrapper-main-content"> 60 <div class="row mt-2 mt-md-4"> 61 <div class="col-12"> 62 <div class="row"> 63 <div class="col-12 col-md-7 col-lg-8 mb-5 mb-md-0 p-columns mx-auto"> 64 <div class="row"> 65 <div class="col-12 col-md-11"> 66 <h1 class="mega mb-half">@articleProduct.Name</h1> 67 <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> 68 <p class="mt-0"> 69 @articleProduct.Created.ToLongEspressoFormat() 70 @if (articleProduct.Profile?.Company?.Name != null) 71 { 72 <span class="d-md-none"> 73 | <a class="text-black" href="@(PageView.Current().SearchFriendlyUrl)#companyInfo"> @articleProduct.Profile.Company.Name </a> 74 </span> 75 } 76 </p> 77 78 @if ( articleProduct.CategoryFieldValues.Any() ) 79 { 80 <ul class="mch365-custom-product-product-details-categories-list"> 81 @foreach ( KeyValuePair< string, CategoryFieldValue > subcategory in articleProduct.CategoryFieldValues ) 82 { 83 string filterValue = string.Format( "C{0}|{1}", tradeshowCode, subcategory.Key ); 84 <li> 85 <a href="@(latestProductlistPage)?PresentationCategory=@filterValue">@subcategory.Value.FieldLabel</a> 86 </li> 87 } 88 </ul> 89 } 90 91 @if (articleProduct.Image != "") 92 { 93 <div class="mch365-list-item-image-container image-ratio-16-9 mb-3"> 94 <a class="mch365-download-full-image" href="@articleProduct.Image" download> 95 <i class="material-icons">download</i> 96 <span class="mch365-download-full-image-text">@Translate( "MCH365 - Button - Download full image - Text", "Kun til redaktionelt brug" )</span> 97 </a> 98 <img src="/admin/public/getimage.ashx?Image=@articleProduct.Image&amp;Width=1280&amp;Height=720&amp;Format=webp&amp;Quality=75&amp;Crop=0" class="p-img p-img-corner-rounded" alt=""> 99 </div> 100 } 101102 @if (articleProduct.DescriptionFormatted != "") 103 { 104 <p> 105 @articleProduct.DescriptionFormatted 106 </p> 107 } 108109 @if (articleProduct.Links.Any()) 110 { 111 <div class="mt-2"> 112 @foreach (LinkContainer link in articleProduct.Links) 113 { 114 if (!string.IsNullOrEmpty(link.Link) && !string.IsNullOrEmpty(link.Title)) 115 { 116 <a target="_blank" href="@link.Link">@link.Title</a><br/> 117 } 118 } 119 </div> 120 } 121122 </div> 123 </div> 124125 @RenderingService.Instance.PartialView("ecom/product/partials/article-details/MCH365-related-articles.cshtml", articleProduct) 126127 </div> 128 @if (articleProduct.Profile?.Company?.Name != null) { 129 <div class="col-12 col-md-5 col-lg-4 p-columns"> 130 <div class="row"> 131 <div class="col-12"> 132 <div class="row no-gutters"> 133 @if (articleProduct.Profile?.Company?.Name != null) 134 { 135 <div class="col-12 bg-gradient border-radius p-2 mch365-custom-product-details-sidebar mt-4 mb-4" id="companyInfo"> 136 @if (articleProduct.Profile?.Company?.Logo != null) 137 { 138 string logoImage = articleProduct.Profile.Company.Logo; 139 string companyBackgroundColor = articleProduct.Profile.Company.BrandColor; 140141 string noCompanyInfo = ""; 142 string textLight = "e-text-light"; 143144 if (string.IsNullOrEmpty(logoImage) && string.IsNullOrEmpty(companyBackgroundColor)) 145 { 146 noCompanyInfo = "bg-light"; 147 textLight = "text-muted"; 148 } 149150 string noLogoBackground = ""; 151 if (string.IsNullOrEmpty(logoImage) && !string.IsNullOrEmpty(companyBackgroundColor)) 152 { 153 noLogoBackground = "style=\"background:" + companyBackgroundColor + ";\""; 154 } 155 <span class="d-block px-custom-logo mx-auto mb-3"> 156 <div class="e-productlist-item-image-container border-radius-double @noCompanyInfo" @noLogoBackground> 157158159 <div class="e-productlist-item-image-wrapper justify-content-center align-items-center d-flex @textLight"> 160 @{ 161 if (string.IsNullOrEmpty(logoImage)) 162 { 163 <span class="h1 mb-0">@articleProduct.Profile.Company.Name.Substring(0,1).ToLower()</span> 164 } 165 else 166 { 167 <img alt="@articleProduct.Profile.Company.Name" class="e-productlist-item-image w-100 p-1" src="@(articleProduct.Profile.Company.Logo)"> 168 } 169 } 170 </div> 171 </div> 172 </span> 173 } 174 <p class="small mb-half">@Translate("MCH365 - Article details CreatedBy - Heading", "Artikel er skrevet af:")</p> 175 <h4 class="mt-0 mb-2">@articleProduct.Profile.Company.Name</h4> 176 <p class="small line-clamp-10"> 177 @Co3.MCH.Website.Frontend.Services.Ecommerce.ProductService.Instance.GetTruncatedFormattedString(articleProduct.Profile.Company.Description, 600) 178 </p> 179180 <a class="btn btn-transparent mt-2" href="@articleProduct.Profile.Link"> 181 @Translate("MCH365 - Article details ExhibitorProfile - Link", "Se profil") 182 </a> 183 </div> 184 } 185 @if (hasPresentation) 186 { 187 <div class="col-12 "> 188 <h2 class="small mb-2">@Translate("MCH365 - Article details MeetUsAt - Text", "Mød os på") @tradeshowName</h2> 189 <div class="row e-productlist-container mch365-productlist-hide-profileinfo"> 190 @foreach (ContactPersonProduct contact in articleProduct.Profile.ContactPersons.Products.Select(p => (ContactPersonProduct) p)) 191 { 192 <div class="col-12"> 193 @contact.ListItemHtml 194 </div> 195 } 196 </div> 197 </div> 198 } 199 </div> 200 </div> 201 </div> 202 </div> 203 } 204 </div> 205 </div> 206 </div> 207 </div> 208209210 @RenderingService.Instance.SectionEnd() 211 @RenderingService.Instance.SectionStart(new SectionSettings()) 212213 @SnippetStart("profileProductCompanyDescription")@articleDescriptionFormattedMetaDesc@SnippetEnd("profileProductCompanyDescription") @* Avoid using linebreaks in this snippet, as it will also add linebreaks to the content *@ 214 @SnippetStart("profileProductCompanyName")@articleName@SnippetEnd("profileProductCompanyName") @* Avoid using linebreaks in this snippet, as it will also add linebreaks to the content *@ 215 @SnippetStart("profileProductCompanyLogo")@articleImage@SnippetEnd("profileProductCompanyLogo") @* Avoid using linebreaks in this snippet, as it will also add linebreaks to the content *@
keyboard_arrow_up