Apply

News

KWPN Membership

  • Digital KWPN Magazine (in Dutch)
  • Participate in KWPN activities
  • Register home-bred horses
  • Free advertising at KWPN Horses for Sale
Error executing template "/Designs/Kwpn/Paragraph/HorsesForSaleCarousel.cshtml"
System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
at Kwpn.Core.Services.MarketplaceSellHorseService.GetSellHorse(Expression`1 predicate, Int32 amount) in D:\a\1\s\Kwpn.Core\Services\MarketplaceSellHorseService.cs:line 42
at CompiledRazorTemplates.Dynamic.RazorEngine_307550d987a64549bb0d589e7eba6df9.Execute() in D:\inetpub\wwwroot\www.kwpn.nl\Files\Templates\Designs\Kwpn\Paragraph\HorsesForSaleCarousel.cshtml:line 48
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 Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using System.Globalization; 3 @using System.Web.Mvc; 4 @using Kwpn.Repository.Helpers; 5 @using Kwpn.Models.Viewmodels; 6 @using Kwpn.Repository.Extensions; 7 @using Kwpn.Models.Constants; 8 9 10 @{ 11 var marketplaceService = DependencyResolver.Current.GetService<Kwpn.Core.Services.Abstract.IMarketplaceSellHorseService>(); 12 13 var itemType = Dynamicweb.Frontend.PageView.Current().CurrentParagraph.ItemType; 14 if (itemType.Equals(Kwpn.Models.Constants.StringConstants.ItemTypes.MarketplaceTopX)) 15 { 16 var paragraphId = GetInteger("Global.ParagraphId"); 17 var titleClass = GetString("Item.TitleClass.Value"); 18 var addBottomMargin = GetBoolean("Item.AddBottomMargin.Value"); 19 var bottomClass = addBottomMargin ? "bottom-margin" : ""; 20 var category = GetString("Item.Category.Value"); 21 var text = GetString("Item.Text.Value"); 22 var countDesktop = GetInteger("Item.DesktopCount"); 23 var countMobile = GetInteger("Item.MobileCount"); 24 var max = Math.Max(countDesktop, countMobile); 25 var categoryFilter = "none"; 26 var hideRightButton = false; 27 if (category.Equals("ItemType_MarketplaceSellHorseAdvert") && !string.IsNullOrWhiteSpace(GetString("Item.BreedingDirectionFilter.Value"))) 28 { 29 categoryFilter = GetString("Item.BreedingDirectionFilter.Value"); 30 } 31 32 var cultureInfo = new CultureInfo(GetGlobalValue("Global:Area.LongLang")); 33 var marketplacePageId = Kwpn.Repository.Helpers.AreaHelper.GetMarketplacePageId(Dynamicweb.Frontend.PageView.Current().Area.Culture); 34 var view = category.Equals("ItemType_MarketplaceHorseSearch") ? Translate("Marketplace_RiderSearchesHorse", "Rider searches horse").Replace(" ", "-") : "default"; 35 var moreAdvertsLink = $"/Default.aspx?ID={marketplacePageId}&view={view}"; 36 if (!string.IsNullOrWhiteSpace(categoryFilter) && !string.Equals(categoryFilter, "none", StringComparison.OrdinalIgnoreCase)) 37 { 38 moreAdvertsLink += $"&preselect={categoryFilter}"; 39 } 40 41 var carouselId = $"carousel-{GetInteger("Global.ParagraphId").ToString()}"; 42 var carouselInterval = "false"; // false or set interval in ms 43 var carouselPeakNext = false; 44 var carouselResponsiveness = carouselPeakNext ? "col-xs-11 col-md-10 " : "col-xs-12 col-centered"; 45 46 bool isSellHorse = category.Equals("ItemType_MarketplaceSellHorseAdvert"); 47 48 var results = isSellHorse 49 ? marketplaceService.GetSellHorse(x => (x.IsActive.HasValue && x.IsActive.Value) && !x.DateRemoved.HasValue && x.DateTo.HasValue && x.DateTo.Value >= DateTime.Now) 50 : marketplaceService.GetSearchHorse(x => (x.IsActive.HasValue && x.IsActive.Value) && !x.DateRemoved.HasValue && x.DateTo.HasValue && x.DateTo.Value >= DateTime.Now); 51 52 <div class="container horses-for-sale @bottomClass" id="horses-for-sale-@paragraphId"> 53 @if (!titleClass.Equals("Hidden")) 54 { 55 var title = string.Format("<{0}>{1}</{0}>", titleClass, GetString("Item.Title.Value")); 56 <div class="row"> 57 <div class="col-xs-12 col-sm-6 col-md-8 col-lg-9"> 58 @title 59 </div> 60 <div class="hidden-xs col-sm-6 col-md-4 col-lg-3 more-adverts"> 61 <a href="@moreAdvertsLink" class="orange_arrow_link">@Translate("MarketplaceTopX_ViewMore", "View more adverts")</a> 62 </div> 63 </div> 64 } 65 66 @if (!string.IsNullOrWhiteSpace(text) && text.Length > 10) 67 { 68 <div class="row"> 69 <div class="col-xs-12 intro"> 70 @text 71 </div> 72 </div> 73 } 74 75 <div class="break-grid-extra"> 76 <div class="row"> 77 <div class="@carouselResponsiveness"> 78 <div id="@carouselId" class="carousel carousel-multi slide" data-ride="carousel" data-type="multi" data-interval="@carouselInterval"> 79 <div class="carousel-inner"> 80 @if (results != null && results.Any()) 81 { 82 foreach (var (item, index) in results.WithIndex()) 83 { 84 var itemIdPrefix = isSellHorse 85 ? StringConstants.ItemTypes.MarketplaceSellHorseAdvert 86 : StringConstants.ItemTypes.MarketplaceHorseSearchAdvert; 87 88 var sinceDate = item.DateFrom; 89 var itemDateTime = FormatHelpers.GetDateTime(sinceDate, null, cultureInfo, Translate("EventDateDevider", "to")); 90 91 <div class="item @(index == 0 ? "active" : "")"> 92 <div class="carousel-col"> 93 <div class="block clickable @(isSellHorse ? "" : "horse-search") @(item.IsTopAdvert ? "topadvert" : "")" data-url=@($"/Default.aspx?ID={marketplaceService.PageID}&itemId={itemIdPrefix}:{item.Id}") data-horsecode="@(isSellHorse ? item.AnimalCode : item.PersonCode)"> 94 <div class="image" style="background-image: url('@item.Photo1')"> 95 <div class="datesince">@Translate("Marketplace_Since", "Since") @itemDateTime</div> 96 </div> 97 <div class="divider"></div> 98 <div class="bottom"> 99 @if (isSellHorse) 100 { 101 if (item.IsTopAdvert) 102 { 103 <div class="top"> 104 <img src="/Files/Templates/Designs/Kwpn/Images/icon-star-filled.svg" class="icon" /> 105 @Translate("Marketplace_Top", "Top").ToUpper() 106 </div> 107 } 108 <div class="name truncate-overflow"> 109 @(item.Gender == Kwpn.Models.Enumerations.Gender.MERRIE.ToString() ? 110 string.Format("<img src = '/Files/Templates/Designs/Kwpn/Images/icon-female.svg' class='icon' title='{0}' />", Translate(Kwpn.Models.Enumerations.Gender.MERRIE.ToString())) : 111 string.Format("<img src = '/Files/Templates/Designs/Kwpn/Images/icon-male.svg' class='icon' title='{0}' />", Translate(Kwpn.Models.Enumerations.Gender.HENGST.ToString())) 112 ) 113 @item.AnimalName@(item.Age >= 0 ? string.Format(", {0} {1}", item.Age, Translate("Marketplace_Years", "Years").ToUpper()) : "") 114 </div> 115 <div class="pedigree truncate-overflow"> 116 <img src="/Files/Templates/Designs/Kwpn/Images/icon-price-tag.svg" class="icon" /> 117 @item.FatherName x @item.MothersFatherName 118 </div> 119 <div class="price truncate-overflow"> 120 <img src="/Files/Templates/Designs/Kwpn/Images/icon-wallet.svg" class="icon" /> 121 @item.PriceLabel 122 </div> 123 } 124 else 125 { 126 <div class="name truncate-overflow">@item.Title</div> 127 <div class="location truncate-overflow">@(item.Province != "" ? item.Province : item.Country)</div> 128 } 129 </div> 130 </div> 131 </div> 132 </div> 133 } 134 } 135 </div> 136 137 <!-- Controls --> 138 <div class="left carousel-control"> 139 <a href="#@carouselId" role="button" data-slide="prev"> 140 <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> 141 <span class="sr-only">Previous</span> 142 </a> 143 </div> 144 <div class="right carousel-control"> 145 <a href="#@carouselId" role="button" data-slide="next"> 146 <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> 147 <span class="sr-only">Next</span> 148 </a> 149 </div> 150 </div> 151 </div> 152 </div> 153 </div> 154 <div class="row"> 155 <div class="col-xs-12 hidden-sm hidden-md hidden-lg more-adverts more-adverts-bottom"> 156 <a href="@moreAdvertsLink" class="orange_arrow_link">@Translate("MarketplaceTopX_ViewMore", "View more adverts")</a> 157 </div> 158 </div> 159 </div> 160 161 @SnippetStart("JavascriptsBottom") 162 <script> 163 $(function () { 164 CarouselHelper.Initiate('@carouselId'); 165 }); 166 </script> 167 @SnippetEnd("JavascriptsBottom") 168 } 169 }

Official Partners


Cookies on the KWPN website

We request your agreement to the use of cookies on our website. More information is available on our cookie policy page.

Cookie Policy