Exception in template (Designs\RizzoDesignFolder\eCom/Productlist/ProductList.cshtml): System.IO.IOException: The process cannot access the file 'E:\Dynamicweb.NET\SolutionsCustom\juc.dk\juc.prod.bleaudev.dk\Files\Templates\Designs\RizzoDesignFolder\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 doc)
   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.RazorTemplateBase`1.Translate(String text, String defaultValue, String cultureName)
   at Dynamicweb.Rendering.RazorTemplateBase`1.Translate(String text, String defaultValue)
   at CompiledRazorTemplates.Dynamic.bbbcaeaecc.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag)
   at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
   at Dynamicweb.Rendering.Template.Output()
@inherits RazorTemplateBase< RazorTemplateModel< Template > > @using Dynamicweb.Rendering; @using Dynamicweb; @using Dynamicweb.Frontend; @using System; @using System.IO; @using System.Data; @using System.Web; @using System.Web.UI; @using System.Text; @using System.Text.RegularExpressions; @using System.Collections.Generic; @using System.Globalization; @using Co3.JUC.Website.Models.Frontend @using Co3.JUC.Website.Services @using Dynamicweb.Admin @{ string designName = GetString("Template:DesignBaseUrl").Replace("/Files/Templates/Designs/", "").Replace("/", ""); }@functions{ public static string GetImage(string sourceString, int imageWidth, int imageHeight, int imageWidthTablet = 0, int imageHeightTablet = 0, int imageWidthMobile = 0, int imageHeightMobile = 0, string imageFormat = "jpg", int imageCompression = 0, int imageCrop = 5, string background = "", string designName = "RizzoDesignFolder") { Dynamicweb.Frontend.PageView currentPageview = Dynamicweb.Frontend.PageView.Current(); string currDevice = currentPageview.Device.ToString(), alternativeImage = currentPageview.Area.Item["NoImage"] != null ? currentPageview.Area.Item["NoImage"].ToString() : "/Files/Templates/Designs/"+ designName + "/images/alternativeImage.jpg", widthString = "", heightString = "", getImageFormat = imageFormat != "jpg" ? "&amp;Format=" + imageFormat : "", getImageCompression = imageCompression != 0 ? "&amp;Compression=" + imageCompression : "", bgColor = !string.IsNullOrEmpty(background) ? "&amp;backgroud="+background : ""; int getImageWidth = imageWidth != 0 ? imageWidth : 0, getImageHeight = imageHeight != 0 ? imageHeight : 0; if (currDevice == Dynamicweb.Frontend.PageView.DeviceType.Tablet.ToString()) { getImageWidth = imageWidthTablet != 0 ? imageWidthTablet : getImageWidth; getImageHeight = imageHeightTablet != 0 ? imageHeightTablet : getImageHeight; } else if (currDevice == Dynamicweb.Frontend.PageView.DeviceType.Mobile.ToString()) { getImageWidth = imageWidthMobile != 0 ? imageWidthMobile : getImageWidth; getImageHeight = imageHeightMobile != 0 ? imageHeightMobile : getImageHeight; } if (getImageWidth != 0) { widthString = "&amp;Width=" + getImageWidth; } if (getImageHeight != 0) { heightString = "&amp;Height=" + getImageHeight; } string output = "/Admin/Public/GetImage.ashx?Image=" + sourceString + widthString + heightString + "&amp;altFmImage_path=" + alternativeImage + getImageFormat + getImageCompression + "&amp;Crop=" + imageCrop + bgColor; return output; } } @inherits RazorTemplateBase<RazorTemplateModel<Template>> @using Dynamicweb.Rendering; @functions{ private string GetImagePathUrl(string small, string medium, string large, string pattern) { string imagePath; if (!string.IsNullOrEmpty(small)) imagePath = small; else if (!string.IsNullOrEmpty(medium)) imagePath = medium; else if (!string.IsNullOrEmpty(large)) imagePath = large; else imagePath = pattern; return imagePath; } } @{ Dynamicweb.Content.Items.Item item = Pageview.Area.Item; string ecommerceLanguageID = ( Pageview.Area.get_Value( "AreaEcomLanguageID" ) != null ) ? Pageview.Area.get_Value( "AreaEcomLanguageID" ).ToString() : "LANG1", ajaxPage = ( item[ "AjaxProducts" ] != null ) ? item[ "AjaxProducts" ].ToString() : "", resultsPage = ( item[ "SearchResults" ] != null ) ? item[ "SearchResults" ].ToString() : ""; DateTime today = DateTime.Today; string filterString = "", url = HttpContext.Current.Request.Url.AbsoluteUri.ToString(), mainFilter = GetString( "Ecom:ProductList:Page.GroupName" ); string[] monthNamesMain = DateTimeFormatInfo.CurrentInfo.MonthNames; List< LoopItem > prodLoop = GetLoop( "Products" ), groupsListMain = GetLoop( "ProductGroups" ); int prodCount = prodLoop.Count(); if ( url.Contains( "Date" ) ) { filterString = HttpContext.Current.Request.QueryString[ "Date" ]; prodLoop = prodLoop.Where( x => { string productId = x.GetString( "Ecom:Product.ID" ), languageId = x.GetString( "Ecom:Product.LanguageID" ), variantId = x.GetString( "Ecom:Product.VariantID" ); bool useNewDateFields = x.GetBoolean( "Ecom:Product:Field.newDateFIelds.Value" ); if ( !useNewDateFields ) { if ( filterString.Contains( x.GetString( "Ecom:Product:Field.Month.Value" ) + "," + x.GetString( "Ecom:Product:Field.Year.Value" ) ) ) { return true; } else { return false; } } else { List< ActivityDay > activityDays = ActivityService.Instance.GetActivityDays( productId, variantId ); bool hasActivityInSelectedMonth = false; foreach (ActivityDay activityDay in activityDays ) { if ( filterString.Contains( activityDay.StartTime.Date.ToString( "M,yyyy" ) ) ) { hasActivityInSelectedMonth = true; break; } } return hasActivityInSelectedMonth; } } ).ToList(); } DateTime startOfNewMonthFinal = new DateTime( today.Year + 1, today.Month, 1 ); prodLoop = prodLoop.Where( j => { string productId = j.GetString( "Ecom:Product.ID" ), languageId = j.GetString( "Ecom:Product.LanguageID" ), variantId = j.GetString( "Ecom:Product.VariantID" ); bool useNewDateFields = j.GetBoolean( "Ecom:Product:Field.newDateFIelds.Value" ); if ( !useNewDateFields ) { if ( !String.IsNullOrEmpty( j.GetString( "Ecom:Product:Field.Year.Value" ) ) && !String.IsNullOrEmpty( j.GetString( "Ecom:Product:Field.Month.Value" ) ) && !String.IsNullOrEmpty( j.GetString( "Ecom:Product:Field.Day.Value" ) ) ) { DateTime productDateLoop = new DateTime( j.GetInteger( "Ecom:Product:Field.Year.Value" ), j.GetInteger( "Ecom:Product:Field.Month.Value" ), j.GetInteger( "Ecom:Product:Field.Day.Value" ) ); if ( productDateLoop >= today ) { return true; } else { return false; } } else { return false; } } else { List< ActivityDay > activityDays = ActivityService.Instance.GetActivityDays( productId, variantId ); bool hasFutureActivity = false; foreach (ActivityDay activityDay in activityDays ) { if ( activityDay.StartTime.Date >= today ) { hasFutureActivity = true; break; } } return hasFutureActivity; } } ).ToList(); int totalPagesNum = GetInteger( "Ecom:ProductList.TotalPages" ), curPage = !string.IsNullOrEmpty( System.Web.HttpContext.Current.Request.Params[ "PageNum" ] ) ? Convert.ToInt32( System.Web.HttpContext.Current.Request.Params[ "PageNum" ].ToString() ) : 1, index = 0; bool noResults = false, isLoggedIn = Pageview.User.LoggedIn, isFrontEnd = Dynamicweb.ExecutingContext.IsFrontEnd(); string currentPageId = Pageview.Page.ID.ToString(), imagesFolder = "/Files/Files/" + designName + "/Products/", totalPages = GetString( "Ecom:ProductList.TotalPages" ), nextPage = GetString( "Ecom:ProductList.NextPage" ), pagingHref = "", sortBy = !string.IsNullOrEmpty( System.Web.HttpContext.Current.Request.Params[ "sortby" ] ) ? System.Web.HttpContext.Current.Request.Params[ "sortby" ] : "", sortOrder = !string.IsNullOrEmpty( System.Web.HttpContext.Current.Request.Params[ "SortOrder" ] ) ? System.Web.HttpContext.Current.Request.Params[ "SortOrder" ] : "", qString = !string.IsNullOrEmpty( System.Web.HttpContext.Current.Request.Params[ "Search" ] ) ? System.Web.HttpContext.Current.Request.Params[ "Search" ] : "", dataView = System.Web.HttpContext.Current.Request.Cookies[ "dataList" ] != null ? System.Web.HttpContext.Current.Request.Cookies[ "dataList" ].Value : "", categories = "", mainFilterID = GetString( "Ecom:ProductList:Page.GroupID" ), currentPage = "", groupIDName = "", getGroupInfo = ""; } <div id="listContainer" class="col-xs-12 noPadding" data-products="@prodLoop.Count()" data-productsAjax="@item[ "AjaxProducts" ]"> @foreach ( LoopItem mainGroup in groupsListMain.Where( x => { if ( !getGroupInfo.Contains( "," ) && x.GetString( "Ecom:Group.ID" ) == getGroupInfo || x.GetString( "Ecom:Group.ID" ) == mainFilterID || groupsListMain.Count() == 1 ) { return true; } else { return false; } } ) ) { string description = mainGroup.GetString( "Ecom:Group.Description" ), comments = mainGroup.GetString( "Ecom:Group:Field.Comments" ); if ( !String.IsNullOrEmpty( description ) && !String.IsNullOrEmpty( comments ) ) { <div class="col-xs-12" id="productsListDescription"> <div class="col-sm-7 col-xs-12"> @description </div> <div class="col-sm-5 col-xs-12"> @comments </div> <div class="hidden read-more visible-xs">@Translate( "Laesmere", "Læs mere" )</div> </div> } } <!-- SORT AND ORDER --> <form action="/Default.aspx" id="searchFormList"> <input type="hidden" name="ID" value="@Pageview.Page.ID.ToString()"> <input type="hidden" name="ID" disabled="disabled" value="@( item[ "SearchResults" ] )"> <fieldset class="mandatory TextInput"> <label for="searchSubmitList"> <input id="searchSubmitList" placeholder='@Translate( "productsListSearch" )' data-short-placeholder='@Translate( "productsListSearchShort", "Søg Efter Produkter" )' data-long-placeholder='@Translate( "productsListSearch" )' data-error='@Translate( "searchText", "Search for something" )' type="text" name="Product" value="@qString"> </label> </fieldset> <div class="openFiltersSwitch"> <span class="hidden-xs"> @Translate( "advancedSearch" ) </span> <input id="myonoffswitch" type="checkbox"> <label for="myonoffswitch"> &nbsp; </label> </div> </form> <!-- filters --> <div class="col-xs-12 noPadding" id="filtersContainer"> @using System.Globalization; @using System.Web; @using System.Web.UI; @{ var parametersList = GetLoop("Query.Parameters"); var currentUrl = HttpContext.Current.Request; string groupId = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["GroupID"]) ? System.Web.HttpContext.Current.Request.Params["GroupID"].ToString() : "", price = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["Price"]) ? System.Web.HttpContext.Current.Request.Params["Price"] : "" , pageSizeNum = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["PageSize"]) ? System.Web.HttpContext.Current.Request.Params["PageSize"] : "", groupsList = item["GroupsFilters"].ToString(), urlFilter = HttpContext.Current.Request.Url.AbsoluteUri.ToString(), checkClass = ""; DateTime currentDate = DateTime.Now; string[] monthNames = DateTimeFormatInfo.CurrentInfo.MonthNames; int finalYear = 0; bool check = false; var itemList = Dynamicweb.Content.Items.ItemList.GetItemListById(Int32.Parse(groupsList)) != null ? Dynamicweb.Content.Items.ItemList.GetItemListById(Int32.Parse(groupsList)).Relations : new List<Dynamicweb.Content.Items.ItemEntry>(); } <form id="filtersForm" class="col-xs-12" action="/Default.aspx"> <input type="hidden" name="ID" value="@Pageview.Page.ID.ToString()" /> @if(qString != "") { <input type="hidden" name="q" value="@qString" /> } <fieldset data-type="System.String[]"> <legend class="filterTitle">@Translate("Month")</legend> <div class="filtersContainer col-xs-12 noPadding"> <strong>@today.Year</strong> <div> @for(int total = today.Month; total <= 12; total++){ if(urlFilter.Contains(total.ToString() + "%2C" +@today.Year)) { check = true; checkClass = "checked"; } else { check = false; checkClass = ""; } <label class="checkBoxContainer @checkClass"> <input type="checkbox" @(check ? "checked=checked" : "") value="@(total),@(today.Year)" name="Date"> <span> @monthNames[total-1] </span> </label> } </div> </div> @if(today.Month != 1) { finalYear = @today.AddYears(1).Year; <div class="filtersContainer col-xs-12 noPadding"> <strong>@finalYear</strong> <div> @for(int i = 1; i < today.Month; i++){ if(urlFilter.Contains(i.ToString() + "%2C" +@finalYear)) { check = true; checkClass = "checked"; } else { check = false; checkClass = ""; } <label class="checkBoxContainer @checkClass"> <input type="checkbox" @(check ? "checked=checked" : "") value="@(i),@(finalYear)" name="Date"> <span> @monthNames[i-1] </span> </label> } </div> </div> } </fieldset> <fieldset data-type="System.String[]" class=""> <legend class="filterTitle">@Translate("Type")</legend> <div class="filtersContainer"> <strong>&nbsp;</strong> <div> @foreach (Dynamicweb.Content.Items.ItemEntry itemCurrent in itemList) { Dictionary<string, object> itemResult = new Dictionary<string, object>(); itemCurrent.SerializeTo(itemResult); if(parametersList.Any(x => x.GetString("Parameter.Value") == @itemResult["GroupID"].ToString()) || (urlFilter.Contains(itemResult["GroupID"].ToString()))) { check = true; checkClass = "checked"; } else{ check = false; checkClass = ""; } <label class="checkBoxContainer @checkClass"> <input type="checkbox" @(check ? "checked=checked" : "") value="@itemResult["GroupID"]" name="Group"> <span> @itemResult["GroupName"] </span> </label> } </div> </div> </fieldset> <button type="submit" class="filterSubmit" id="filterSubmit" style="">@Translate("search", "S�g")</button> @foreach (LoopItem facetGroup in GetLoop("FacetGroups")) { foreach (LoopItem facet in facetGroup.GetLoop("Facets")) { string parameterType = parametersList.First(x => x.GetString("Parameter.Name") == facet.GetString("Facet.QueryParameter")).GetString("Parameter.Type"); string templateOutput = "string"; if(parameterType.Contains("[]")){ switch (facet.GetString("Facet.Name")) { case "Category": templateOutput = "multiselect"; break; default: templateOutput = "checkboxes"; break; } } else if(parameterType.Contains("Boolean")){ switch (facet.GetString("Facet.Name")) { case "fieldName": templateOutput = "select"; break; case "fieldName2": templateOutput = "radio"; break; default: templateOutput = "checkbox"; break; } } else if(!string.IsNullOrWhiteSpace(facet.GetString("Facet.OptionCount"))) { switch (facet.GetString("Facet.Name")) { case "fieldName": templateOutput = "select"; break; case "fieldName2": templateOutput = "radios"; break; case "fieldName3": templateOutput = "multiselect"; break; case "fieldName4": templateOutput = "text"; break; default: templateOutput = "checkboxes"; break; } } else { switch (facet.GetString("Facet.Name")) { case "fieldName": templateOutput = "autocomplete"; break; default: templateOutput = "text"; break; } } @RenderField(facet, parameterType, templateOutput, noResults) } } </form> @helper RenderField(LoopItem loopItem , string parameterType, string templateOutput, bool noResults ) { string parameter = loopItem.GetString("Facet.QueryParameter"); string name = loopItem.GetString("Facet.Name"); List<LoopItem> facetOptionsList = loopItem.GetLoop("FacetOptions"); var facetOptions = noResults ? facetOptionsList.OrderByDescending(o => o.GetInteger("FacetOption.Count")).ThenBy(or => or.GetString("FacetOption.Label")) : loopItem.GetLoop("FacetOptions").Where(f => f.GetInteger("FacetOption.Count") != 0).OrderByDescending(o => o.GetInteger("FacetOption.Count")).ThenBy(or => or.GetString("FacetOption.Label")); switch (templateOutput) { case "multiselect": if(loopItem.GetLoop("FacetOptions").Any()) { <fieldset> <legend>@name</legend> <select data-selected-text-format="count" data-live-search="true" data-size="8" name="@parameter" multiple> @foreach(LoopItem option in facetOptionsList.OrderByDescending(o => o.GetInteger("FacetOption.Label"))) { bool facetOptionChecked = option.GetBoolean("FacetOption.Selected"); string value = option.GetString("FacetOption.Value"); string nameOption = option.GetString("FacetOption.Name"); <option selected="@facetOptionChecked" value="@value">@option.GetString("FacetOption.Label")</option> } </select> </fieldset> } break; case "checkboxes": if(loopItem.GetLoop("FacetOptions").Any()) { int count = 0; <fieldset data-type="@parameterType"> <legend class="filterTitle">@name</legend> <div class="filtersContainer hide"> @foreach(LoopItem option in facetOptions) { bool facetOptionChecked = option.GetBoolean("FacetOption.Selected"); string value = option.GetString("FacetOption.Value"); string nameOption = option.GetString("FacetOption.Name"); count++; string classString = count > 5 ? "hide" : ""; <label class="checkBoxContainer @classString"><input checked="@facetOptionChecked" type="checkbox" value="@value" name="@parameter"> <span> @option.GetString("FacetOption.Label") @if(option.GetInteger("FacetOption.Count") > 0) { string.Format("({0})", option.GetString("FacetOption.Count")); } </span> </label> } @if(loopItem.GetLoop("FacetOptions").Where(f => f.GetInteger("FacetOption.Count") != 0).Count() > 5) { <span class="seeMore" data-more='@Translate("seeMore", "See more")' data-hide='@Translate("only5", "Show only 5")' >@Translate("seeMore", "See more")</span> } </div> </fieldset> } break; case "select": break; case "checkbox": if(loopItem.GetLoop("FacetOptions").Any()) { <fieldset data-type="@parameterType"> @foreach(LoopItem option in facetOptionsList.Where(f => f.GetInteger("FacetOption.Count") != 0).OrderByDescending(o => o.GetInteger("FacetOption.Count")).ThenBy(or => or.GetString("FacetOption.Label"))) { bool facetOptionChecked = option.GetBoolean("FacetOption.Selected"); string value = option.GetString("FacetOption.Value") == "True" ? "True" : ""; string nameOption = option.GetString("FacetOption.Name"); if(value == "True") { <legend class="filterTitle">@name</legend> <div class="filtersContainer hide"> <label class="checkBoxContainer"><input checked="@facetOptionChecked" type="checkbox" value="@value" name="@parameter"> <span>@name (@option.GetString("FacetOption.Count"))</span></label> </div> } } </fieldset> } break; case "radio": break; case "radios": break; case "autocomplete": break; default: <fieldset data-type="@parameterType"> <legend class="filterTitle">@name</legend> <div class="filtersContainer"> <input type="text" name="@parameter" value="" /> </div> </fieldset> break; } } </div> @foreach ( LoopItem products in GetLoop( "Query.Parameters" ) ) { getGroupInfo = products.GetString( "Parameter.Value" ); @* <text>@products.GetString("Parameter.Value")</text> *@ break; } <!-- REMOVE FILTERS --> @if ( !String.IsNullOrEmpty( mainFilter ) || HttpContext.Current.Request.QueryString.AllKeys.Where( x => x != "ID" ).Any() ) { <div class="col-xs-12 removeFiltersContainer"> <strong>@Translate( "removeFilters" )</strong> <span> @if ( !String.IsNullOrEmpty( mainFilter ) ) { <a data-queryname="Group" data-queryvalue="@mainFilterID" href="#">@mainFilter</a> } @if ( HttpContext.Current.Request.QueryString.AllKeys.Any() ) { foreach ( String key in HttpContext.Current.Request.QueryString.AllKeys.Reverse() ) { if ( key != "ID" ) { if ( key == "Date" ) { string[] words = HttpContext.Current.Request.QueryString[ key ].Split( ',' ); for ( int i = 0; i < ( words.Length / 2 ); i++ ) { <a data-queryname="@( key )" data-queryvalue="@( words[ index ] ),@( words[ index + 1 ] )" href="#">@monthNamesMain[ Int32.Parse( words[ index ] ) - 1 ]</a> index = index + 2; } } else if ( key == "Group" ) { string[] words = HttpContext.Current.Request.QueryString[ key ].Split( ',' ); foreach ( string word in words ) { groupIDName = string.Format( "SELECT GroupName FROM EcomGroups WHERE GroupID = '{0}' and GroupLanguageID='{1}'", Dynamicweb.Database.SqlEscapeInjection(word), ecommerceLanguageID ); var groupInfo = Dynamicweb.Database.CreateDataSet( groupIDName ); if ( groupInfo.Tables.Count > 0 && groupInfo.Tables[ 0 ].Rows.Count > 0 ) { foreach ( DataRow product in groupInfo.Tables[ 0 ].Rows ) { <a data-queryname="@( key )" data-queryvalue="@( word )" href="#">@product[ "GroupName" ] </a> } } } } } else { currentPage = "Default.aspx?ID=" + HttpContext.Current.Request.QueryString[ key ]; } } } </span> <div> <a class="openFilters" href="#"> <svg data-name="Layer 1" id="Layer_1" viewBox="0 0 35 35" xmlns="http://www.w3.org/2000/svg"> <defs> <style>.cls-1{fill:#a6ce38;}</style> </defs> <title>plus</title> <polygon class="cls-1" points="35 21 21 21 21 35 14 35 14 21 0 21 0 14 14 14 14 0 21 0 21 14 35 14 35 21" /> </svg> </a> @if ( String.IsNullOrEmpty( currentPage ) && item[ "SearchResults" ] != null ) { currentPage = "Default.aspx?ID=" + item[ "SearchResults" ].ToString(); } <a class="removeAll" href="@currentPage"> @* <i class="fa fa-times" aria-hidden="true"></i> *@ <svg data-name="Layer 2" id="Layer_2" viewBox="0 0 35 35" xmlns="http://www.w3.org/2000/svg"> <title>plus</title> <polygon class="removeSVG" points="35 21 21 21 21 35 14 35 14 21 0 21 0 14 14 14 14 0 21 0 21 14 35 14 35 21" /> </svg> </a> </div> </div> } @if ( prodLoop.Any() ) { if ( groupsListMain.Where( x => x.GetLoop( "Childgroups" ).Count > 0 ).Any() ) { <span id="openToggle" data-close="@Translate( "closeAll" )" data-open="@Translate( "openAll" )">@Translate( "openAll" )</span> } string link = "", productName = "", productShortDescription = "", day = "", color = "", lectures = "", lecturesDecimal = "", productDescription = "", ShowDateOnList = "", colorOfGroup = "", barColor = "", moduleNumber = ""; int month = 0; <ul class="productsList" id="productsList"> @foreach ( LoopItem group in groupsListMain ) { if ( group.GetBoolean( "Ecom:Group:Field.FilterGroup" ) ) { List< LoopItem > childGroups = group.GetLoop( "Childgroups" ); if ( childGroups.Any() ) { string[] monthNamesAbbr = DateTimeFormatInfo.CurrentInfo.AbbreviatedMonthNames; foreach ( LoopItem child in childGroups ) { List< LoopItem > productsListChild = prodLoop.Where( x => x.GetString( "Ecom:Product.PrimaryOrFirstGroupID" ) == child.GetString( "Ecom:Group.ID" ) ).ToList(); colorOfGroup = child.GetString( "Ecom:Group:Field.Color" ); barColor = child.GetString( "Ecom:Group:Field.barcolor" ); string GroupClass = ""; if ( GetString( "Ecom:Group.ID" ) == "GROUP64" ) { GroupClass = "certificering"; productsListChild = prodLoop.ToList(); } if ( productsListChild.Any() ) { <li class="col-xs-12 noPadding @colorOfGroup @barColor"> <div class="col-xs-12 noPadding group @GroupClass"> <h2> <a href="@link"> @child.GetString( "Ecom:Group.Name" ) <figure> <svg data-name="Layer 1" id="Layer_1" viewBox="0 0 35 35" xmlns="http://www.w3.org/2000/svg"> <defs> <style>.cls-1{fill:#fff;}</style> </defs> <title>plus</title> <polygon class="cls-1" points="35 21 21 21 21 35 14 35 14 21 0 21 0 14 14 14 14 0 21 0 21 14 35 14 35 21" /> </svg> </figure> <figure class="hidden"> <svg data-name="Layer 2" id="Layer_2" viewBox="0 0 35 7" xmlns="http://www.w3.org/2000/svg"> <defs> <style>.cls-1{fill:#fff;}</style> </defs> <title>minus</title> <rect class="cls-1" height="7" width="35" /> </svg> </figure> </a> </h2> </div> <div> <ul class="row"> @foreach ( LoopItem prodChild in prodLoop.Where( x => { if ( x.GetLoop( "AssociatedGroups" ).Where( y => y.GetString( "Ecom:Group.ID" ) == child.GetString( "Ecom:Group.ID" ) ).Any() ) { return true; } else { return false; } } ).OrderBy( x => { DateTime sortDate = DateTime.Today; if ( !x.GetBoolean( "Ecom:Product:Field.newDateFIelds.Value" ) ) { sortDate = DateTime.Parse( x.GetString( "Ecom:Product:Field.Year.Value" ) + "/" + x.GetString( "Ecom:Product:Field.Month.Value" ) + "/" + x.GetString( "Ecom:Product:Field.Day.Value" ) ); } else { List< ActivityDay > sortActivityDays = ActivityService.Instance.GetActivityDays( x.GetString("Ecom:Product.ID"), x.GetString("Ecom:Product.VariantID") ); if ( sortActivityDays != null && sortActivityDays.Count > 0 ) { ActivityDay nextFutureActivity = sortActivityDays.OrderBy( sortAd => sortAd.StartTime ).FirstOrDefault( sortAd => sortAd.StartTime.Date >= today ); if ( nextFutureActivity != null ) { sortDate = nextFutureActivity.StartTime.Date; } } } return sortDate; } ). ThenBy( x => x.GetString( "Ecom:Product:Field.moduleNummer" ) ) ) { productName = prodChild.GetString( "Ecom:Product.Name" ); productShortDescription = Dynamicweb.Base.TeaserString( StripHtml( prodChild.GetString( "Ecom:Product.ShortDescription" ) ), 80, "..." ); link = prodChild.GetString( "Ecom:Product.Link.Clean" ).Replace( ajaxPage, resultsPage ); day = prodChild.GetString( "Ecom:Product:Field.Day" ); month = prodChild.GetInteger( "Ecom:Product:Field.Month" ); color = group.GetString( "Ecom:Group:Field.Color" ); lectures = prodChild.GetString( "Ecom:Product:Field.Lectures" ); lecturesDecimal = prodChild.GetString( "Ecom:Product:Field.LecturesDecimal.Value.Raw" ); moduleNumber = prodChild.GetString( "Ecom:Product:Field.moduleNummer" ); ShowDateOnList = prodChild.GetString( "Ecom:Product:Field.ShowDateOnList" ); var year = prodChild.GetString( "Ecom:Product:Field.Year" ); var productMetaDescription = prodChild.GetString( "Ecom:Product.MetaDescription" ); var productPrice = prodChild.GetString( "Ecom:Product.Price.PriceWithoutVAT" ).Replace( ",00", "" ).Replace( ".", "" ); int productDateStartInt = 0; string myDateTime = prodChild.GetString( "Ecom:Product:Field.season01Activity01DateStart.Value.Clean" ); DateTime productDateStart = DateTime.Now; if ( !String.IsNullOrEmpty( myDateTime ) ) { productDateStart = DateTime.ParseExact( myDateTime, "dd-MM-yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture ); productDateStartInt = ( int ) productDateStart.Day; } if ( prodChild.GetBoolean( "Ecom:Product:Field.newDateFIelds.Value" ) ) { List< ActivityDay > sortActivityDays = ActivityService.Instance.GetActivityDays( prodChild.GetString("Ecom:Product.ID"), prodChild.GetString("Ecom:Product.VariantID") ); if ( sortActivityDays != null && sortActivityDays.Count > 0 ) { ActivityDay nextFutureActivity = sortActivityDays.OrderBy( sortAd => sortAd.StartTime ).FirstOrDefault( sortAd => sortAd.StartTime.Date >= today ); if ( nextFutureActivity != null ) { day = nextFutureActivity.StartTime.Date.Day.ToString(); month = nextFutureActivity.StartTime.Date.Month; year = nextFutureActivity.StartTime.Date.Year.ToString(); productDateStart = nextFutureActivity.StartTime.Date; productDateStartInt = productDateStart.Day; } } } var startDate = DateTime.Now; var endDate = DateTime.Now; try { startDate = new DateTime( int.Parse( year.Trim() ), month, int.Parse( day.Trim() ), 0, 0, 0 ); endDate = new DateTime( int.Parse( year.Trim() ), month, int.Parse( day.Trim() ), 23, 59, 0 ); } catch { } dynamic eventInfo = new System.Dynamic.ExpandoObject(); eventInfo.Title = productName.Replace( "\"", "'" ); eventInfo.Description = productMetaDescription.Replace( "\"", "'" ); eventInfo.StartDate = startDate.ToString( "o" ); eventInfo.EndDate = endDate.ToString( "o" ); eventInfo.LocationName = "JUC"; eventInfo.ValidFrom = DateTime.Now.ToString( "o" ); eventInfo.Price = productPrice.Replace( "\"", "'" ); var currentHost = HttpContext.Current.Request.Url.Host; if ( currentHost.EndsWith( "de" ) ) { eventInfo.Url = "https://juc.de/" + link; eventInfo.Locality = "Berlin, Deutschland"; eventInfo.ZipCode = "10115"; eventInfo.StreetAddress = "Ackerstrasse 3"; eventInfo.Currency = "EUR"; } else if ( currentHost.EndsWith( "no" ) ) { eventInfo.Url = "https://juc.no/" + link; eventInfo.Locality = "Oslo, Norge"; eventInfo.ZipCode = "0257"; eventInfo.StreetAddress = "Bygdøy allé 2"; eventInfo.Currency = "NOK"; } else if ( currentHost.EndsWith( "se" ) ) { eventInfo.Url = "https://juc.se/" + link; eventInfo.Locality = "Stockholm, Sverige"; eventInfo.ZipCode = "111 21"; eventInfo.StreetAddress = "Mäster samuelsgatan 60 (8th floor)"; eventInfo.Currency = "SEK"; } else { eventInfo.Url = "https://juc.dk/" + link; eventInfo.Locality = "København V, Danmark"; eventInfo.ZipCode = "1620"; eventInfo.StreetAddress = "Vesterbrogade 4A"; eventInfo.Currency = "DKK"; } var eventSEO = new HtmlString( string.Format( @"<script type=""application/ld+json""> {{ ""@context"": ""http://schema.org"", ""@type"": ""EducationEvent"", ""name"": ""{0}"", ""description"": ""{1}"", ""startDate"": ""{2}"", ""endDate"": ""{3}"", ""location"": {{ ""@type"": ""Place"", ""name"": ""{4}"", ""url"": ""{5}"", ""address"": {{ ""@type"": ""PostalAddress"", ""addressLocality"": ""{6}"", ""postalCode"": ""{7}"", ""streetAddress"": ""{8}"" }} }}, ""offers"": {{ ""@type"": ""Offer"", ""validFrom"": ""{9}"", ""price"": ""{10}"", ""priceCurrency"": ""{11}"", ""url"": ""{5}"", ""availability"": ""http://schema.org/InStock"" }} }} </script>", eventInfo.Title, eventInfo.Description, eventInfo.StartDate, eventInfo.EndDate, eventInfo.LocationName, eventInfo.Url, eventInfo.Locality, eventInfo.ZipCode, eventInfo.StreetAddress, eventInfo.ValidFrom, eventInfo.Price, eventInfo.Currency ) ); string searchSummary = productName, searchSQLrelatedTeachers = string.Format( "SELECT * FROM EcomProducts p INNER JOIN EcomProductsRelated pr ON pr.ProductRelatedProductRelID = p.ProductID WHERE pr.ProductRelatedProductID = '{0}' and p.ProductLanguageID ='{1}' and pr.ProductRelatedGroupID = 'RELGRP2'", prodChild.GetString( "Ecom:Product.ID" ), ecommerceLanguageID ); var relatedTeachers = Dynamicweb.eCommerce.Products.Product.GetProductsBySql( searchSQLrelatedTeachers ); if ( relatedTeachers.Any() ) { foreach ( var teacher in relatedTeachers ) { searchSummary += " " + teacher.Name; } } <li class="@color col-xs-12 col-sm-6 col-lg-4 lowerProd" data-url="@link" data-teachers="@relatedTeachers.Count()" data-search="@searchSummary.ToLower()"> @eventSEO <div> <div class="related-info"> <ul> <li class="productDate"> <div> @if ( ShowDateOnList == "False" ) { if ( prodChild.GetString( "Ecom:Product:Field.newDateFIelds.Value" ) != "False" ) { <strong>@productDateStartInt</strong> <span>@productDateStart.ToString( "MMMM" ).Substring( 0, 3 )</span> } else { <strong>@day</strong> <span>@monthNamesAbbr[ month - 1 ]</span> } } </div> </li> <li class="productLessons"> <div> <strong> @if ( !String.IsNullOrEmpty( lecturesDecimal ) && ( lecturesDecimal != "0" ) ) { <p>@lecturesDecimal</p> } else { <p>@lectures</p> } </strong> <span>@Translate( "ShortLectures", "Lekt." )</span> </div> </li> </ul> </div> <div class="productName"> <h3> <a href="@link" title="@productName"> @productName </a> </h3> @if ( !String.IsNullOrEmpty( moduleNumber ) && ( moduleNumber != "0" ) ) { <span class="productModuleNumberText">modul<span class="productModuleNumber">@moduleNumber</span></span> } @*@if (!String.IsNullOrEmpty(productShortDescription)) { <div> <a href="@link" title="@productName"> @productShortDescription </a> </div> }*@ </div> </div> <a href="@link" title="@productName" class="overlayLink">@productName</a> </li> } </ul> </div> </li> } } } else { foreach ( LoopItem prod in prodLoop.Where( x => { if ( x.GetLoop( "AssociatedGroups" ).Where( y => y.GetString( "Ecom:Group.ID" ) == group.GetString( "Ecom:Group.ID" ) ).Any() ) { return true; } else { return false; } } ).OrderBy( y => y.GetString( "Ecom:Product.Name" ).TrimStart() ) ) { productName = prod.GetString( "Ecom:Product.Name" ); string productKeyWords = prod.GetString( "Ecom:Product.MetaKeywords" ); link = prod.GetString( "Ecom:Product.Link.Clean" ); var prodGroup = group.GetString( "Ecom:Group:Field.Color" ); var bgProduct = prod.GetString( "Ecom:Product:Field.bgProduct" ); var year = prod.GetString( "Ecom:Product:Field.Year" ); day = prod.GetString( "Ecom:Product:Field.Day" ); month = prod.GetInteger( "Ecom:Product:Field.Month" ); var productMetaDescription = prod.GetString( "Ecom:Product.MetaDescription" ); var productPrice = prod.GetString( "Ecom:Product.Price.PriceWithoutVAT" ).Replace( ",00", "" ).Replace( ".", "" ); //INFO: If we should use the new date fields - override the variables. if ( prod.GetBoolean( "Ecom:Product:Field.newDateFIelds.Value" ) ) { // Get the activities List< ActivityDay > sortActivityDays = ActivityService.Instance.GetActivityDays( prod.GetString("Ecom:Product.ID"), prod.GetString("Ecom:Product.VariantID") ); if ( sortActivityDays != null && sortActivityDays.Count > 0 ) { // Find the next coming activity ActivityDay nextFutureActivity = sortActivityDays.OrderBy( sortAd => sortAd.StartTime ).FirstOrDefault( sortAd => sortAd.StartTime.Date >= today ); if ( nextFutureActivity != null ) { day = nextFutureActivity.StartTime.Date.Day.ToString(); month = nextFutureActivity.StartTime.Date.Month; year = nextFutureActivity.StartTime.Date.Year.ToString(); } } } var startDate = DateTime.Now; var endDate = DateTime.Now; try { startDate = new DateTime( int.Parse( year.Trim() ), month, int.Parse( day.Trim() ), 0, 0, 0 ); endDate = new DateTime( int.Parse( year.Trim() ), month, int.Parse( day.Trim() ), 23, 59, 0 ); } catch { } dynamic eventInfo = new System.Dynamic.ExpandoObject(); eventInfo.Title = productName.Replace( "\"", "'" ); eventInfo.Description = productMetaDescription.Replace( "\"", "'" ); eventInfo.StartDate = startDate.ToString( "o" ); eventInfo.EndDate = endDate.ToString( "o" ); eventInfo.LocationName = "JUC"; eventInfo.ValidFrom = DateTime.Now.ToString( "o" ); eventInfo.Price = productPrice.Replace( "\"", "'" ); var currentHost = HttpContext.Current.Request.Url.Host; if ( currentHost.EndsWith( "de" ) ) { eventInfo.Url = "https://juc.de/" + link; eventInfo.Locality = "Berlin, Deutschland"; eventInfo.ZipCode = "10115"; eventInfo.StreetAddress = "Ackerstrasse 3"; eventInfo.Currency = "EUR"; } else if ( currentHost.EndsWith( "no" ) ) { eventInfo.Url = "https://juc.no/" + link; eventInfo.Locality = "Oslo, Norge"; eventInfo.ZipCode = "0257"; eventInfo.StreetAddress = "Bygdøy allé 2"; eventInfo.Currency = "NOK"; } else if ( currentHost.EndsWith( "se" ) ) { eventInfo.Url = "https://juc.se/" + link; eventInfo.Locality = "Stockholm, Sverige"; eventInfo.ZipCode = "111 21"; eventInfo.StreetAddress = "Mäster samuelsgatan 60 (8th floor)"; eventInfo.Currency = "SEK"; } else { eventInfo.Url = "https://juc.dk/" + link; eventInfo.Locality = "København V, Danmark"; eventInfo.ZipCode = "1620"; eventInfo.StreetAddress = "Vesterbrogade 4A"; eventInfo.Currency = "DKK"; } var eventSEO = new HtmlString( string.Format( @"<script type=""application/ld+json""> {{ ""@context"": ""http://schema.org"", ""@type"": ""EducationEvent"", ""name"": ""{0}"", ""description"": ""{1}"", ""startDate"": ""{2}"", ""endDate"": ""{3}"", ""location"": {{ ""@type"": ""Place"", ""name"": ""{4}"", ""url"": ""{5}"", ""address"": {{ ""@type"": ""PostalAddress"", ""addressLocality"": ""{6}"", ""postalCode"": ""{7}"", ""streetAddress"": ""{8}"" }} }}, ""offers"": {{ ""@type"": ""Offer"", ""validFrom"": ""{9}"", ""price"": ""{10}"", ""priceCurrency"": ""{11}"", ""url"": ""{5}"", ""availability"": ""http://schema.org/InStock"" }} }} </script>", eventInfo.Title, eventInfo.Description, eventInfo.StartDate, eventInfo.EndDate, eventInfo.LocationName, eventInfo.Url, eventInfo.Locality, eventInfo.ZipCode, eventInfo.StreetAddress, eventInfo.ValidFrom, eventInfo.Price, eventInfo.Currency ) ); string searchOuterSummary = productName, searchOuterSQLrelatedTeachers = string.Format( "SELECT * FROM EcomProducts p INNER JOIN EcomProductsRelated pr ON pr.ProductRelatedProductRelID = p.ProductID WHERE pr.ProductRelatedProductID = '{0}' and p.ProductLanguageID ='{1}' and pr.ProductRelatedGroupID = 'RELGRP2'", prod.GetString( "Ecom:Product.ID" ), ecommerceLanguageID ); var relatedOuterTeachers = Dynamicweb.eCommerce.Products.Product.GetProductsBySql( searchOuterSQLrelatedTeachers ); if ( relatedOuterTeachers.Any() ) { foreach ( var teacher in relatedOuterTeachers ) { searchOuterSummary += " " + teacher.Name; } } searchOuterSummary += " " + productKeyWords; if ( !String.IsNullOrEmpty( productName ) ) { <li class="col-xs-12 lowerProd noPadding" data-search="@searchOuterSummary.ToLower()"> @eventSEO <div class="col-xs-12 noPadding product @prodGroup @bgProduct"> <h2> <a itemprop="name" href="@link"> @productName </a> </h2> </div> <a href="@link" title="@productName" class="overlayLink">@productName</a> </li> } } } } } </ul> } <p class="col-xs-12 hidden noPadding" id="noResults">@Translate( "sorryNoResultsFound", "Der var desværre ingen resultater" )</p> </div> @SnippetStart( "jsOnLoad" ) onLoadProductList(); @SnippetEnd( "jsOnLoad" ) @helper PageItem( string cssClass, string href, string text, string dataAttr = "" ) { <li @cssClass @dataAttr> <a href="@href">@text</a> </li> } @helper Ellipsis() { <li> <span>...</span> </li> } @functions { public static string StripHtml( string source ) { return Regex.Replace( source, "<.*?>", string.Empty ); } }