Professionelt udstyr til den grønne branche
Stort udvalg i værktøj og materialer – personlig rådgivning og hurtig levering til professionelle inden for juletræsproduktion, skovbrug, planteskole, gartneri, kirkegårde, anlæg samt frugt- og bærproduktion.
Ukrudtsværn og vildtværn
Forskellige former for ukrudtsværn kan hjælpe dig med at holde ukrudtet nede uden sprøjtemidler. Vildtværn kan holde vildtet på afstand af dine nyplantede træer.
Bredt sortiment i vildthegn og skovhegn
Skal du have indhegnet nyplantede træer, juletræer eller frugttræer? Se vores store udvalg i hegn og hegnspæle her.
Professionelle redskaber
Her finder du alle redskaber til haven, planteskolen, anlægsgartneri og plantning.Se vores produktudvalg
Alt i skilte og markering
Se vores omfattende udvalg af piktogrammer, påbudsskilte, forbudsskilte, rutemarkeringer og meget mere.
Professionelle redskaber
Her finder du alle redskaber til haven, planteskolen, anlægsgartneri og plantning.
Beskæresakse og håndsakse
Hos Dalgas A/S har vi et stort udvalg i beskæresakse og håndsakse fra kendte mærker som Felco, Löwe og WOLF Garten.
Om Dalgas Shop
Siden 1976 har vi leveret udstyr og værktøj til arbejde i og med naturen. Derfor kender vi vores produkter. Og vi vil gerne kende dine behov. Du får professionel og faglig rådgivning – uanset hvad du mangler for at gøre dine opgaver lidt nemmere. Du får også et bredt udvalg og hurtig levering.
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/Shop_Guides.cshtml" System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Dalgas.Custom.Services.ContentRelationService.GetRelatedPagesByUrlAndParameters(String url, List`1 parameters, Int32 pageSize) in D:\a\1\s\Custom\Services\ContentRelationService.cs:line 81 at Dalgas.Custom.Services.ContentRelationService.GetPagesByIndustries(String pageItemType, Int32 pageSize) in D:\a\1\s\Custom\Services\ContentRelationService.cs:line 455 at CompiledRazorTemplates.Dynamic.RazorEngine_11dfe1a656994564b85e02c3eec7dc46.Execute() in E:\Solutions\dalgas\Files\Templates\Designs\Swift\Grid\Page\RowTemplates\Shop_Guides.cshtml:line 142 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.ViewModelTemplate<GridRowViewModel> 2 @using System 3 @using System.Collections.Generic 4 @using System.Linq 5 @using System.Text.RegularExpressions 6 @using System.Web 7 @using Dalgas.Custom.Models.Content 8 @using Dalgas.Custom.Services 9 @using Dalgas.Custom.ViewModels.UI 10 @using Dynamicweb.Content 11 @using Dynamicweb.Core.Encoders 12 @using Dynamicweb.Core.Json 13 @using Dynamicweb.Frontend 14 @using Dynamicweb.Ecommerce.ProductCatalog 15 @using Page = Dynamicweb.Content.Page 16 17 @using System 18 @using System.Collections.Generic 19 @using System.Linq 20 @using Dalgas.Custom.ViewModels.UI 21 @using Dynamicweb.Content 22 @using Dynamicweb.Ecommerce.ProductCatalog 23 @using Dynamicweb.Frontend 24 @using ParagraphService = Dalgas.Custom.Services.ParagraphService 25 26 @*TODO: Move these functions onto the model *@ 27 28 @functions 29 { 30 31 public string GetSectionClassList(GridRowViewModel model, string overwriteTheme = "") 32 { 33 var returnValues = new List<string> 34 { 35 $"item_{model.Item.SystemName.ToLower()}" 36 }; 37 38 if (Services.Grids.GetGridRowById(model.Id).Sort == 1) 39 { 40 returnValues.Add("dalgas-section-first-on-page"); 41 } 42 43 var sectionBackgroundTheme = model.Item.GetItem("ColorScheme")?.GetString("ColorScheme") ?? string.Empty; 44 45 if (!string.IsNullOrEmpty(overwriteTheme)) 46 { 47 sectionBackgroundTheme = overwriteTheme; 48 } 49 50 // Add theme class if it exists 51 if (!string.IsNullOrWhiteSpace(sectionBackgroundTheme)) 52 { 53 if (sectionBackgroundTheme.Contains("default")) 54 { 55 returnValues.Add("theme theme-light"); 56 } 57 else 58 { 59 returnValues.Add($"theme {sectionBackgroundTheme.Replace(" ", "").Trim().ToLower()}"); 60 } 61 } 62 63 // Determine if top padding should be removed 64 65 string removeTopPadding = model.Item.GetItem("ColorScheme")?.GetString("RemoveTopPadding"); 66 67 returnValues.Add("pb-6"); 68 if (removeTopPadding != "enable") 69 { 70 returnValues.Add("pt-6"); 71 } 72 73 return string.Join(" ", returnValues); 74 } 75 76 } 77 78 79 @{ 80 IEnumerable<HeadingViewModel> headings = ParagraphService.Instance.GetHeadingsByItems(Model.Item?.GetItem("Paragraph_Text")?.GetItems("Headings")); 81 string text = Model.Item.GetItem("Paragraph_Text")?.GetString("Text"); 82 string lead = Model.Item.GetItem("Paragraph_Text")?.GetString("Lead"); 83 IEnumerable<ButtonViewModel> buttons = ParagraphService.Instance.GetButtonsByItems(Model.Item?.GetItem("Paragraph_Text")?.GetItems("Buttons")); 84 85 bool hasImage = Model.Item.GetItem("Paragraph_Image")?.GetFile("Image") != null; 86 bool hasText = !string.IsNullOrEmpty(Model.Item?.GetItem("Paragraph_Text")?.GetString("Text")); 87 bool hasLead = !string.IsNullOrEmpty(Model.Item?.GetItem("Paragraph_Text")?.GetString("Lead")); 88 bool hasHeading = headings.Any(); 89 bool hasButton = buttons.Any(); 90 91 var theme = Model.Item.GetItem("ColorScheme")?.GetString("ColorScheme"); 92 var fifthElementTheme = "fifth-element-color-" + Model.Item?.GetItem("ColorScheme")?.GetString("FifthElementColor"); 93 94 var sectionClassList = GetSectionClassList(Model); 95 96 var image = string.Empty; 97 var imageParameters = new Dictionary<string, object>(); 98 99 string layout = string.Empty; 100 Boolean enableFifthElement = false; 101 if (Model?.Item != null) 102 { 103 var paragraphLayout = Model.Item.GetItem("Paragraph_Layout"); 104 105 if (paragraphLayout != null) 106 { 107 layout = paragraphLayout.GetString("Layout"); 108 109 enableFifthElement = !string.IsNullOrEmpty(paragraphLayout.GetString("Layout_FifthElement")); 110 } 111 } 112 113 if (!string.IsNullOrEmpty(Model.Item?.GetItem("Paragraph_Image")?.GetFile("Image")?.Path)) 114 { 115 image = Model.Item.GetItem("Paragraph_Image").GetFile("Image").Path; 116 imageParameters.Add("alt", Model.Item.GetItem("Paragraph_Image")?.GetString("ImageAltText")); 117 int xPos = Model.Item.GetItem("Paragraph_Image").GetFile("Image")?.FocalPositionFromLeft ?? 50; 118 int yPos = Model.Item.GetItem("Paragraph_Image").GetFile("Image")?.FocalPositionFromTop ?? 50; 119 string cssPosition = $"{xPos}% {yPos}%"; 120 imageParameters.Add("style", "object-position:" + cssPosition); 121 } 122 123 LinkViewModel imageLink = new LinkViewModel(); 124 if (Model.Item?.GetItem("Paragraph_Image")?.GetItem("Link") != null && !string.IsNullOrEmpty(Model?.Item?.GetItem("Paragraph_Image")?.GetItem("Link").GetString("ButtonLink"))) 125 { 126 imageLink = ParagraphService.Instance.GetLinkByItem(Model?.Item?.GetItem("Paragraph_Image")?.GetItem("Link")); 127 } 128 129 string fifthElementIconPath = "/Files/Templates/Designs/Swift/Assets/Images/DalgasFifthElements/"; 130 } 131 132 133 @{ 134 string strTitle = string.Empty; 135 string strSummary = string.Empty; 136 string strImage = string.Empty; 137 string strImage2 = string.Empty; 138 string strLink = string.Empty; 139 140 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/"; 141 142 var queryResult = ContentRelationService.Instance.GetGuidesByIndustries(); 143 144 List<string> pageIds = new List<string>(); 145 pageIds.AddRange(queryResult.Results.Select(qrr => qrr["PageId"].ToString())); 146 147 string imageAspectRatio = string.Empty; 148 string newsModolusClasslist = string.Empty; 149 FileViewModel featuredListImage = new FileViewModel(); 150 151 ClassList colClasslist = new ClassList("js-content-container content-container col-12 mb-4 dalgas-list-card"); 152 ClassList cardClasslist = new ClassList("pt-3"); 153 154 bool isProductPage = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request["ProductId"]); 155 string separator = Pageview.SearchFriendlyUrl.Contains("?") ? "&" : "?"; 156 string showAllUrl = $"{Pageview.SearchFriendlyUrl}{separator}PageSize=999"; 157 158 bool showFacets = Model.Item.GetBoolean("ShowFacets"); 159 bool showSearch = Model.Item.GetBoolean("ShowSearch"); 160 int numberOfItemsToShow = 3; 161 int totaleCount = 0; 162 if (showFacets == true || showSearch == true) 163 { 164 totaleCount = queryResult.TotalCount; 165 numberOfItemsToShow = 999; 166 } 167 168 List<FacetOption> selectedFacetOptions = new List<FacetOption>(); 169 int pageNum = int.TryParse(Dynamicweb.Context.Current.Request["PageNum"], out int result) ? result : 1; 170 string searchTerm = Dynamicweb.Context.Current.Request["q"]; 171 } 172 173 @if (queryResult.Results.Any()) 174 { 175 int loopCounter = 1; 176 <section id="section-@Model.Id" class="@sectionClassList" data-swift-gridrow> 177 <div class="container-xl"> 178 <div class="row justify-content-center"> 179 180 <div class="col-12 col-lg-11 ms-auto js-dalgas-queryresult-container dalgas-queryresult-container" 181 id="@($"query-result-{Model.Id}")"> 182 183 <div class="d-flex justify-content-between col-lg-11 mb-4"> 184 <div> 185 <span> 186 @string.Join("", headings.Select(h => h.ToString())) 187 </span> 188 189 @if (!string.IsNullOrEmpty(lead)) 190 { 191 <p class="lead">@lead</p> 192 } 193 194 @text 195 196 </div> 197 198 <div class="d-none d-lg-block"> 199 <div class="d-flex flex-wrap gap-3"> 200 @foreach (ButtonViewModel button in buttons) 201 { 202 @button 203 } 204 </div> 205 </div> 206 </div> 207 208 209 <form method="post" action="@Pageview.SearchFriendlyUrl" data-response-target-element="content" 210 tabindex="-1" aria-hidden="false" 211 class="d-flex js-dalgas-facets-form dalgas-facets-form col-12 col-lg-11 mb-4" 212 data-total-count="@totaleCount" data-page-size="@numberOfItemsToShow"> 213 <input type="hidden" name="LayoutTemplate" value="Designs/Swift/Swift_PageClean.cshtml"/> 214 <input type="hidden" name="PageNum" value="@pageNum"/> 215 <input type="hidden" name="PageSize" value="@numberOfItemsToShow"/> 216 217 @if (showFacets) 218 { 219 foreach (FacetGroup facetGroup in queryResult.FacetGroups) 220 { 221 foreach (Facet facet in facetGroup.Facets) 222 { 223 string showClass = " show"; 224 string ariaExpanded = "true"; 225 string facetGroupId = Regex.Replace(Convert.ToBase64String(Guid.NewGuid().ToByteArray()), "[/+=]", string.Empty, RegexOptions.None, TimeSpan.FromMilliseconds(5000)); 226 227 if (facet.Options.Any()) 228 { 229 int selectedFacetsInGroup = 0; 230 231 foreach (FacetOption option in facet.Options) 232 { 233 if (option.Selected) 234 { 235 selectedFacetsInGroup++; 236 } 237 } 238 239 string label = selectedFacetsInGroup > 0 ? Translate(facet.Name) + "<span style=\"padding: 0.3em 0.6em\" class=\"badge badge ms-2\">" + selectedFacetsInGroup + "</span>" : Translate(facet.Name); 240 241 <div class="dropdown js-facets-selector"> 242 <button class="btn dropdown-toggle" type="button" 243 id="FacetGroup_@facetGroupId" data-bs-toggle="dropdown" 244 aria-expanded="false"> 245 @label 246 </button> 247 <div data-lenis-prevent class="dropdown-menu p-3" 248 aria-labelledby="FacetGroup_@facetGroupId" style="min-width: 280px"> 249 @foreach (FacetOption facetOption in facet.Options.OrderBy(fo => fo.Label)) 250 { 251 string facetLabel = HtmlEncoder.HtmlEncode(facetOption.Label); 252 string disabled = facetOption.Count <= 0 ? "disabled" : string.Empty; 253 string selected = facetOption.Selected ? "checked" : string.Empty; 254 string facetValue = Uri.UnescapeDataString(facetOption.Value); 255 string optionValue = $"[{facetValue}]"; 256 257 facetLabel = facetLabel.ToLower() == "true" ? facetLabel = Translate("Yes") : facetLabel; 258 facetLabel = facetLabel.ToLower() == "false" ? facetLabel = Translate("No") : facetLabel; 259 260 <label class="form-check mt-1" @disabled> 261 <input type="checkbox" 262 onclick="custom.QueryResult.update(event)" 263 class="form-check-input" name="@facet.QueryParameter" 264 value="@optionValue" data-filter-value="@facetLabel" 265 @selected> 266 <span class="form-check-label d-flex align-items-center"> 267 <span class="flex-fill">@facetLabel </span> 268 <small class="opacity-85">@facetOption.Count</small> 269 </span> 270 </label> 271 272 if (facetOption.Selected) 273 { 274 FacetOption selectFacetOption = facetOption; 275 selectFacetOption.Name = facet.QueryParameter; 276 selectedFacetOptions.Add(selectFacetOption); 277 } 278 } 279 </div> 280 </div> 281 } 282 } 283 } 284 285 if (!string.IsNullOrEmpty(searchTerm)) 286 { 287 selectedFacetOptions.Add(new FacetOption() 288 { 289 Count = 1, 290 Label = searchTerm, 291 Name = "q", 292 Selected = true, 293 Value = searchTerm 294 }); 295 } 296 297 298 if (showSearch) 299 { 300 <div class="type-ahead-dropdown"> 301 <div class="position-relative suggest-form"> 302 <span 303 class="position-absolute top-0 end-0 icon-3 px-3 d-flex align-items-center h-100 search-icon"> 304 @ReadFile(iconPath + "search.svg") 305 </span> 306 307 <input id="searchField_@Model.Id" 308 class="form-control custom-header-searchbar js-custom-facets-search-field pe-5 ps-3 js-" 309 type="search" 310 placeholder="@Translate("Search here")" 311 autocomplete="off" 312 maxlength="255" 313 name="q" 314 value="@searchTerm" 315 data-original="@searchTerm"> 316 317 <button type="button" 318 onclick="custom.QueryResult.clearSearchField(event)" 319 class="btn h-100 icon-2 reset-search" 320 aria-label="@Translate("Clear search")" 321 style="opacity: 0; position: absolute; top: 0; right: 0; visibility: hidden;"> 322 @ReadFile(iconPath + "x.svg") 323 </button> 324 </div> 325 </div> 326 <input type="submit" onclick="custom.QueryResult.update(event)" class="btn btn-primary" 327 value="@Translate("Search", "Search")"> 328 } 329 } 330 </form> 331 332 <div 333 class="row @(showSearch || showFacets ? string.Empty : "dalgas-featured-list-mobile-horizontal-scroll") js-dalgas-queryresult-itemlist dalgas-queryresult-itemlist mt-2"> 334 335 @{ 336 ButtonViewModel btnViewResult = new ButtonViewModel 337 { 338 Text = Translate("View more"), 339 Type = ButtonType.Link, 340 DisplayType = ButtonDisplayType.Link 341 }; 342 } 343 344 @foreach (string pageId in pageIds.Take(numberOfItemsToShow)) 345 { 346 if (int.TryParse(pageId, out int intPageId) && intPageId == PageView.Current().Page.ID) 347 { 348 continue; 349 } 350 351 Page page = Services.Pages.GetPage(intPageId); 352 353 if (page == null) 354 { 355 continue; 356 } 357 358 strTitle = page.Item["Title"]?.ToString(); 359 strSummary = page.Item["Summary"]?.ToString(); 360 strImage = page.Item["CoverImage"] == null ? string.Empty : page.Item["CoverImage"]?.ToString(); 361 strImage2 = page.Item["CoverImage2nd"] == null ? string.Empty : page.Item["CoverImage2nd"]?.ToString(); 362 btnViewResult.Id = "pageId_" + page.ID; 363 btnViewResult.Url = "/Default.aspx?ID=" + page.ID; 364 365 int jpgIndex = strImage.IndexOf(".jpg", StringComparison.OrdinalIgnoreCase); 366 if (jpgIndex != -1) 367 { 368 strImage = strImage.Substring(0, jpgIndex + 4); 369 } 370 371 featuredListImage = ViewModelFactory.CreateFieldFileValueView(strImage); 372 373 if (loopCounter % 3 == 2) 374 { 375 newsModolusClasslist = "col-lg-5"; 376 imageAspectRatio = "ratio-3x4 ratio-custom-news"; 377 } 378 else 379 { 380 newsModolusClasslist = "col-lg-3"; 381 imageAspectRatio = "ratio-3x4"; 382 } 383 384 385 var guideImageParameters = new Dictionary<string, object>(); 386 guideImageParameters.Add("alt", strTitle); 387 388 <div class="@colClasslist @newsModolusClasslist"> 389 <figure class="ratio @imageAspectRatio m-0"> 390 <a href="@btnViewResult.Url"> 391 @RenderPartial("Components/Image.cshtml", featuredListImage ?? new FileViewModel(), guideImageParameters) 392 </a> 393 </figure> 394 <div class="@cardClasslist"> 395 <h3 class="h4"> 396 <a href="@btnViewResult.Url" class="text-decoration-none"> 397 @strTitle 398 </a> 399 </h3> 400 @if (strSummary != null) 401 { 402 <span class="small">@strSummary</span> 403 } 404 405 <div class="align-items-end d-flex"> 406 @RenderModel(btnViewResult) 407 </div> 408 </div> 409 </div> 410 411 412 loopCounter++; 413 } 414 415 </div> 416 <div class="d-lg-none"> 417 <div class="d-flex flex-wrap gap-3"> 418 @foreach (ButtonViewModel button in buttons) 419 { 420 @button 421 } 422 </div> 423 </div> 424 </div> 425 </div> 426 </div> 427 </section> 428 } 429 else 430 { 431 if (Pageview.IsVisualEditorMode) 432 { 433 <div class="container-xl alert alert-danger" role="alert"> 434 This <strong>@Model.Item.SystemName</strong> is empty 435 </div> 436 } 437 } 438
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/Shop_Slider.cshtml" System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Dalgas.Custom.Services.ContentRelationService.GetRelatedPagesByUrlAndParameters(String url, List`1 parameters, Int32 pageSize) in D:\a\1\s\Custom\Services\ContentRelationService.cs:line 81 at Dalgas.Custom.Services.ContentRelationService.GetPagesByIndustries(String pageItemType, Int32 pageSize) in D:\a\1\s\Custom\Services\ContentRelationService.cs:line 455 at CompiledRazorTemplates.Dynamic.RazorEngine_08f72e002af1478e8ec44c59ad17ae21.Execute() in E:\Solutions\dalgas\Files\Templates\Designs\Swift\Grid\Page\RowTemplates\Shop_Slider.cshtml:line 177 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.ViewModelTemplate<GridRowViewModel> 2 @using System 3 @using System.Collections.Generic 4 @using System.Linq 5 @using System.Web 6 @using Dalgas.Custom.Contexts 7 @using Dalgas.Custom.Extensions 8 @using Dalgas.Custom.Models.Content 9 @using Dalgas.Custom.Services 10 @using Dalgas.Custom.Services.Relewise 11 @using Dalgas.Custom.ViewModels.UI 12 @using Dynamicweb.Content 13 @using Dynamicweb.Ecommerce.Common 14 @using Dynamicweb.Ecommerce.Notifications 15 @using Dynamicweb.Frontend 16 @using Dynamicweb.Ecommerce.ProductCatalog 17 @using Dynamicweb.Ecommerce.Products 18 @using Dynamicweb.Ecommerce.Shops 19 @using Dynamicweb.Security.Permissions 20 @using ProductViewModel = Dalgas.Custom.Models.Ecommerce.ProductViewModel 21 @using ProductListViewModel = Dalgas.Custom.Models.Ecommerce.ProductListViewModel 22 @using ProductService = Dalgas.Custom.Services.ProductService 23 @using Page = Dynamicweb.Content.Page 24 25 @using System 26 @using System.Collections.Generic 27 @using System.Linq 28 @using Dalgas.Custom.ViewModels.UI 29 @using Dynamicweb.Content 30 @using Dynamicweb.Ecommerce.ProductCatalog 31 @using Dynamicweb.Frontend 32 @using ParagraphService = Dalgas.Custom.Services.ParagraphService 33 34 @*TODO: Move these functions onto the model *@ 35 36 @functions 37 { 38 39 public string GetSectionClassList(GridRowViewModel model, string overwriteTheme = "") 40 { 41 var returnValues = new List<string> 42 { 43 $"item_{model.Item.SystemName.ToLower()}" 44 }; 45 46 if (Services.Grids.GetGridRowById(model.Id).Sort == 1) 47 { 48 returnValues.Add("dalgas-section-first-on-page"); 49 } 50 51 var sectionBackgroundTheme = model.Item.GetItem("ColorScheme")?.GetString("ColorScheme") ?? string.Empty; 52 53 if (!string.IsNullOrEmpty(overwriteTheme)) 54 { 55 sectionBackgroundTheme = overwriteTheme; 56 } 57 58 // Add theme class if it exists 59 if (!string.IsNullOrWhiteSpace(sectionBackgroundTheme)) 60 { 61 if (sectionBackgroundTheme.Contains("default")) 62 { 63 returnValues.Add("theme theme-light"); 64 } 65 else 66 { 67 returnValues.Add($"theme {sectionBackgroundTheme.Replace(" ", "").Trim().ToLower()}"); 68 } 69 } 70 71 // Determine if top padding should be removed 72 73 string removeTopPadding = model.Item.GetItem("ColorScheme")?.GetString("RemoveTopPadding"); 74 75 returnValues.Add("pb-6"); 76 if (removeTopPadding != "enable") 77 { 78 returnValues.Add("pt-6"); 79 } 80 81 return string.Join(" ", returnValues); 82 } 83 84 } 85 86 87 @{ 88 IEnumerable<HeadingViewModel> headings = ParagraphService.Instance.GetHeadingsByItems(Model.Item?.GetItem("Paragraph_Text")?.GetItems("Headings")); 89 string text = Model.Item.GetItem("Paragraph_Text")?.GetString("Text"); 90 string lead = Model.Item.GetItem("Paragraph_Text")?.GetString("Lead"); 91 IEnumerable<ButtonViewModel> buttons = ParagraphService.Instance.GetButtonsByItems(Model.Item?.GetItem("Paragraph_Text")?.GetItems("Buttons")); 92 93 bool hasImage = Model.Item.GetItem("Paragraph_Image")?.GetFile("Image") != null; 94 bool hasText = !string.IsNullOrEmpty(Model.Item?.GetItem("Paragraph_Text")?.GetString("Text")); 95 bool hasLead = !string.IsNullOrEmpty(Model.Item?.GetItem("Paragraph_Text")?.GetString("Lead")); 96 bool hasHeading = headings.Any(); 97 bool hasButton = buttons.Any(); 98 99 var theme = Model.Item.GetItem("ColorScheme")?.GetString("ColorScheme"); 100 var fifthElementTheme = "fifth-element-color-" + Model.Item?.GetItem("ColorScheme")?.GetString("FifthElementColor"); 101 102 var sectionClassList = GetSectionClassList(Model); 103 104 var image = string.Empty; 105 var imageParameters = new Dictionary<string, object>(); 106 107 string layout = string.Empty; 108 Boolean enableFifthElement = false; 109 if (Model?.Item != null) 110 { 111 var paragraphLayout = Model.Item.GetItem("Paragraph_Layout"); 112 113 if (paragraphLayout != null) 114 { 115 layout = paragraphLayout.GetString("Layout"); 116 117 enableFifthElement = !string.IsNullOrEmpty(paragraphLayout.GetString("Layout_FifthElement")); 118 } 119 } 120 121 if (!string.IsNullOrEmpty(Model.Item?.GetItem("Paragraph_Image")?.GetFile("Image")?.Path)) 122 { 123 image = Model.Item.GetItem("Paragraph_Image").GetFile("Image").Path; 124 imageParameters.Add("alt", Model.Item.GetItem("Paragraph_Image")?.GetString("ImageAltText")); 125 int xPos = Model.Item.GetItem("Paragraph_Image").GetFile("Image")?.FocalPositionFromLeft ?? 50; 126 int yPos = Model.Item.GetItem("Paragraph_Image").GetFile("Image")?.FocalPositionFromTop ?? 50; 127 string cssPosition = $"{xPos}% {yPos}%"; 128 imageParameters.Add("style", "object-position:" + cssPosition); 129 } 130 131 LinkViewModel imageLink = new LinkViewModel(); 132 if (Model.Item?.GetItem("Paragraph_Image")?.GetItem("Link") != null && !string.IsNullOrEmpty(Model?.Item?.GetItem("Paragraph_Image")?.GetItem("Link").GetString("ButtonLink"))) 133 { 134 imageLink = ParagraphService.Instance.GetLinkByItem(Model?.Item?.GetItem("Paragraph_Image")?.GetItem("Link")); 135 } 136 137 string fifthElementIconPath = "/Files/Templates/Designs/Swift/Assets/Images/DalgasFifthElements/"; 138 } 139 140 141 @functions { 142 143 public class SliderItemViewModel 144 { 145 public string Title { get; set; } 146 public string Summary { get; set; } 147 public string Image { get; set; } 148 public string Link { get; set; } 149 public ProductViewModel Product { get; set; } 150 } 151 152 public enum ProductType 153 { 154 Relewise, 155 Products, 156 Groups 157 } 158 159 } 160 161 @{ 162 string strTitle = string.Empty; 163 string strSummary = string.Empty; 164 string strImage = string.Empty; 165 string strLink = string.Empty; 166 167 FileViewModel sliderImage; 168 var queryResult = new QueryResult(); 169 List<SliderItemViewModel> sliderItems = new List<SliderItemViewModel>(); 170 171 var contentType = Model.Item.GetItem("Content")?.GetString("Content"); 172 string shopId = PageView.Current().Area.EcomShopId; 173 string langId = PageView.Current().Area.EcomLanguageId; 174 175 if (contentType == "industries") 176 { 177 queryResult = ContentRelationService.Instance.GetIndustries(); 178 179 foreach (Dictionary<string, object> item in queryResult.Results) 180 { 181 if (item.TryGetValue("PageId", out var pageIdObj) && int.TryParse(pageIdObj?.ToString(), out int resultPageId)) 182 { 183 var page = Services.Pages.GetPage(resultPageId); 184 sliderItems.Add(new SliderItemViewModel 185 { 186 Title = page.Item["Title"]?.ToString(), 187 Summary = page.Item["Summary"]?.ToString(), 188 Image = page.Item["CoverImage"]?.ToString(), 189 Link = "/Default.aspx?ID=" + resultPageId 190 }); 191 } 192 } 193 } 194 else if (contentType == "productcategories") 195 { 196 197 var categories = ContentRelationService.Instance.GetProductCategoriesByIndustries(); 198 int ecommercePageId = ContextService.GetEcommercePageId(); 199 200 201 if (!string.IsNullOrEmpty(shopId) && !string.IsNullOrEmpty(langId)) 202 { 203 204 string categoryFeed = Model.Item.GetItem("Content")?.GetString("CategoryFeed"); 205 ProductType productType = ProductType.Relewise; 206 207 foreach (var category in categories) 208 { 209 var group = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(category.Id); 210 211 if (group == null) 212 { 213 continue; 214 } 215 216 if (!string.Equals(group.LanguageId, langId, StringComparison.OrdinalIgnoreCase)) 217 { 218 continue; 219 } 220 221 string largeImage = !string.IsNullOrEmpty(group.LargeImage) ? "/Files" + group.LargeImage : string.Empty; 222 223 if (group.HasPermission(PermissionLevel.Read)) 224 { 225 sliderItems.Add(new SliderItemViewModel 226 { 227 Title = group.Name, 228 Summary = "", 229 Image = largeImage, 230 Link = "/Default.aspx?ID=" + ecommercePageId + "&GroupID=" + group.Id 231 }); 232 } 233 } 234 235 switch (productType) 236 { 237 case ProductType.Relewise: 238 foreach (var category in categories) 239 { 240 var group = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(category.Id); 241 242 if (group != null) 243 { 244 string largeImage = !string.IsNullOrEmpty(group.LargeImage) ? "/Files" + group.LargeImage : string.Empty; 245 246 if (group.HasPermission(PermissionLevel.Read)) 247 { 248 sliderItems.Add(new SliderItemViewModel 249 { 250 Title = group.Name, 251 Summary = "", // optionally, fill in if you want group description or other metadata 252 Image = largeImage, 253 Link = "/Default.aspx?ID=" + ecommercePageId + "&GroupID=" + group.Id 254 }); 255 } 256 } 257 } 258 break; 259 260 case ProductType.Groups: 261 IEnumerable<string> selectedGroups = Model.Item 262 .GetItem("Content")? 263 .GetString("ChooseCategory_Category") 264 .Split(',') 265 .Select(g => g.Replace("g_", "")); 266 267 var currentLangId = PageView.Current().Area.EcomLanguageId; 268 269 foreach (string selectedGroup in selectedGroups) 270 { 271 Group group = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(selectedGroup); 272 273 if (group == null) 274 { 275 continue; 276 } 277 278 if (!string.Equals(group.LanguageId, currentLangId, StringComparison.OrdinalIgnoreCase)) 279 { 280 continue; 281 } 282 283 string largeImage = !string.IsNullOrEmpty(group.LargeImage) 284 ? "/Files" + group.LargeImage 285 : string.Empty; 286 287 if (group.HasPermission(PermissionLevel.Read)) 288 { 289 sliderItems.Add(new SliderItemViewModel 290 { 291 Title = group.Name, 292 Summary = "", 293 Image = largeImage, 294 Link = "/Default.aspx?ID=" + ecommercePageId + "&GroupID=" + group.Id 295 }); 296 } 297 } 298 299 break; 300 301 } 302 sliderItems = sliderItems.GroupBy(g => g.Title).Select(g => g.First()).ToList(); 303 304 } 305 306 } 307 else if (contentType == "products") 308 { 309 int productTake = 10; 310 311 string productFeed = Model.Item.GetItem("Content")?.GetString("ProductFeed"); 312 ProductType productType = ProductType.Relewise; 313 314 if (!string.IsNullOrEmpty(productFeed)) 315 { 316 // Try to parse the string to enum 317 if (Enum.TryParse(productFeed, true, out ProductType parsedType)) 318 { 319 productType = parsedType; 320 } 321 } 322 323 List<ProductViewModel> products = new List<ProductViewModel>(); 324 ProductListViewModel productListViewModel = new ProductListViewModel(); 325 326 switch (productType) 327 { 328 case ProductType.Relewise: 329 productListViewModel = RecommendationService.Instance.GetPersonalProductRecommendation(productTake, PageView.Current().AreaID); 330 products = productListViewModel.CustomProducts.ToList(); 331 break; 332 case ProductType.Products: 333 productListViewModel = Model.Item.GetItem("Content")?.GetValue("ChooseProducts") as ProductListViewModel; 334 products = productListViewModel?.CustomProducts.Take(productTake).ToList(); 335 break; 336 case ProductType.Groups: 337 IEnumerable<string> selectedGroups = Model.Item.GetItem("Content")?.GetString("ChooseCategory").Split(',').ToList().Select(g => g.Replace("g_", "")); 338 List<ProductViewModel> tempProduct = new List<ProductViewModel>(); 339 foreach (string selectedGroup in selectedGroups) 340 { 341 Group group = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(selectedGroup); 342 343 if (group == null) 344 { 345 continue; 346 } 347 348 if (!string.Equals(group.LanguageId, langId, StringComparison.OrdinalIgnoreCase)) 349 { 350 continue; 351 } 352 353 tempProduct.AddRange(group.Products 354 .Where(p => p.LanguageId == langId) // filtrer produkter pr. sprog 355 .Select(p => ProductService.Instance.GetProductViewModelById(p.Id, p.VariantId)) 356 ); 357 } 358 359 productListViewModel = tempProduct.GetProductList() as ProductListViewModel; 360 products = productListViewModel.CustomProducts.Take(productTake).ToList(); 361 break; 362 default: 363 productListViewModel = RecommendationService.Instance.GetPersonalProductRecommendation(productTake, PageView.Current().AreaID); 364 products = productListViewModel.CustomProducts.ToList(); 365 break; 366 } 367 368 if (products != null && products.Any()) 369 { 370 foreach (ProductViewModel product in products) 371 { 372 sliderItems.Add(new SliderItemViewModel 373 { 374 Title = product.DisplayName, 375 Summary = product.LongDescription, 376 Image = product.DefaultImage?.Value, 377 Link = product.Link, 378 Product = product 379 }); 380 } 381 } 382 } 383 384 385 ButtonViewModel btnViewModelViewAll = new ButtonViewModel 386 { 387 Id = "pageId_", 388 Url = "/Default.aspx?ID=" + 999, 389 Text = Translate("View all"), 390 Type = ButtonType.Link, 391 DisplayType = ButtonDisplayType.Secondary 392 }; 393 394 List<FileViewModel> imageList = new List<FileViewModel>(); 395 } 396 397 @if (sliderItems.Any()) 398 { 399 <section id="section-@Model.Id" class="@sectionClassList" data-swift-gridrow> 400 <div class="container-xl"> 401 <div class="row justify-content-center"> 402 <div class="col-12 col-lg-10"> 403 <div class="row"> 404 <div class="col-12 d-flex justify-content-between mb-2"> 405 @if (!string.IsNullOrEmpty(Model.Item.GetItem("Content").GetString("Title"))) 406 { 407 <h2 class="mb-0 mb-lg-5">@Model.Item.GetItem("Content").GetString("Title")</h2> 408 } 409 @if (sliderItems.Count > 1) 410 { 411 <div class="d-none d-lg-flex gap-3"> 412 <button type="button" title="@Translate("Previous slide")" 413 class="dalgas-swiper-button-prev" style="z-index:1;"> 414 <span class="visually-hidden">@Translate("Previous slide")</span> 415 </button> 416 <button type="button" title="@Translate("Next slide")" 417 class="dalgas-swiper-button-next" style="z-index:1;"> 418 <span class="visually-hidden">@Translate("Next slide")</span> 419 </button> 420 </div> 421 } 422 </div> 423 424 <div class="swiper-container row" data-shop-slider="true" data-initialized="false"> 425 <div class="swiper-wrapper"> 426 @foreach (var item in sliderItems) 427 { 428 int jpgIndex = item.Image?.IndexOf(".jpg", StringComparison.OrdinalIgnoreCase) ?? -1; 429 if (jpgIndex != -1) 430 { 431 item.Image = item.Image.Substring(0, jpgIndex + 4); 432 } 433 434 sliderImage = ViewModelFactory.CreateFieldFileValueView(item.Image); 435 imageList.Add(sliderImage); 436 437 <div class="swiper-slide d-flex flex-column"> 438 @if (item.Product != null) 439 { 440 @item.Product.RenderedHtml.GridItem 441 } 442 else 443 { 444 <div class="d-flex flex-column-reverse"> 445 <div 446 class="col-12 theme pt-3 d-flex flex-column justify-content-between"> 447 <div class="theme"> 448 <h3> 449 <a class="text-decoration-none" 450 href="@item.Link">@item.Title</a> 451 </h3> 452 <p class="small">@item.Summary</p> 453 </div> 454 </div> 455 <div class="col-12"> 456 <a href="@item.Link"> 457 <figure class="ratio ratio-3x4"> 458 @RenderPartial("Components/Image.cshtml", sliderImage ?? new FileViewModel()) 459 </figure> 460 </a> 461 </div> 462 </div> 463 } 464 465 </div> 466 } 467 </div> 468 </div> 469 470 </div> 471 </div> 472 </div> 473 </div> 474 </section> 475 } 476 else 477 { 478 if (Pageview.IsVisualEditorMode) 479 { 480 <div class="container-xl alert alert-danger" role="alert"> 481 This <strong>@Model.Item.SystemName</strong> is empty 482 </div> 483 } 484 } 485
Få en skræddersyet løsning
Dalgas A/S er fyldt med fagfolk. Og det her er mere end en webshop. Vi er en afdeling af fagpersoner, der har viden og erfaring med udstyr og værktøj inden for netop din branche. For dig betyder det at du får personlig service – uanset om du skal have et godt råd eller har brug for vejledning til et konkret produkt.
Derfor sætter vi en ære i gode kunderelationer. Så har du behov for fx storkøb, lagerkapacitet eller en fast leverance, er vi klar til at hjælpe dig. Du kan bestille tilbud direkte på webshoppen – men du kan også ringe og få en snak om din kundeaftale.








