Error executing template "Designs/Swift/Paragraph/Swift_JKOffice_ProductPriceService.cshtml"
System.Data.SqlClient.SqlException (0x80131904): Transaction (Process ID 157) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
   at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
   at System.Data.SqlClient.SqlDataReader.Read()
   at Dynamicweb.Ecommerce.Products.ProductRepository.GetAllProductKeys(String productLanguageId)
   at Dynamicweb.Ecommerce.Orders.Discounts.Discount.ProcessProductSelections(HashSet`1& productKeys, HashSet`1& includedQueries, HashSet`1& excludedQueries)
   at Dynamicweb.Ecommerce.Orders.Discounts.Discount.GetRelevantProductKeys()
   at Dynamicweb.Ecommerce.Orders.Discounts.DiscountService.StatelessSetLookup(Discount discount, ConcurrentDictionary`2 lookup)
   at Dynamicweb.Ecommerce.Orders.Discounts.DiscountService.InitializeLookup()
   at System.Lazy`1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Lazy`1.get_Value()
   at Dynamicweb.Ecommerce.Orders.Discounts.DiscountService.GetDiscounts(DiscountApplyType[] discountTypes, String[] productKeys, User user)
   at Dynamicweb.Ecommerce.Orders.Discounts.DiscountInfoCollection.LoadDiscounts()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.GetDiscountInfo(PriceViewModelSettings settings, Product product)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__37()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__39()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass3_2.<BulkCreateView>b__40()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CustomCode.Prices.BomDiscount.CustomDiscountPricesResponse..ctor(ProductViewModel product, Boolean isB2BUser)
   at CustomCode.Prices.BomDiscount.CustomDiscountPrices.Get(ProductViewModel productViewModel, Boolean isB2BUser)
   at CompiledRazorTemplates.Dynamic.RazorEngine_3ad449d7498a435987cc1582a64958c6.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\Jkoffice.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\Paragraph\Swift_JKOffice_ProductPriceService.cshtml:line 38
   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()
ClientConnectionId:81f35474-2381-4b54-afb3-a35b5415ba37
Error Number:1205,State:52,Class:13

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Ecommerce.CustomerExperienceCenter.Favorites 4 5 @{ 6 ProductViewModel product = null; 7 8 if (GetViewParameter("ProductViewModel") == null) 9 { 10 var getProductViewModelHelper = new CustomCode.ProductSelector.GetProductViewModelHelper(); 11 product = getProductViewModelHelper.ProductViewModel; 12 } 13 else 14 { 15 product = (ProductViewModel)GetViewParameter("ProductViewModel"); 16 } 17 18 string minQty = product.PurchaseMinimumQuantity != 1 ? "min=\"" + product.PurchaseMinimumQuantity.ToString() + "\"" : "min=\"1\""; 19 string stepQty = product.PurchaseQuantityStep > 1 ? product.PurchaseQuantityStep.ToString() : "1"; 20 string valueQty = product.PurchaseMinimumQuantity > product.PurchaseQuantityStep ? product.PurchaseMinimumQuantity.ToString() : stepQty; 21 string qtyValidCheck = stepQty != "1" ? "onkeyup=\"swift.Cart.QuantityValidate(event)\"" : ""; 22 23 string[] variantId = product.VariantId.Split('.'); 24 25 bool IsNeverOutOfStock = product.NeverOutOfstock; 26 bool isDiscontinued = product.Discontinued; 27 28 string disableAddToCart = (product.StockLevel <= 0) ? "disabled" : ""; 29 disableAddToCart = isDiscontinued ? "disabled" : disableAddToCart; 30 disableAddToCart = IsNeverOutOfStock ? "" : disableAddToCart; 31 32 string url = "/Default.aspx?ID=" + (GetPageIdByNavigationTag("CartService")) + "&LayoutTemplate=Swift_MiniCart.cshtml"; 33 url += CustomCode.ProductSelector.Helpers.ProductSelectorHelper.CreatePartslistUrl("&"); 34 35 var isB2BUser = CustomCode.CustomUserHelpers.IsB2BUser(); 36 bool isAnonymousB2BUser = System.Web.HttpContext.Current.Request.Cookies["userType"] != null ? System.Web.HttpContext.Current.Request.Cookies["userType"].Value == "B2B" : false; 37 38 var customDiscountPrices = CustomCode.Prices.BomDiscount.CustomDiscountPrices.Get(product, isB2BUser); 39 40 <div id="price-container"> 41 <div class="h4 m-0" itemprop="offers" itemscope itemtype="https://schema.org/Offer"> 42 <span itemprop="priceCurrency" content="@product.Price.CurrencyCode" class="d-none"></span> 43 44 <span itemprop="price" content="@customDiscountPrices.DiscountPrice" class="d-none"></span> 45 @if (customDiscountPrices.HasDiscounts) 46 { 47 <span class="text-decoration-line-through opacity-75 me-3">@customDiscountPrices.PriceFormatted</span> 48 } 49 50 <span class="text-price fw-bold fs-5">@customDiscountPrices.DiscountPriceFormatted <small class="fs-8 fw-normal">(@(isB2BUser ? Translate("Excl. VAT") : Translate("Incl. VAT")))</small></span> 51 </div> 52 53 @if (CustomCode.CustomUserHelpers.IsB2BUser() == true || isAnonymousB2BUser) 54 { 55 <div> 56 @{ FieldValueViewModel rentalPrice = new FieldValueViewModel(); 57 if (product.ProductFields.TryGetValue("ProductRentalPrice", out rentalPrice)) 58 { 59 if (rentalPrice.Value?.ToString() != "0") 60 { 61 <span>@Translate("Rental Price:") @(rentalPrice.Value?.ToString()) @Dynamicweb.Ecommerce.Common.Context.Currency.Symbol</span> 62 } 63 } 64 } 65 </div> 66 } 67 68 @if (product.Prices.Count > 0) 69 { 70 71 <div class="grid"> 72 <table class="table table-sm mt-3 g-col-12 g-col-lg-6"> 73 <thead> 74 <tr> 75 <td>@Translate("QTY")</td> 76 <td>@Translate("pr. PCS")</td> 77 </tr> 78 </thead> 79 <tbody> 80 @foreach (PriceListViewModel quantityPrice in product.Prices) 81 { 82 <tr> 83 <td>@quantityPrice.Quantity</td> 84 <td>@quantityPrice.Price.PriceFormatted</td> 85 </tr> 86 } 87 </tbody> 88 </table> 89 </div> 90 91 } 92 </div> 93 94 <div class="d-flex flex-row flex-nowrap gap-2"> 95 <form method="post" action="@url" class="flex-fill"> 96 <input type="hidden" name="redirect" value="false" /> 97 <input type="hidden" name="ProductId" value="@product.Id" /> 98 <input type="hidden" name="ProductName" value="@product.Name"> 99 <input type="hidden" name="ProductVariantName" value="@product.VariantName"> 100 <input type="hidden" name="ProductCurrency" value="@Dynamicweb.Ecommerce.Common.Context.Currency.Code"> 101 <input type="hidden" name="ProductPrice" value="@product.Price.PriceWithVat.ToString().Replace(",", ".")"> 102 <input type="hidden" name="ProductReferer" value="component_ProductPriceServiceAddToCart"> 103 <input type="hidden" name="cartcmd" value="add" /> 104 105 @{ 106 var bomItems = Dynamicweb.Context.Current.Request.Form.AllKeys.Where(k => k.StartsWith("PRODITEM")); 107 } 108 109 @if (bomItems.Any()) 110 { 111 foreach (var item in bomItems) 112 { 113 <input type="hidden" name="@item" value="@Dynamicweb.Context.Current.Request.Form[item]" /> 114 } 115 } 116 117 @if (!string.IsNullOrEmpty(product.VariantId)) 118 { 119 <input type="hidden" name="VariantId" value="@product.VariantId" /> 120 } 121 122 <div class="input-group input-primary-button-group js-input-group mt-3"> 123 <label for="Quantity_@(product.Id)" class="visually-hidden">@Translate("Quantity")</label> 124 <input id="Quantity_@product.Id" name="Quantity" value="@valueQty" step="@stepQty" @minQty class="form-control" style="max-width: 96px; min-width:64px;" type="number"> 125 <button type="button" onclick="swift.Cart.Update(event)" class="btn btn-primary flex-fill js-add-to-cart-button @disableAddToCart" @disableAddToCart title="@Translate("Add to cart")" id="AddToCartButton@(product.Id)">@Translate("Add to cart")</button> 126 </div> 127 128 @if (stepQty != "1") 129 { 130 <div class="invalid-feedback d-none"> 131 @Translate("Please select a quantity that is dividable by") @stepQty 132 </div> 133 } 134 135 </form> 136 137 </div> 138 139 if (Pageview.User != null && disableAddToCart != "disabled") 140 { 141 var favoriteLists = Pageview.User.GetFavoriteLists(); 142 int defaultFavoriteListId = 0; 143 144 if (favoriteLists.Count() == 1) 145 { 146 defaultFavoriteListId = favoriteLists.Last().ListId; 147 } 148 149 var favoriteParameters = new Dictionary<string, object> 150 { 151 { "ListId", defaultFavoriteListId } 152 }; 153 154 <div class="flex-fill"> 155 @Translate("Add to favorites") @RenderPartial("Components/ToggleFavorite.cshtml", product, favoriteParameters) 156 </div> 157 } 158 } 159
Ved at klikke 'Acceptér Alle' så giver til tiladelse til at vi må indsamle information om dig til forskellige formål, hvilket inkluderer: Funktionalitet, Statestik og Marketing