Apply
Error executing template "Designs/Kwpn/ItemPublisher/Details/NewsDetail.cshtml"
System.IO.IOException: The process cannot access the file 'D:\inetpub\wwwroot\www.kwpn.nl\Files\Templates\Designs\Kwpn\Translations.xml' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at Dynamicweb.Rendering.Translation.Source.WriteDocument(XmlDocument document)
at Dynamicweb.Rendering.Translation.Source.Save()
at Dynamicweb.Rendering.Translation.Source.UpdateTranslationSource(Source source, IEnumerable`1 newKeys, String designName, IEnumerable`1 cultures)
at Dynamicweb.Rendering.TemplateBase`1.Translate(String text, String defaultValue, String cultureName)
at CompiledRazorTemplates.Dynamic.RazorEngine_4d6dc7e28b644bf08a17a5bd065d1ab2.Execute() in D:\inetpub\wwwroot\www.kwpn.nl\Files\Templates\Designs\Kwpn\ItemPublisher\Details\NewsDetail.cshtml:line 223
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.b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @using System.Globalization 2 @using System.Linq 3 @using Kwpn.Models.Constants 4 @using Kwpn.Models.Enumerations 5 @using Kwpn.Repository.Helpers 6 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7 @{ 8 var culture = GetGlobalValue("Global:Area.LongLang"); 9 var cultureInfo = new CultureInfo(GetGlobalValue("Global:Area.LongLang")); 10 var newsParagraphId = GetInteger("ItemPublisher:Global.ParagraphId"); 11 12 // news detail 13 var newsTitle = GetString("ItemPublisher:Item.NewsTitle.Value"); 14 var newsDate = GetDate("ItemPublisher:Item.NewsDate.Value"); 15 var newsDateTime = FormatHelpers.GetDateTime(newsDate, null, cultureInfo, Translate("EventDateDevider", "to")); 16 var newsText = GetString("ItemPublisher:Item.NewsText.Value"); 17 if (!string.IsNullOrEmpty(newsText) && !(newsText.IndexOf("<p>") >= 0 || newsText.IndexOf("<br>") >= 0)) 18 { 19 newsText = newsText.Replace("\n", "<br />"); 20 } 21 22 //image 23 var newsCategories = GetString("ItemPublisher:Item.NewsCategories.Value"); 24 var newsImage = GetString("ItemPublisher:Item.NewsImage.Value"); 25 if (string.IsNullOrWhiteSpace(newsImage) && !string.IsNullOrWhiteSpace(newsCategories)) 26 { 27 newsImage = ImageHelper.GetDefaultImageByCategory(ImageType.NewsCategoryImage, newsCategories.Split(',').FirstOrDefault().Trim()); 28 } 29 30 // extra 31 var noteText = GetString("ItemPublisher:Item.NoteText.Value"); 32 var newsRegion = KwpnNewsHelper.GetNewsRegion(GetString("ItemPublisher:Item.Regions"), culture, noteText); 33 if (!string.IsNullOrWhiteSpace(noteText)) { noteText = string.Format("<div class='note'>{0}</div>", noteText); } 34 var hightlightText = GetString("ItemPublisher:Item.HighlightText.Value"); 35 if (!string.IsNullOrWhiteSpace(hightlightText)) { hightlightText = string.Format("<div class='highlight'>{0}</div>", hightlightText); } 36 var notification = GetString("ItemPublisher:Item.Notification.Value"); 37 38 // linked horsed 39 var linkedHorses = HorseHelper.GetHorsesByAnimalCodes(GetString("ItemPublisher:Item.Horses.Value"), GetGlobalValue("Global:Area.LongLang")); 40 var iLinkedHorseCounter = 0; 41 42 // linked 43 var listOfEventItems = new List<Dynamicweb.Content.Items.Item>(); 44 var kwpnEvents = GetString("ItemPublisher:Item.KwpnEvents.Value"); 45 if (!string.IsNullOrWhiteSpace(kwpnEvents)) 46 { 47 var kwpnEventIdList = kwpnEvents.Split(',').ToList(); 48 foreach (var kwpnEventId in kwpnEventIdList) 49 { 50 var eventItem = Dynamicweb.Content.Items.ItemManager.Storage.GetById(StringConstants.ItemTypes.Event, kwpnEventId); 51 if (eventItem != null) 52 { 53 listOfEventItems.Add(eventItem); 54 } 55 } 56 } 57 58 var showAside = (listOfEventItems.Any() || linkedHorses.Any()); 59 60 var imageMdClass = "col-md-12"; 61 var contentMdClass = "col-md-7 col-md-pull-4"; 62 63 // social media share 64 var openGraphTitle = newsTitle; 65 var openGraphUrl = string.Format("{0}{1}", AreaHelper.GetHost(), System.Web.HttpContext.Current.Request.RawUrl); 66 var openGraphImage = newsImage; 67 var openGraphDefaultImage = string.Format("{0}/Files/Templates/Designs/Kwpn/Images/OpenGraph_NoImg.jpg", AreaHelper.GetHost()); 68 if (string.IsNullOrWhiteSpace(openGraphImage)) 69 { 70 var images = FormatHelpers.GetImagesInHTMLString(GetString("ItemPublisher:Item.NewsText.Value")); 71 var firstImage = ""; 72 if (images.Any()) 73 { 74 firstImage = images.FirstOrDefault(); 75 if (!string.IsNullOrWhiteSpace(firstImage)) 76 { 77 openGraphImage = System.Text.RegularExpressions.Regex.Match(firstImage, "<img.+?src=[\"'](.+?)[\"'].+?>", System.Text.RegularExpressions.RegexOptions.IgnoreCase).Groups[1].Value; 78 79 } 80 } 81 } 82 if (string.IsNullOrWhiteSpace(openGraphImage) || openGraphImage.Length < 10) // root directory left overs negeren: /Files/ 83 { 84 openGraphImage = openGraphDefaultImage; 85 } 86 var openGraphDescription = GetString("ItemPublisher:Item.NewsText.Value").HtmlRemove().ClipLength(100, true); 87 var openGraphLocale = GetGlobalValue("Global:Area.LongLang").Replace("-", "_"); 88 var openGraphSiteName = Translate("OpenGraph_SiteName", "KWPN Royal Dutch Sport Horse"); 89 90 // SEO: seoPage is used as base url for virtual pageviews 91 var seoPage = GetGlobalValue("Global:Pageview.Url"); 92 if (seoPage.Contains("?")) 93 { 94 seoPage = seoPage.Split('?')[0]; 95 } 96 seoPage = string.Format("{0}/{1}/{2}", seoPage, GetString("ItemPublisher:Item.Field.Id"), GetString("ItemPublisher:Item.NewsTitle.Value").Replace(" ", "-").ToLower().UrlEncode()); 97 98 var videoId1 = GetInteger("ItemPublisher:Item.VideoId1.Value"); 99 var videoId2 = GetInteger("ItemPublisher:Item.VideoId2.Value"); 100 var videoId3 = GetInteger("ItemPublisher:Item.VideoId3.Value"); 101 var videoId4 = GetInteger("ItemPublisher:Item.VideoId4.Value"); 102 var hasVideo = videoId1 > 0 || videoId2 > 0 || videoId3 > 0 || videoId4 > 0; 103 104 <div class="break-grid content-container page-content-aside" id="news-detail"> 105 <div class="break-grid-background"> 106 <div class="in-grid news-content"> 107 <div class="row"> 108 <div class="background-head-aside-xs"> 109 <div class="background-head-xs"> 110 <div class="col-xs-12 page-header"> 111 <div class="row"> 112 <div class="col-xs-12 col-md-7"> 113 <div class="row"> 114 @if (!string.IsNullOrWhiteSpace(noteText)) 115 { 116 <div class="col-md-6 hidden-xs hidden-sm">@noteText</div> 117 } 118 @if (!string.IsNullOrWhiteSpace(hightlightText)) 119 { 120 <div class="col-md-6 hidden-xs hidden-sm">@hightlightText</div> 121 } 122 </div> 123 <div class="row"> 124 <div class="col-xs-12"> 125 <h1>@newsTitle</h1> 126 </div> 127 </div> 128 <div class="row"> 129 <div class="col-xs-12"> 130 @if (!string.IsNullOrWhiteSpace(newsDateTime)) 131 { 132 <span class="date"><i class="fa fa-clock-o"></i> @newsDateTime</span> 133 } 134 <div class="visible-xs"></div> 135 @if (!string.IsNullOrWhiteSpace(newsRegion)) 136 { 137 <span class="region"><i class="fa fa-location-arrow"></i> @newsRegion</span> 138 } 139 </div> 140 </div> 141 </div> 142 @if (!string.IsNullOrEmpty(newsImage)) 143 { 144 <div class="col-xs-12 hidden-md hidden-lg"> 145 <div class="news-image"><img src="@newsImage" alt="News image" /></div> 146 </div> 147 } 148 @if (!string.IsNullOrWhiteSpace(noteText)) 149 {<div class="col-xs-12 hidden-md hidden-lg">@noteText</div>} 150 @if (!string.IsNullOrWhiteSpace(hightlightText)) 151 {<div class="col-xs-12 hidden-md hidden-lg">@hightlightText</div>} 152 @if (!string.IsNullOrWhiteSpace(notification)) 153 { 154 <div class="col-xs-12 hidden-md hidden-lg"> 155 <div class="notification"> 156 @notification 157 </div> 158 </div> 159 } 160 </div> 161 </div> 162 </div> 163 <div class="background-aside-xs"> 164 <aside class="col-xs-12 col-md-4 col-md-push-8 news-detail-aside"> 165 166 <div class="google-container google-container--size--b google-container--center google-container--margin-bottom"> 167 <!--onderstaande afbeelding moet worden verwijderd en vervangen worden door google admanager data--> 168 <img src="/Files/Templates/Designs/Kwpn/Images/BannerTemp-B.jpg" /> 169 </div> 170 171 @if (showAside) 172 { 173 <div class="page-aside"> 174 @if (linkedHorses.Any()) 175 { 176 <h2 id="linkedhorses-aside-title" data-childId="linkedhorses-aside-content" class="notactive"><span>@Translate("LinkedHorses", "Linked horses")</span></h2> 177 <div id="linkedhorses-aside-content" class="aside-content notactive"> 178 <div class="linkedHorses"> 179 @foreach (var linkedHorse in linkedHorses) 180 { 181 // modulo for row color display 182 var mod = "0"; 183 if (iLinkedHorseCounter % 2 == 0) 184 { 185 mod = "1"; 186 } 187 188 // gender info 189 var genderClass = "fa-question"; 190 var genderAbbr = ""; 191 var gender = Kwpn.Models.Enumerations.Gender.UNKNOWN; 192 Enum.TryParse(linkedHorse.Gender.ToUpper(), out gender); 193 switch (gender) 194 { 195 case Kwpn.Models.Enumerations.Gender.HENGST: 196 genderClass = "fa-mars"; 197 genderAbbr = Translate("Stallion", "Stallion"); 198 break; 199 case Kwpn.Models.Enumerations.Gender.MERRIE: 200 genderClass = "fa-venus"; 201 genderAbbr = Translate("Mare", "Mare"); 202 break; 203 case Kwpn.Models.Enumerations.Gender.RUIN: 204 genderClass = "fa-mars"; //fa-mars-stroke-h 205 genderAbbr = Translate("Gelding", "Gelding"); 206 break; 207 } 208 209 // horse info 210 var horseName = HorseHelper.GetHorseName(linkedHorse.SportsName, linkedHorse.AnimalName, linkedHorse.DateOfBirth); 211 212 // father info 213 var fatherName = ""; 214 var father = linkedHorse.GetPredigreeByPrefix(Kwpn.Models.Constants.StringConstants.PedigreePrefixes.Father); 215 if (father != null) 216 { 217 fatherName = father.AnimalName; 218 } 219 else 220 { 221 fatherName = Translate("Unknown", "Unknown"); 222 } 223 var fatherNameAbbr = Translate("FathersName", "Fathers name").JsEncode(); 224 225 // mothers father info 226 var mothersFatherName = ""; 227 var mothersFather = linkedHorse.GetPredigreeByPrefix(Kwpn.Models.Constants.StringConstants.PedigreePrefixes.MothersFather); 228 if (mothersFather != null) 229 { 230 mothersFatherName = mothersFather.AnimalName; 231 } 232 else 233 { 234 mothersFatherName = Translate("Unknown", "Unknown"); 235 } 236 var mothersFatherNameAbbr = Translate("MothersFathersName", "Mothers fathers name").JsEncode(); 237 var databaseLink = HorseHelper.GetHorseInfoPageUrl(GetGlobalValue("Global:Area.LongLang"), linkedHorse.AnimalCode); 238 <a href="@databaseLink"> 239 <div class="row mod-@mod"> 240 <div class="col-xs-2"> 241 <span class="gender"><i class="fa @genderClass" title='@genderAbbr.JsEncode()'></i></span> 242 </div> 243 <div class="col-xs-10"> 244 <span class="name">@horseName</span> 245 <span class="parents"> 246 <abbr title='@fatherNameAbbr'>@fatherName</abbr> x <abbr title='@mothersFatherNameAbbr'>@mothersFatherName</abbr> 247 </span> 248 </div> 249 </div> 250 </a> 251 iLinkedHorseCounter++; 252 } 253 </div> 254 </div> 255 } 256 @if (listOfEventItems.Any()) 257 { 258 var kwpnEventCounter = 0; 259 var eventPageId = AreaHelper.GetAreaItemStringValueBySystemName(StringConstants.PageIdSystemNames.EventPageId); 260 261 if (!string.IsNullOrWhiteSpace(eventPageId)) 262 { 263 <h2 id="linkedevents-aside-title" data-childId="linkedevents-aside-content" class="notactive"><span>@Translate("LinkedEvents", "Linked events")</span></h2> 264 <div id="linkedevents-aside-content" class="aside-content notactive"> 265 <div class="linkedEvents"> 266 @foreach (var kwpnEvent in listOfEventItems) 267 { 268 // modulo for row color display 269 var mod = "0"; 270 if (kwpnEventCounter % 2 == 0) 271 { 272 mod = "1"; 273 } 274 var kwpnEventId = ItemHelper.GetItemValue<int>(kwpnEvent, StringConstants.ItemTypes.Event_Id); 275 var kwpnEventTitle = ItemHelper.GetItemValue<string>(kwpnEvent, StringConstants.ItemTypes.Event_Title); 276 var dateFrom = ItemHelper.GetItemValue<DateTime>(kwpnEvent, StringConstants.ItemTypes.Event_FromDate); 277 var dateTo = ItemHelper.GetItemValue<DateTime>(kwpnEvent, StringConstants.ItemTypes.Event_ToDate); 278 var eventDateTime = FormatHelpers.GetDateTime(dateFrom, dateTo, cultureInfo, Translate("EventDateDevider", "to")); 279 var kwpnEventLink = string.Format("/Default.aspx?ID={0}&itemId={1}:{2}", eventPageId, StringConstants.ItemTypes.Event, kwpnEventId); 280 var customPageLink = ItemHelper.GetItemValue<string>(kwpnEvent, StringConstants.ItemTypes.Event_CustomEventPage); 281 if (!string.IsNullOrEmpty(customPageLink)) 282 { 283 kwpnEventLink = customPageLink; 284 } 285 <a href="@kwpnEventLink"> 286 <div class="row mod-@mod"> 287 <div class="col-xs-2"> 288 <span class="clock"><i class="fa fa-clock-o"></i></span> 289 </div> 290 <div class="col-xs-10"> 291 <span class="date-time">@eventDateTime</span> 292 <span class="title">@kwpnEventTitle</span> 293 </div> 294 </div> 295 </a> 296 kwpnEventCounter++; 297 } 298 </div> 299 </div> 300 } 301 } 302 </div> 303 } 304 305 306 307 </aside> 308 </div> 309 </div> 310 311 <article class="col-xs-12 @contentMdClass page-content news-detail-output"> 312 @if (!string.IsNullOrWhiteSpace(notification)) 313 { 314 <div class="row"> 315 <div class="hidden-xs hidden-sm col-md-12"> 316 <div class="notification"> 317 @notification 318 </div> 319 </div> 320 </div> 321 } 322 323 @*IMAGE FOR LARGE VIEW*@ 324 @if (!string.IsNullOrEmpty(newsImage)) 325 { 326 <div class="row hidden-xs hidden-sm"> 327 <div class="@imageMdClass"> 328 <div class="news-image" style="background-image: url('@newsImage');"> 329 </div> 330 </div> 331 </div> 332 } 333 334 @if (!string.IsNullOrWhiteSpace(newsText)) 335 { 336 <div class="row"> 337 <div class="col-xs-12 news-par"> 338 @newsText 339 </div> 340 </div> 341 } 342 @if (hasVideo) 343 { 344 <div class="row kwpntv"> 345 <div class="col-xs-12 kwpntv--category-topx"> 346 <div class="result-container kwpntv-news-video-results" id="kwpntv-news-video-results-@newsParagraphId"></div> 347 </div> 348 </div> 349 @SnippetStart("JavascriptsBottom") 350 <script id="news-video-template-@newsParagraphId" type="text/html"> 351 {{if EmbedURL}} 352 <div class="col-xs-12 col-md-6"> 353 <a href="${EmbedURL}" target="_blank"> 354 <div class="embed-responsive embed-responsive-16by9"> 355 <img src="${Thumb}" /> 356 </div> 357 <div class="embed-title"> 358 {{if Title}} 359 <h3>${Title}</h3> 360 {{/if}} 361 </div> 362 {{if Duration}} 363 <div class="duration">${VideoHelper.ConvertDuraton(Duration)}</div> 364 {{/if}} 365 </a> 366 </div> 367 {{/if}} 368 </script> 369 <script> 370 $(document).ready(function () { 371 var videoContainer = $("#kwpntv-news-video-results-@newsParagraphId"); 372 videoContainer.html(""); // remove spinner 373 @for (int i = 1; i < 5; i++) 374 { 375 var videoId = GetInteger($"ItemPublisher:Item.VideoId{i}.Value"); 376 if (videoId > 0) { 377 <text> 378 var getVideoUrl = "/kwpnwebapi/videos/getvideobyid/@culture/@videoId"; 379 $.getJSON(getVideoUrl).done(function(video) { 380 if (video != null) 381 { 382 $("#news-video-template-@newsParagraphId").tmpl(video).appendTo(videoContainer); 383 } 384 }).fail(function(jqxhr, textStatus, error) { 385 var err = textStatus + ", " + error; 386 console.error("Request get video by id failed: " + err); 387 }); 388 </text> 389 } 390 } 391 }); 392 </script> 393 @SnippetEnd("JavascriptsBottom") 394 } 395 <div class="row"> 396 <div class="col-xs-12 col-md-6"> 397 <a href="javascript:history.back();" class="backlink"><i class="fa fa-chevron-left"></i>@Translate("BackToOverview", "Back to overview")</a> 398 </div> 399 <div class="col-xs-12 col-md-6"> 400 <div class="socialmediashare pull-right"> 401 <!-- AddToAny BEGIN --> 402 <div class="a2a_kit a2a_kit_size_32 a2a_default_style"> 403 <a class="a2a_dd" href="https://www.addtoany.com/share"></a> 404 <a class="a2a_button_facebook"></a> 405 <a class="a2a_button_twitter"></a> 406 <a class="a2a_button_google_plus"></a> 407 </div> 408 <script async src="https://static.addtoany.com/menu/page.js"></script> 409 <!-- AddToAny END --> 410 </div> 411 </div> 412 </div> 413 </article> 414 </div> 415 </div> 416 </div> 417 </div> 418 419 @SnippetStart("HeaderContent") 420 <meta property="og:title" content="@openGraphTitle" /> 421 <meta property="og:type" content="article" /> 422 <meta property="og:url" content="@openGraphUrl" /> 423 <meta property="og:image" content="@openGraphImage" /> 424 <meta property="og:description" content="@openGraphDescription" /> 425 <meta property="og:locale" content="@openGraphLocale" /> 426 <meta property="og:site_name" content="@openGraphSiteName" /> 427 <meta property="fb:app_id" content="234190117053664" /> 428 <script> 429 SEO.trackPageView("@seoPage"); 430 </script> 431 @SnippetEnd("HeaderContent") 432 }
€ 121.30 per year

KWPN Membership

  • Subscription to the montlhy digital KWPN Magazine (in Dutch)
  • Free advertising at KWPN Horses for Sale
Become a member now

About the KWPN

The KWPN (Studbook of the Royal Dutch Sport Horse) is a Netherlands-based organization specializing in the breeding of jumpers, dressage horses, harness horses, and Gelder horses.

More info

Official Partners