Error compiling template "Designs/Swift/Paragraph/DiscountExplanation.cshtml" Line 82: Cannot implicitly convert type 'string[]' to 'string'
1 //------------------------------------------------------------------------------ 2 // <auto-generated> 3 // This code was generated by a tool. 4 // Runtime Version:4.0.30319.42000 5 // 6 // Changes to this file may cause incorrect behavior and will be lost if 7 // the code is regenerated. 8 // </auto-generated> 9 //------------------------------------------------------------------------------ 10 11 namespace CompiledRazorTemplates.Dynamic { 12 using System; 13 using System.Collections.Generic; 14 using System.Linq; 15 16 #line 2 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 17 using Dynamicweb.Ecommerce.ProductCatalog; 18 19 #line default 20 #line hidden 21 22 23 public class RazorEngine_ab5f4d6027ef436dab329c45bc710429 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> { 24 25 #line hidden 26 27 public RazorEngine_ab5f4d6027ef436dab329c45bc710429() { 28 } 29 30 public override void Execute() { 31 WriteLiteral("\r\n"); 32 33 34 #line 4 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 35 36 ProductViewModel product = null; 37 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 38 { 39 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 40 } 41 else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) 42 { 43 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 44 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 45 46 if (productList?.Products is object) 47 { 48 product = productList.Products[0]; 49 } 50 } 51 52 53 string DiscountExplanation = ""; 54 foreach (var p in product.ProductFields) 55 { 56 if (p.Key == "DiscountExplanation" && p.Value != null) 57 { 58 DiscountExplanation = p.Value.ToString(); 59 break; 60 } 61 } 62 63 //TODO split based on $ character DiscountExplanation_Text 64 string DiscountExplanation_Text = "Buy 30 euros worth of products and get this for"; 65 string DiscountExplanation_percentage = "€ 5.25"; 66 67 var DiscountExplanation_Unsplitted = DiscountExplanation.Split("$".ToCharArray()); 68 if (DiscountExplanation_Unsplitted.Length == 2) 69 { 70 if (!string.IsNullOrWhiteSpace(DiscountExplanation_Unsplitted[0])) 71 { 72 DiscountExplanation_Text = DiscountExplanation_Unsplitted[0]; 73 } 74 if (!string.IsNullOrWhiteSpace(DiscountExplanation_Unsplitted[1])) 75 { 76 DiscountExplanation_percentage = DiscountExplanation_Unsplitted[1]; 77 } 78 DiscountExplanation_Text = DiscountExplanation_Text + " " + DiscountExplanation_percentage; 79 } 80 else 81 { 82 DiscountExplanation_Text = DiscountExplanation_Unsplitted; 83 } 84 85 86 #line default 87 #line hidden 88 WriteLiteral("\r\n\r\n\r\n"); 89 90 91 #line 56 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 92 if (product is object) 93 { 94 95 string fontsize_style = "font-size:" + Model.Item.GetRawValueString("Font_Size", "12px") + ";"; 96 97 98 99 100 #line default 101 #line hidden 102 WriteLiteral(" <div"); 103 104 WriteLiteral(" class=\"DiscountExplanation_Container\""); 105 106 WriteLiteral(">\r\n"); 107 108 109 #line 63 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 110 111 112 #line default 113 #line hidden 114 115 #line 63 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 116 if(!string.IsNullOrWhiteSpace(DiscountExplanation_Text)) 117 { 118 119 120 #line default 121 #line hidden 122 WriteLiteral(" <div"); 123 124 WriteLiteral(" style=\"width:100%\""); 125 126 WriteLiteral(" class=\"DiscountExplanation\""); 127 128 WriteAttribute("style", Tuple.Create(" style=\"", 2312), Tuple.Create("\"", 2335) 129 130 #line 65 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 131 , Tuple.Create(Tuple.Create("", 2320), Tuple.Create<System.Object, System.Int32>(fontsize_style 132 133 #line default 134 #line hidden 135 , 2320), false) 136 ); 137 138 WriteLiteral(">"); 139 140 141 #line 65 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 142 Write(DiscountExplanation_Text); 143 144 145 #line default 146 #line hidden 147 WriteLiteral("</div>\r\n"); 148 149 150 #line 66 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 151 } 152 153 154 #line default 155 #line hidden 156 WriteLiteral(" </div>\r\n"); 157 158 159 #line 68 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 160 } 161 else if (Pageview.IsVisualEditorMode) 162 { 163 164 165 #line default 166 #line hidden 167 WriteLiteral("\t<div"); 168 169 WriteLiteral(" class=\"alert alert-dark m-0\""); 170 171 WriteLiteral(" role=\"alert\""); 172 173 WriteLiteral(">\r\n\t\t<span>"); 174 175 176 #line 72 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 177 Write(Translate("No products available")); 178 179 180 #line default 181 #line hidden 182 WriteLiteral("</span>\r\n\t</div>\r\n"); 183 184 185 #line 74 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 186 } 187 188 #line default 189 #line hidden 190 } 191 } 192 } 193
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 4 @{ 5 ProductViewModel product = null; 6 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 7 { 8 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 9 } 10 else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) 11 { 12 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 13 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 14 15 if (productList?.Products is object) 16 { 17 product = productList.Products[0]; 18 } 19 } 20 21 22 string DiscountExplanation = ""; 23 foreach (var p in product.ProductFields) 24 { 25 if (p.Key == "DiscountExplanation" && p.Value != null) 26 { 27 DiscountExplanation = p.Value.ToString(); 28 break; 29 } 30 } 31 32 //TODO split based on $ character DiscountExplanation_Text 33 string DiscountExplanation_Text = "Buy 30 euros worth of products and get this for"; 34 string DiscountExplanation_percentage = "€ 5.25"; 35 36 var DiscountExplanation_Unsplitted = DiscountExplanation.Split("$".ToCharArray()); 37 if (DiscountExplanation_Unsplitted.Length == 2) 38 { 39 if (!string.IsNullOrWhiteSpace(DiscountExplanation_Unsplitted[0])) 40 { 41 DiscountExplanation_Text = DiscountExplanation_Unsplitted[0]; 42 } 43 if (!string.IsNullOrWhiteSpace(DiscountExplanation_Unsplitted[1])) 44 { 45 DiscountExplanation_percentage = DiscountExplanation_Unsplitted[1]; 46 } 47 DiscountExplanation_Text = DiscountExplanation_Text + " " + DiscountExplanation_percentage; 48 } 49 else 50 { 51 DiscountExplanation_Text = DiscountExplanation_Unsplitted; 52 } 53 } 54 55 56 @if (product is object) 57 { 58 59 string fontsize_style = "font-size:" + Model.Item.GetRawValueString("Font_Size", "12px") + ";"; 60 61 62 <div class="DiscountExplanation_Container"> 63 @if(!string.IsNullOrWhiteSpace(DiscountExplanation_Text)) 64 { 65 <div style="width:100%" class="DiscountExplanation" style="@fontsize_style">@DiscountExplanation_Text</div> 66 } 67 </div> 68 } 69 else if (Pageview.IsVisualEditorMode) 70 { 71 <div class="alert alert-dark m-0" role="alert"> 72 <span>@Translate("No products available")</span> 73 </div> 74 }
ΔΙΑΚΟΠΤΗΣ BELANKO ΣΥΣΤΗΜΑΤΟΣ ΑΝΘΡΑΚΙ 25Α 2 ΣΥΝΔΕΣΜΟΣ ΜΕ ΝΕΟΝ ΚΑΙ 13Α ΠΡΙΖΑ
0264553
Σε απόθεμα