Error executing template "Designs/Kwpn/ItemPublisher/List/EventList.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.Template.TranslateText(String text, String defaultValue, String cultureName) at Dynamicweb.Rendering.TemplateBase`1.Translate(String text, String defaultValue) at CompiledRazorTemplates.Dynamic.RazorEngine_e7e26fac0fd34fd7a7a60e7bc9f78036.Execute() in D:\inetpub\wwwroot\www.kwpn.nl\Files\Templates\Designs\Kwpn\ItemPublisher\List\EventList.cshtml:line 163 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 @using System 2 @using Kwpn.Repository.Helpers 3 @using System.Globalization 4 @using Kwpn.Models.Constants 5 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 6 @{ 7 var culture = GetGlobalValue("Global:Area.LongLang"); 8 List<LoopItem> kwpnEvents = GetLoop("ItemPublisher:Items.List"); 9 if (kwpnEvents != null && kwpnEvents.Count > 0) 10 { 11 12 13 string EventsPageId = AreaHelper.GetAreaItemStringValueBySystemName(StringConstants.PageIdSystemNames.EventPageId); 14 // get animal code from querystring or form post, sample value: p - 000306 15 string animalCode = System.Web.HttpContext.Current.Request.QueryString.Get(Translate("Horse", "Horse")); 16 if (string.IsNullOrEmpty(animalCode)) { animalCode = System.Web.HttpContext.Current.Request.Form.Get(Translate("Horse", "Horse")); } 17 18 CultureInfo cultureInfo = new CultureInfo(GetGlobalValue("Global:Area.LongLang")); 19 20 string filterEventDateFrom = System.Web.HttpContext.Current.Request.Form.Get("eventfrom"); 21 string filterEventDateTo = System.Web.HttpContext.Current.Request.Form.Get("eventto"); 22 23 if (string.IsNullOrEmpty(filterEventDateFrom)) 24 { 25 // default start date is today 26 filterEventDateFrom = DateTime.Today.ToString("d", cultureInfo); 27 } 28 29 if (string.IsNullOrEmpty(filterEventDateTo)) 30 { 31 // default to date is today + 1 year 32 filterEventDateTo = DateTime.Today.AddYears(1).ToString("d", cultureInfo); 33 } 34 35 string filterEventCategories = System.Web.HttpContext.Current.Request.Form.Get("category"); 36 string filterEventRegions = string.Empty; 37 bool selectedEvents = false; 38 //check if querystring parameter for category or region is used, they overrule form/cookie parameters 39 if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.QueryString.Get("category")) || 40 !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.QueryString.Get("region"))) 41 { 42 filterEventCategories = System.Web.HttpContext.Current.Request.QueryString.Get("category"); 43 filterEventRegions = System.Web.HttpContext.Current.Request.QueryString.Get("region"); 44 selectedEvents = true; 45 } 46 List<string> filterEventCategoriesList = new List<string>(); 47 if (!string.IsNullOrEmpty(filterEventCategories)) 48 { 49 filterEventCategoriesList.AddRange(filterEventCategories.Split(',')); 50 } 51 52 // SEO: seoPage is used as base url for virtual pageviews 53 var seoPage = GetGlobalValue("Global:Pageview.Url"); 54 if (seoPage.Contains("?")) 55 { 56 seoPage = seoPage.Split('?')[0]; 57 } 58 if (!string.IsNullOrWhiteSpace(filterEventCategories)) 59 { 60 seoPage = string.Format("{0}/{1}", seoPage, filterEventCategories.ToLower()); 61 } 62 else 63 { 64 seoPage = string.Format("{0}/{1}", seoPage, Translate("SEO_TrackPageviewPage_NoEventCategoryFilter", "no-categories").ToLower()); 65 } 66 seoPage = string.Format("{0}/{1}/{2}", seoPage, filterEventDateFrom.ToLower(), filterEventDateTo.ToLower()); 67 68 69 // get filtered events 70 kwpnEvents = KwpnEventHelper.FilterEvents(kwpnEvents, 71 cultureInfo, 72 filterEventDateFrom, 73 filterEventDateTo, 74 filterEventCategories, 75 filterEventRegions, 76 animalCode, 77 "asc", 78 DateTime.Today, 79 null, 80 DateTime.Today, 81 null); 82 83 string eventResultsPageUrl = AreaHelper.CreateUrlBySystemName(StringConstants.PageIdSystemNames.EventResultsPageId); 84 85 86 87 <div class="break-grid content-container page-content-aside event-list"> 88 <div class="break-grid-background"> 89 <div class="in-grid"> 90 <div class="row"> 91 92 <div class="background-head-aside-xs"> 93 94 <div class="background-head-xs agenda contentFilterHolder @(selectedEvents ? "selected" : "")"> 95 @if (selectedEvents) 96 { 97 98 <div class="col-xs-12 col-md-4 pull-right"> 99 <a class="orange_arrow_link pull-right" href="/Default.aspx?ID=@EventsPageId">@Translate("MoreEvents", "More events")</a> 100 </div> 101 <div class="hidden-xs col-md-8 title"> 102 <h2>@Translate("SelectedEvents", "Selected events")</h2> 103 <div class="selectedNewsSettings">@KwpnNewsHelper.GetSelectedSubheader(filterEventCategories, filterEventRegions, cultureInfo)</div> 104 </div> 105 } 106 else 107 { 108 <div class="col-xs-12 hidden-xs hidden-sm eventResultLink"> 109 @if (!string.IsNullOrEmpty(eventResultsPageUrl)) 110 {<a href="@eventResultsPageUrl" class="orange_arrow_link">@Translate("ToResults", "To results")</a>} 111 </div> 112 <div class="col-md-12 page-header title"> 113 <h2> 114 @Translate("UpcomingEventsForYou", "Upcoming events for") 115 @if (culture.Equals("nl-NL", StringComparison.InvariantCultureIgnoreCase)) 116 { 117 <a class="content-filter-activator"> 118 @Translate("You", "you") <i class="fa fa-chevron-down hidden-xs hidden-sm"></i> 119 </a> 120 } 121 </h2> 122 </div> 123 <div class="row"> 124 <div class="col-xs-12 filter"></div> 125 </div> 126 } 127 </div> 128 129 <div class="background-aside-xs"> 130 131 <aside class="col-xs-12 col-md-4 col-md-push-8 event-list-filter"> 132 133 <!-- /204473129/AgendaOverzicht/Banner1 --> 134 <div id='div-gpt-ad-banner1-1' class="google-container google-container--size--b google-container--center google-container--margin-bottom"> 135 <script> 136 googletag.cmd.push(function () { googletag.display('div-gpt-ad-banner1-1'); }); 137 </script> 138 </div> 139 140 <div class="page-aside"> 141 @{ 142 <form name="KwpnEventFilter" id="KwpnEventFilter" method="POST"> 143 @if (!selectedEvents) 144 { 145 List<Kwpn.Repository.Kwpn_KwpnEventCategories> kwpnEventCategories = KwpnEventHelper.GetEventCategories(GetGlobalValue("Global:Area.LongLang")); 146 if (kwpnEventCategories != null && kwpnEventCategories.Count > 0) 147 { 148 149 <h2 id="categories-aside-title" data-childId="categories-aside-content" class="notactive"><span>@Translate("Category", "Category")</span></h2> 150 <div id="categories-aside-content" class="aside-content notactive"> 151 @foreach (Kwpn.Repository.Kwpn_KwpnEventCategories category in kwpnEventCategories) 152 { 153 <div class="checkbox"> 154 <label> 155 <input type="checkbox" name="category" id='@category.Value.JsEncode()' value='@category.Value.JsEncode()' @if (filterEventCategoriesList.Contains(category.Value)) { <text> checked="checked" </text> }>@category.Label 156 </label> 157 </div> 158 } 159 </div> 160 } 161 } 162 163 <h2 id="period-aside-title" data-childId="period-aside-content" class="notactive"><span>@Translate("Period", "Period")</span></h2> 164 <div id="period-aside-content" class="aside-content notactive"> 165 <div class="form-group"> 166 <div class="input-group date"> 167 <input type="text" class="form-control" name="eventfrom" id="eventfrom" placeholder='@Translate("StartDate", "Start date")' value='@filterEventDateFrom' /> 168 </div> 169 </div> 170 <div class="form-group"> 171 <div class="input-group date"> 172 <input type="text" class="form-control" name="eventto" id="eventto" placeholder='@Translate("EndDate", "End date")' value='@filterEventDateTo' /> 173 </div> 174 </div> 175 </div> 176 177 <input type="submit" class="hidden" value="filter" id="submitfilter" /> 178 </form> 179 } 180 </div> 181 182 183 </aside> 184 185 </div> 186 <div class="col-xs-12 hidden-md hidden-lg eventResultLink"> 187 @if (!string.IsNullOrEmpty(eventResultsPageUrl)) 188 {<a href="@eventResultsPageUrl" class="orange_arrow_link">@Translate("ToResults", "To results")</a>} 189 </div> 190 191 </div> 192 193 <article class="col-xs-12 col-md-7 col-md-pull-4 page-content event-list-output" id="event-list-output"> 194 @if (kwpnEvents != null && kwpnEvents.Count > 0) 195 { 196 int showCounter = 1; 197 foreach (LoopItem kwpnEvent in kwpnEvents) 198 { 199 // modulo for row color display 200 string mod = "0"; 201 if (showCounter % 2 == 0) { mod = "1"; } 202 203 string eventTitle = kwpnEvent.GetString("ItemPublisher:Item.EventTitle"); 204 string eventPlace = kwpnEvent.GetString("ItemPublisher:Item.EventPlace.Value"); 205 if (!string.IsNullOrEmpty(eventPlace)) { eventTitle = string.Format("{0}, {1}", eventTitle, eventPlace); } 206 string eventCode = kwpnEvent.GetString("ItemPublisher:Item.EventCode"); 207 DateTime dateFrom = kwpnEvent.GetDate("ItemPublisher:Item.EventDateFrom"); 208 DateTime dateTo = kwpnEvent.GetDate("ItemPublisher:Item.EventDateTo"); 209 string eventDateTime = FormatHelpers.GetDateTime(dateFrom, dateTo, cultureInfo, Translate("EventDateDevider", "to")); 210 211 string link = kwpnEvent.GetString("ItemPublisher:Item.DetailsUrl"); 212 string customPageLink = kwpnEvent.GetString("ItemPublisher:Item.CustomEventPage"); 213 if (!string.IsNullOrEmpty(customPageLink)) 214 { 215 link = customPageLink; 216 } 217 if (!string.IsNullOrEmpty(animalCode)) 218 { 219 string variableName = "horse"; 220 if (GetGlobalValue("Global:Area.LongLang").Equals("nl-nl", StringComparison.InvariantCultureIgnoreCase)) { variableName = "paard"; } 221 link = string.Format("{0}&{1}={2}", link, variableName, animalCode); 222 } 223 224 string noteText = KwpnEventHelper.CreateEventNoteText( 225 culture, 226 kwpnEvent.GetString("ItemPublisher:Item.NoteText.Value"), 227 eventCode, 228 kwpnEvent.GetInteger("ItemPublisher:Item.CountOfParticipations"), 229 kwpnEvent.GetInteger("ItemPublisher:Item.MaximumCountOfParticipations"), 230 dateTo, 231 kwpnEvent.GetDate("ItemPublisher:Item.RegistrationDateFrom.Value"), 232 kwpnEvent.GetDate("ItemPublisher:Item.RegistrationDateTo.Value") 233 ); 234 235 if (!string.IsNullOrEmpty(noteText)) 236 { 237 noteText = string.Format("<div class='note'>{0}</div>", noteText); 238 } 239 string hightlightText = kwpnEvent.GetString("ItemPublisher:Item.HighlightText.Value"); 240 if (!string.IsNullOrEmpty(hightlightText)) 241 { 242 hightlightText = string.Format("<div class='highlight'>{0}</div>", hightlightText); 243 } 244 245 <a href='@link' class='@if (showCounter > 10) {<text>scrollHidden</Text>}'> 246 <div class='event-list-row mod-@mod'> 247 <div class="row"> 248 <div class="col-xs-1 text-center"> 249 <i class="fa fa-clock-o"></i> 250 </div> 251 <div class="col-xs-10 date-time"> 252 <span class="date">@eventDateTime</span>@noteText 253 </div> 254 </div> 255 <div class="row"> 256 <div class="col-xs-11 col-xs-offset-1 ellipsis"> 257 @hightlightText@eventTitle 258 </div> 259 </div> 260 </div> 261 </a> 262 showCounter++; 263 } 264 <div id="endOfScroll"> </div> 265 } 266 else 267 { 268 <p>@Translate("NoKwpnEventsFound", "No events found.")</p> 269 <div id="endOfScroll"> </div> 270 } 271 </article> 272 </div> 273 </div> 274 </div> 275 </div> 276 277 @SnippetStart("JavascriptsBottom") 278 <script> 279 $(function () { 280 281 var scrollHandler = function () { 282 var endOfScroll = $("#endOfScroll").offset().top; 283 if (endOfScroll !== undefined) { 284 if ($(window).scrollTop() >= endOfScroll - $(window).height()) { 285 ShowMoreItems(); 286 } 287 } 288 } 289 290 function ShowMoreItems() { 291 $("#event-list-output .scrollHidden:lt(10)").removeClass("scrollHidden"); 292 } 293 294 $(window).scroll(scrollHandler); 295 296 // from date 297 var from = $("#eventfrom").datepicker({ 298 minDate: '+0D', 299 maxDate: null, 300 }); 301 from.on("change", function () { 302 var dateString = $("#eventfrom").val(); 303 if (validateDateField(dateString)) { 304 submitFilter(); 305 } else { 306 Swal.fire({ title: "@Translate("InvalidInputTitle", "Invalid input")" ,text: "@Translate("InvalidDateInput", "Invalid date input")", customClass: layout.notifyCopyrightMessageClass }); 307 308 $("#eventfrom").val(""); 309 } 310 }); 311 312 // to date 313 var to = $("#eventto").datepicker({ 314 minDate: '+0D', 315 maxDate: null, 316 }); 317 to.on("change", function () { 318 var dateString = $("#eventto").val(); 319 if (validateDateField(dateString)) { 320 submitFilter(); 321 } else { 322 Swal.fire({ title: "@Translate("InvalidInputTitle", "Invalid input")" ,text: "@Translate("InvalidDateInput", "Invalid date input")", customClass: layout.notifyCopyrightMessageClass }); 323 324 $("#eventto").val(""); 325 } 326 }); 327 328 // validate date to be not in the past 329 function validateDateField(dateString) { 330 if (dateString === "") { 331 return true; 332 } 333 var date; 334 if (dateString.indexOf("/") >= 0) { 335 // en-us format 336 var dateArray = dateString.split("/"); 337 if (dateArray.length > 2) { 338 var month = parseInt(dateArray[0]); 339 var day = parseInt(dateArray[1]); 340 var year = parseInt(dateArray[2]); 341 date = new Date(year, month, day); 342 } 343 } else { 344 // nl-nl format 345 var dateArray = dateString.split("-"); 346 if (dateArray.length > 2) { 347 var day = parseInt(dateArray[0]); 348 var month = parseInt(dateArray[1]); 349 var year = parseInt(dateArray[2]); 350 date = new Date(year, month, day); 351 } 352 } 353 354 if (date instanceof Date) { 355 var currentDate = new Date(); 356 var month = currentDate.getMonth()+1; 357 var day = currentDate.getDate(); 358 var validationDate = new Date(currentDate.getFullYear() , (month<10 ? '0' : '') + month , (day<10 ? '0' : '') + day); 359 if (date < validationDate) { 360 return false; 361 } 362 } 363 return true; 364 } 365 366 367 // set date culture 368 $.datepicker.setDefaults($.datepicker.regional["@GetGlobalValue("Global:Area.Lang")"]); 369 370 var categories = $("input[name=category]").change(function () { 371 submitFilter(); 372 }); 373 374 function submitFilter() { 375 $(".event-list-output").html("<i class='fa fa-refresh fa-spin fa-3x fa-fw'></i><span class='sr-only'>Loading...</span>"); 376 $("#KwpnEventFilter").submit(); 377 } 378 379 SEO.trackPageView("@seoPage"); 380 381 382 }); 383 </script> 384 @SnippetEnd("JavascriptsBottom") 385 386 } 387 }
Dan is JongKWPN vast en zeker iets voor jou! JongKWPN biedt een gevarieerd programma.
Word nu lid