Error executing template "Designs/Dwsimple/eCom/Product/SparePartsPdf.cshtml"
System.IO.IOException: The process cannot access the file 'D:\dynamicweb.net\Solutions\interspiro.cloud.dynamicweb-cms.com\Files\Templates\Designs\Dwsimple\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)
at CompiledRazorTemplates.Dynamic.RazorEngine_484d12983c1c40399f283bdf1a06fd9a.<>c__DisplayClass9_0.<RenderProductSheet>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\interspiro.cloud.dynamicweb-cms.com\Files\Templates\Designs\Dwsimple\eCom\Product\SparePartsPdf.cshtml:line 445
at CompiledRazorTemplates.Dynamic.RazorEngine_484d12983c1c40399f283bdf1a06fd9a.Execute() in D:\dynamicweb.net\Solutions\interspiro.cloud.dynamicweb-cms.com\Files\Templates\Designs\Dwsimple\eCom\Product\SparePartsPdf.cshtml:line 415
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.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
2 @using Dynamicweb.Frontend.Devices
3 @using Dynamicweb.Extensibility
4 @using Dynamicweb.Content
5 @using Dynamicweb.Core
6 @using System
7 @using System.IO
8 @using System.Web
9 @using System.Collections.Generic
10 @using Dynamicweb.Content.Items
11
12 @using Dynamicweb.Security.UserManagement;
13 @using Dynamicweb.Security.UserManagement.Common.CustomFields;
14
15 @using System.Text.RegularExpressions
16 @using System.Web
17
18
19 @functions{
20 public class WrapMethods
21 {
22 //Gets the contrasting color
23 public static string getContrastYIQ(string hexcolor)
24 {
25 if (hexcolor != "")
26 {
27 hexcolor = Regex.Replace(hexcolor, "[^0-9a-zA-Z]+", "");
28
29 int r = Convert.ToByte(hexcolor.Substring(0, 2), 16);
30 int g = Convert.ToByte(hexcolor.Substring(2, 2), 16);
31 int b = Convert.ToByte(hexcolor.Substring(4, 2), 16);
32 int yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
33
34 if (yiq >= 128)
35 {
36 return "black";
37 }
38 else
39 {
40 return "white";
41 }
42 }
43 else
44 {
45 return "black";
46 }
47 }
48
49
50 //Truncate text
51 public static string Truncate (string value, int count, bool strip=true)
52 {
53 if (strip == true){
54 value = StripHtmlTagByCharArray(value);
55 }
56
57 if (value.Length > count)
58 {
59 value = value.Substring(0, count - 1) + "...";
60 }
61
62 return value;
63 }
64
65
66 //Strip text from HTML
67 public static string StripHtmlTagByCharArray(string htmlString)
68 {
69 char[] array = new char[htmlString.Length];
70 int arrayIndex = 0;
71 bool inside = false;
72
73 for (int i = 0; i < htmlString.Length; i++)
74 {
75 char let = htmlString[i];
76 if (let == '<')
77 {
78 inside = true;
79 continue;
80 }
81 if (let == '>')
82 {
83 inside = false;
84 continue;
85 }
86 if (!inside)
87 {
88 array[arrayIndex] = let;
89 arrayIndex++;
90 }
91 }
92 return new string(array, 0, arrayIndex);
93 }
94
95 //Make the correct count of columns
96 public static string ColumnMaker(int Col, string ScreenSize)
97 {
98 string Columns = "";
99
100 switch (Col)
101 {
102 case 1:
103 Columns = "col-"+ScreenSize+"-12";
104 break;
105
106 case 2:
107 Columns = "col-"+ScreenSize+"-6";
108 break;
109
110 case 3:
111 Columns = "col-"+ScreenSize+"-4";
112 break;
113
114 case 4:
115 Columns = "col-"+ScreenSize+"-3";
116 break;
117
118 default:
119 Columns = "col-"+ScreenSize+"-3";
120 break;
121 }
122
123 return Columns;
124 }
125
126
127 private string Custom(string firstoption, string secondoption)
128 {
129 if (firstoption == "custom")
130 {
131 return secondoption;
132 }
133 else
134 {
135 return firstoption;
136 }
137 }
138 }
139 }
140
141
142
143
144
145 @functions{
146 public string GetParentSettingsItem(string systemName)
147 {
148 string item = null;
149
150 Dynamicweb.Content.Page current = Dynamicweb.Services.Pages.GetPage(Pageview.Page.ID);
151 while (current != null && current.Parent != current)
152 {
153 var temp = current.Item != null ? current.Item[systemName] : "";
154
155 if (temp != null)
156 {
157 item = temp.ToString();
158
159 if (!String.IsNullOrEmpty(item) && !String.Equals("default", item, StringComparison.OrdinalIgnoreCase))
160 {
161 break;
162 }
163 }
164
165 current = current.Parent;
166 }
167
168 return item;
169 }
170 }
171
172 @functions {
173 public static Dictionary<string, int> GetRelatedGroupSortOrder(string groupId, string productId)
174 {
175 var sortOrder = new Dictionary<string, int>();
176 using (var dr = Dynamicweb.Data.Database.CreateDataReader(string.Format("SELECT PRODUCTRELATEDPRODUCTRELID, PRODUCTRELATEDSORTORDER FROM EcomProductsRelated WHERE PRODUCTRELATEDGROUPID = '{0}' AND PRODUCTRELATEDPRODUCTID = '{1}'", groupId, productId)))
177 {
178 while (dr.Read())
179 {
180 sortOrder.Add(dr.GetString(0), dr.GetInt32(1));
181 }
182 }
183 return sortOrder;
184 }
185 }
186
187 @functions {
188 int heightBuffer;
189 int contentHeight;
190 int contentWidth;
191 int productItemHeight;
192 string pageOrientation;
193 int pageNumber;
194 }
195 @{
196 int productsOnSheet = 14;
197 int sheetMargin = GetParentSettingsItem("Margin") != null ? Convert.ToInt32(GetParentSettingsItem("Margin")) : 10;
198 int sheetHeight = 296;
199 int sheetWidth = 210;
200 int headerHeight = 15;
201 int footerHeight = 15;
202 string pageSize = "a4";
203 pageOrientation = "portrait";
204
205 if (pageOrientation == "portrait")
206 {
207
208 sheetHeight = 296;
209 sheetWidth = 210;
210
211 }
212 else
213 {
214
215 sheetHeight = 209;
216 sheetWidth = 296;
217
218 }
219
220 productsOnSheet = 25;
221
222
223 //Add a buffer to the height
224 heightBuffer = 30;
225 sheetHeight = sheetHeight - heightBuffer;
226 string pageMargin = GetParentSettingsItem("Margin") != null ? GetParentSettingsItem("Margin") : "10";
227 contentHeight = (sheetHeight - (headerHeight + footerHeight + (sheetMargin * 2)));
228 contentWidth = (sheetWidth - (sheetMargin * 2));
229 productItemHeight = (contentHeight - 2) / (productsOnSheet * 3);
230 var selectedTabs = new List<string>();
231 var pageid = GetValue("Ecom:Product:Page.ID");
232 var groupid = GetValue("Ecom:Group.ID");
233 var productid = GetValue("Ecom:Product.ID");
234 var ProductRelatedGroups = GetLoop("ProductRelatedGroups");
235 var groupName = "";
236 var translatetext = Translate("Accessories");
237 var accessories = translatetext;
238 foreach (var tabTitle in GetLoop("Tags.Options"))
239 {
240 if (tabTitle.GetString("Tags.Option.IsSelected") == "true")
241 {
242 selectedTabs.Add(tabTitle.GetString("Tags.Option.Name"));
243 }
244 }
245 int secondPage = 0;
246 if (Pageview.Area.Item["GlobalParagraph"] != null)
247 {
248 secondPage = Int32.Parse(Pageview.Area.Item["GlobalParagraph"].ToString());
249 }
250
251
252 string image = "";
253 image = !string.IsNullOrWhiteSpace(GetString("MasterProductImage")) ? GetString("MasterProductImage") : GetString("Ecom:Product.ImageLarge.Default.Clean");
254
255 string ImgPath = "/Admin/Public/Getimage.ashx?width=300&height=300&compression=85&Crop=5&image=";
256 string DefImg = "&altFmImage_path=/Files/Images/Ecom/missing_image.gif";
257 string Img = ImgPath + image + DefImg;
258 string image_1 = !string.IsNullOrWhiteSpace(GetString("MasterProductImage")) ? GetString("MasterProductImage").Replace(".jpg", "_1.jpg") : GetString("Ecom:Product.ImageImage_1.Clean");
259 string image_2 = !string.IsNullOrWhiteSpace(GetString("MasterProductImage")) ? GetString("MasterProductImage").Replace(".jpg", "_2.jpg") : GetString("Ecom:Product.ImageImage_2.Clean");
260 string image_3 = !string.IsNullOrWhiteSpace(GetString("MasterProductImage")) ? GetString("MasterProductImage").Replace(".jpg", "_3.jpg") : GetString("Ecom:Product.ImageImage_3.Clean");
261 var masterName = Dynamicweb.Ecommerce.Products.Product.GetProductById(GetString("Ecom:Product.ID"));
262 var user = Dynamicweb.Security.UserManagement.User.GetCurrentUser(Dynamicweb.Security.UserManagement.PagePermissionLevels.Frontend);
263 var userLang = GetGlobalValue("Global:Area.Lang").Replace("sv", "se").ToUpper();
264 string prodName = masterName.GetProductFieldValue("Description" + userLang).ToString() + " " + masterName.GetProductFieldValue("Description2" + userLang).ToString();
265 if (user != null)
266 {
267 if (!string.IsNullOrWhiteSpace(user.CustomFieldValues.Find(x => x.CustomField.SystemName == "AccessUser_LanguageCode").Value.ToString()))
268 {
269 userLang = user.CustomFieldValues.Find(x => x.CustomField.SystemName == "AccessUser_LanguageCode").Value.ToString().ToUpper();
270 }
271
272 prodName = masterName.GetProductFieldValue("Description" + userLang).ToString() + " " + masterName.GetProductFieldValue("Description2" + userLang).ToString();
273 }
274
275
276 DateTime serverTime = DateTime.Now;
277 string date = serverTime.Date.ToString("yyyy MMMM");
278 <section class="sheet spare-parts-pdf spare-parts">
279 <div class="sheet-container sheet-container--flex-col">
280 @RenderPaperHeader()
281 <div class="sheet-container__content sheet-container__content--padding-@(pageMargin)mm" style="height: @(contentHeight + heightBuffer)mm;width: 190mm; text-align:center;">
282 <br />
283 <br />
284 <br />
285 <div style="height:63%">
286 @if (string.IsNullOrWhiteSpace(image_1))
287 {
288 <img src="@Img" class="img-responsive" width="70%">
289 }
290 @if (!string.IsNullOrWhiteSpace(image_1))
291 {
292 <img src="@image_1" class="img-responsive" width="70%">
293 }
294 </div>
295
296 <table class="sheet-product-table">
297 <tr class="sheet-product-table-item">
298 <td align="right">
299 <br />
300 <br />
301 <br />
302 <br />
303 <br />
304 @if (!string.IsNullOrWhiteSpace(prodName))
305 {
306 <div class="G">@prodName</div>
307 }
308 else
309 {
310 <div class="G">
311 @masterName.Name
312 </div>
313 }
314 </td>
315 </tr>
316 <tr>
317 <td class="border-top">
318 </td>
319 </tr>
320
321 <tr>
322 <td align="right">
323 <div>
324 <br />
325 <br />
326 <br />
327 <div class="H">@date</div>
328 </div>
329 </td>
330 </tr>
331 </table>
332 </div>
333 @RenderPaperFooterCover()
334 </div>
335 </section>
336 <section class="sheet spare-parts-pdf spare-parts">
337 <div class="sheet-container sheet-container--flex-col">
338 <div class="sheet-container__content sheet-container__content--padding-@(pageMargin)mm" style="height: @(contentHeight + heightBuffer)mm;">
339 <div class="paragraph-pdf">
340 <br/>
341 @RenderParagraphContent(secondPage)
342 </div>
343 </div>
344 </div>
345 </section>
346 using (var dr = Dynamicweb.Data.Database.CreateDataReader("SELECT eprg.RelatedGroupID, eprg.RelatedGroupName FROM EcomProductsRelatedGroups eprg WHERE eprg.RelatedGroupLanguageID = '" + GetString("Ecom:Product.LanguageID") + "' AND (SELECT COUNT(*) FROM EcomProductsRelated epr WHERE eprg.RelatedGroupID = epr.ProductRelatedGroupID AND epr.ProductRelatedProductID = '" + productid + "') > 0 ORDER BY RelatedGroupSortOrder"))
347 {
348 while (dr.Read())
349 {
350 var groupId = dr.GetString(0);
351 groupName = dr.GetString(1);
352 if (groupName == accessories || selectedTabs.Contains(groupName))
353 {
354 continue;
355 }
356
357
358
359 var relatedgroupimage = "/Files/Images/Ecom/Relation product group/" + groupName + "." + "jpg";
360 var filePath = relatedgroupimage;
361 var absolutePath = System.Web.HttpContext.Current.Server.MapPath("~/" + filePath);
362
363 string ProdItemid = HttpContext.Current.Request.QueryString.Get("ProductID");
364 var RelatedGroups = ProductRelatedGroups.Where(x => (x.GetString("Ecom:Product:RelatedGroup.GroupID") == groupId && x.GetString("Ecom:Product:RelatedGroup.Name") != accessories && !selectedTabs.Contains(x.GetString("Ecom:Product:RelatedGroup.Name"))));
365 var relatedGroupSortOrder = GetRelatedGroupSortOrder(groupId, ProdItemid);
366 int productImageHeight = productItemHeight < 15 ? 6 : productItemHeight - 4;
367 if(System.IO.File.Exists(absolutePath))
368 {
369 <section class="sheet spare-parts-pdf spare-parts">
370 <div class="sheet-container sheet-container--flex-col">
371 <br />
372 <div class="sheet-container__content sheet-container__content--padding-@(pageMargin)mm" style="height: @(contentHeight + heightBuffer)mm; text-align:center">
373 <div class="J">@groupName</div>
374 <br />
375 <br />
376 @if (System.IO.File.Exists(absolutePath))
377 {
378 <img src="@relatedgroupimage?hash=@DateTime.Now" width="100%" alt="" />
379
380 }
381 </div>
382 <br />
383 <br />
384 <br />
385 @RenderPaperFooter()
386 </div>
387 </section>
388 }
389
390 int num = 0;
391 foreach (LoopItem product in RelatedGroups)
392 {
393
394 int count = 1;
395 List<LoopItem> productListPart = new List<LoopItem>();
396 foreach (LoopItem n in product.GetLoop("RelatedProducts").OrderBy(x => relatedGroupSortOrder[x.GetString("Ecom:Product.ID")]))
397 {
398 productListPart.Add(n);
399 num++;
400 if (count <= 24)
401 {
402 count++;
403 }
404 else
405 {
406
407 @RenderProductSheet(productListPart, groupName, count, num);
408 productListPart.Clear();
409 count = 1;
410 }
411 }
412 if (count != 1)
413 {
414
415 @RenderProductSheet(productListPart, groupName, count, num);
416 }
417
418 }
419 }
420 }
421
422 }
423 @helper RenderProductSheet(List<LoopItem> products, string groupName, int count, int num)
424 {
425 var masterName = Dynamicweb.Ecommerce.Products.Product.GetProductById(GetString("Ecom:Product.ID"));
426 var user = Dynamicweb.Security.UserManagement.User.GetCurrentUser(Dynamicweb.Security.UserManagement.PagePermissionLevels.Frontend);
427 var userLang = GetGlobalValue("Global:Area.Lang").Replace("sv", "se").ToUpper();
428 string prodName = masterName.GetProductFieldValue("Description" + userLang).ToString() + " " + masterName.GetProductFieldValue("Description2" + userLang).ToString();
429 string pageMargin = GetParentSettingsItem("Margin") != null ? GetParentSettingsItem("Margin") : "10";
430 int c = num;
431 int counter = 0;
432 int s = count;
433 int numberCount = 0;
434 <section class="sheet spare-parts-pdf-products spare-parts">
435 <div class="sheet-container sheet-container--flex-col">
436 <br />
437 <div class="sheet-container__content sheet-container__content--padding-@(pageMargin)mm" style="height: 265mm">
438 <div style="text-align:center">
439 <div class="J">@groupName</div>
440 </div>
441 <table class="sheet-product-table">
442 <thead class="sheet-product-table__head">
443 <tr>
444 <td style="color:white;" class="K">@Translate("Number")</td>
445 <td style="color:white;" class="K">@Translate("Product number")</td>
446 <td style="color:white;" class="description K">@Translate("Description")</td>
447 </tr>
448 </thead>
449 @foreach (LoopItem n in products)
450 {
451 if (c <= 25)
452 {
453 numberCount = ++counter;
454 }
455 if (c > 25 && c <= 50)
456 {
457 numberCount = 25 + ++counter;
458 }
459 if (c > 50 && c <= 75)
460 {
461 numberCount = 50 + ++counter;
462 }
463 if (c > 75 && c <= 100)
464 {
465 numberCount = 75 + ++counter;
466 }
467 if (c > 100 && c <= 125)
468 {
469 numberCount = 100 + ++counter;
470 }
471 if (c > 125 && c <= 150)
472 {
473 numberCount = 125 + ++counter;
474 }
475 string number = n.GetString("Ecom:Product.Number");
476 string name = n.GetString("Ecom:Product.Name");
477 var fontSize = "";
478 if (user != null)
479 {
480 userLang = user.CustomFieldValues.Find(x => x.CustomField.SystemName == "AccessUser_LanguageCode").Value.ToString().ToUpper();
481
482 if (!string.IsNullOrWhiteSpace(n.GetString("Ecom:Product:Field.Description" + userLang)))
483 {
484 name = n.GetString("Ecom:Product:Field.Description" + userLang) + " " + n.GetString("Ecom:Product:Field.Description2" + userLang);
485 }
486
487 }
488
489 else
490 {
491 userLang = GetGlobalValue("Global:Area.Lang").Replace("sv", "se").ToUpper();
492 if (!string.IsNullOrWhiteSpace(n.GetString("Ecom:Product:Field.Description" + userLang)))
493 {
494 name = n.GetString("Ecom:Product:Field.Description" + userLang) + " " + n.GetString("Ecom:Product:Field.Description2" + userLang);
495 }
496 }
497 int characters = 0;
498 characters = name.Length;
499 if (characters > 80)
500 {
501 if (characters <= 80)
502 {
503 fontSize = "font-size:11pt; color:black";
504 }
505 if (characters > 80)
506 {
507 fontSize = "font-size:9pt; color:black";
508 name = WrapMethods.Truncate(name, 90);
509 }
510
511 }
512
513 <tr class="sheet-product-table-item" style="height: @(productItemHeight)mm">
514 <td style="color:black;" class="L">
515 @numberCount
516 </td>
517 <td style="color:black;">
518 <div class="sheet-product-number M"> @number</div>
519
520 </td>
521 <td style="color:black;">
522 <div class="sheet-product-title N" style="@fontSize ">
523 @name
524 </div>
525 </td>
526 </tr>
527
528 }
529 </table>
530 </div>
531
532 @RenderPaperFooter()
533 </div>
534 </section>
535
536 }
537 @helper RenderPaperHeader()
538 {
539 string pageMargin = GetParentSettingsItem("Margin") != null ? GetParentSettingsItem("Margin") : "10";
540
541 var colorService = new ColorSwatchService();
542 var headerSettings = Dynamicweb.Content.Items.Item.GetItemById("SparePartsHeader", GetParentSettingsItem("Header"));
543
544 string headerBackgroundColor = headerSettings["BackgroundColor"] != null ? headerSettings["BackgroundColor"].ToString() : "";
545 headerBackgroundColor = !headerBackgroundColor.Contains("#") ? colorService.GetHexColor(Pageview.AreaID, headerBackgroundColor) : headerBackgroundColor;
546
547 string headerFontColor = headerSettings["FontColor"] != null ? headerSettings["FontColor"].ToString() : "";
548 headerFontColor = !headerFontColor.Contains("#") ? colorService.GetHexColor(Pageview.AreaID, headerFontColor) : headerFontColor;
549
550 string headerLayout = headerSettings["Layout"] != null ? headerSettings["Layout"].ToString() : "1";
551
552 <div class="sheet-container__header sheet-container__header--padding-@(pageMargin)mm" style="background-color: @(headerBackgroundColor); color: @(headerFontColor)">
553
554 @RenderHeaderLayout1()
555
556 </div>
557 }
558 @helper RenderHeaderLayout1()
559 {
560 DateTime serverTime = DateTime.Now;
561 string date = serverTime.Date.ToString("dd/MM/yyyy");
562 var headerSettings = Dynamicweb.Content.Items.Item.GetItemById("SparePartsHeader", GetParentSettingsItem("Header"));
563 var logo = GetParentSettingsItem("Logo");
564 var user = Dynamicweb.Security.UserManagement.User.get_Current(Dynamicweb.Security.UserManagement.PagePermissionLevels.Frontend);
565 var userLang = "";
566 var masterName = Dynamicweb.Ecommerce.Products.Product.GetProductById(GetString("Ecom:Product.ID"));
567 var productName = "";
568 if (user != null)
569 {
570 userLang = user.CustomFieldValues.Find(x => x.CustomField.SystemName == "AccessUser_LanguageCode").Value.ToString();
571
572
573 productName = GetString("Ecom:Product:Field.Description" + userLang) + " " + GetString("Ecom:Product:Field.Description2" + userLang);
574
575
576 }
577
578 else
579 {
580 userLang = GetGlobalValue("Global:Area.Lang").Replace("sv", "se").ToUpper();
581
582
583
584 productName = GetString("Ecom:Product:Field.Description" + userLang) + " " + GetString("Ecom:Product:Field.Description2" + userLang);
585
586 }
587
588 if (Path.GetExtension(logo).ToLower() != ".svg")
589 {
590 logo = logo;
591 }
592 else
593 {
594 logo = HttpUtility.UrlDecode(logo);
595 }
596
597 <div class="sheet-header-left">
598 <div class="sheet-footer-logo">
599 <img src="@logo" width="108" />
600 </div>
601 </div>
602 <div class="sheet-header-center" style="width:60%;">
603 <text>
604 <h1 style="margin-top:-20px">
605 @Translate("Spare part list")
606 </h1>
607 </text>
608 </div>
609 <div class="sheet-header-right">
610 <div class="sheet-header-date"> </div>
611 </div>
612 }
613 @helper RenderPaperFooterCover()
614 {
615 var footerSettings = Dynamicweb.Content.Items.Item.GetItemById("SparePartsFooter", GetParentSettingsItem("Footer"));
616 string pageMargin = GetParentSettingsItem("Margin") != null ? GetParentSettingsItem("Margin") : "11";
617 var colorService = new ColorSwatchService();
618 string footerBackgroundColor = footerSettings["BackgroundColor"] != null ? footerSettings["BackgroundColor"].ToString() : "";
619 footerBackgroundColor = !footerBackgroundColor.Contains("#") ? colorService.GetHexColor(Pageview.AreaID, footerBackgroundColor) : footerBackgroundColor;
620 string footerFontColor = footerSettings["FontColor"] != null ? footerSettings["FontColor"].ToString() : "";
621 footerFontColor = !footerFontColor.Contains("#") ? colorService.GetHexColor(Pageview.AreaID, footerFontColor) : footerFontColor;
622 string footerLayout = footerSettings["Layout"] != null ? footerSettings["Layout"].ToString() : "1";
623 <div class="sheet-container__footer sheet-container__footer--padding-@(pageMargin)mm" style="background-color: @(footerBackgroundColor); color: @(footerFontColor)">
624 @RenderFooterLayout1Cover()
625 </div>
626 }
627 @helper RenderFooterLayout1Cover()
628 {
629
630 var host = GetGlobalValue("Global:Request.Host");
631 var scheme = GetGlobalValue("Global:Request.Scheme") + "://";
632 var colorService = new ColorSwatchService();
633 var footerSettings = Dynamicweb.Content.Items.Item.GetItemById("SparePartsFooter", GetParentSettingsItem("Footer"));
634
635
636
637 string footerFontColor = footerSettings["FontColor"] != null ? footerSettings["FontColor"].ToString() : "";
638 footerFontColor = !footerFontColor.Contains("#") ? colorService.GetHexColor(Pageview.AreaID, footerFontColor) : footerFontColor;
639
640 string footerLayout = footerSettings["Layout"] != null ? footerSettings["Layout"].ToString() : "1";
641 <div class="sheet-footer-left">
642
643 </div>
644 <div class="sheet-footer-center">
645
646 </div>
647 <div class="sheet-footer-right">
648 <text>
649 <a href="@scheme@host" style="color: @footerFontColor;text-decoration: none;line-height: 37px;vertical-align: middle;" class="I">@host</a>
650 </text>
651 </div>
652 }
653 @helper RenderPaperFooter()
654 {
655 string pageMargin = GetParentSettingsItem("Margin") != null ? GetParentSettingsItem("Margin") : "10";
656
657 pageNumber = 3;
658 if (System.Web.HttpContext.Current.Items.Contains("PaperPageNumber"))
659 {
660 pageNumber = Convert.ToInt32(System.Web.HttpContext.Current.Items["PaperPageNumber"]);
661 pageNumber++;
662 System.Web.HttpContext.Current.Items["PaperPageNumber"] = pageNumber;
663 }
664 else
665 {
666 System.Web.HttpContext.Current.Items.Add("PaperPageNumber", pageNumber);
667 }
668
669
670
671 <div class="sheet-container__footer sheet-container__footer--padding-@(pageMargin)mm" style="color: #121212">
672 @RenderFooterLayout1()
673 </div>
674 }
675 @helper RenderFooterLayout1()
676 {
677 var footerSettings = Dynamicweb.Content.Items.Item.GetItemById("SparePartsFooter", GetParentSettingsItem("Footer"));
678
679 <div class="sheet-footer-left">
680 <text> </text>
681 </div>
682 <div class="sheet-footer-center">
683 @if (footerSettings["ShowPageNumber"] != null)
684 {
685 if (Convert.ToBoolean(footerSettings["ShowPageNumber"]))
686 {
687 <div class="sheet-footer-page-number">
688 @pageNumber
689 </div>
690 }
691 else
692 {
693 <text> </text>
694 }
695 }
696 else
697 {
698 <text> </text>
699 }
700 </div>
701 <div class="sheet-footer-right">
702 <text> </text>
703 </div>
704 }
705