Error compiling template "Designs/Swift/Paragraph/DiscountExplanation.cshtml" Line 80: 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_7b8e278abd38445caa2993f4e3f953e1 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> { 24 25 #line hidden 26 27 public RazorEngine_7b8e278abd38445caa2993f4e3f953e1() { 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 54 //CS NT.. 55 56 string DiscountExplanation_Text = "Buy 30 euros worth of products and get this for"; 57 string DiscountExplanation_percentage = "€ 5.25"; 58 59 string DiscountExplanation = ""; 60 foreach (var p in product.ProductFields) 61 { 62 if (p.Key == "DiscountExplanation" && p.Value != null) 63 { 64 DiscountExplanation = p.Value.ToString(); 65 var DiscountExplanation_Unsplitted = DiscountExplanation.Split("$".ToCharArray()); 66 if (DiscountExplanation_Unsplitted.Length == 2) 67 { 68 if (!string.IsNullOrWhiteSpace(DiscountExplanation_Unsplitted[0])) 69 { 70 DiscountExplanation_Text = DiscountExplanation_Unsplitted[0]; 71 } 72 if (!string.IsNullOrWhiteSpace(DiscountExplanation_Unsplitted[1])) 73 { 74 DiscountExplanation_percentage = DiscountExplanation_Unsplitted[1]; 75 } 76 DiscountExplanation_Text = DiscountExplanation_Text + " " + DiscountExplanation_percentage; 77 } 78 else 79 { 80 DiscountExplanation_Text = DiscountExplanation_Unsplitted; 81 } 82 break; 83 } 84 } 85 86 //TODO split based on $ character DiscountExplanation_Text 87 88 89 90 #line default 91 #line hidden 92 WriteLiteral("\r\n\r\n\r\n"); 93 94 95 #line 60 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 96 if (product is object) 97 { 98 99 string fontsize_style = "font-size:" + Model.Item.GetRawValueString("Font_Size", "12px") + ";"; 100 101 102 103 104 #line default 105 #line hidden 106 WriteLiteral(" <div"); 107 108 WriteLiteral(" class=\"DiscountExplanation_Container\""); 109 110 WriteLiteral(">\r\n"); 111 112 113 #line 67 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 114 115 116 #line default 117 #line hidden 118 119 #line 67 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 120 if(!string.IsNullOrWhiteSpace(DiscountExplanation_Text)) 121 { 122 123 124 #line default 125 #line hidden 126 WriteLiteral(" <div"); 127 128 WriteLiteral(" style=\"width:100%\""); 129 130 WriteLiteral(" class=\"DiscountExplanation\""); 131 132 WriteAttribute("style", Tuple.Create(" style=\"", 2467), Tuple.Create("\"", 2490) 133 134 #line 69 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 135 , Tuple.Create(Tuple.Create("", 2475), Tuple.Create<System.Object, System.Int32>(fontsize_style 136 137 #line default 138 #line hidden 139 , 2475), false) 140 ); 141 142 WriteLiteral(">"); 143 144 145 #line 69 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 146 Write(DiscountExplanation_Text); 147 148 149 #line default 150 #line hidden 151 WriteLiteral("</div>\r\n"); 152 153 154 #line 70 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 155 } 156 157 158 #line default 159 #line hidden 160 WriteLiteral(" </div>\r\n"); 161 162 163 #line 72 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 164 } 165 else if (Pageview.IsVisualEditorMode) 166 { 167 168 169 #line default 170 #line hidden 171 WriteLiteral("\t<div"); 172 173 WriteLiteral(" class=\"alert alert-dark m-0\""); 174 175 WriteLiteral(" role=\"alert\""); 176 177 WriteLiteral(">\r\n\t\t<span>"); 178 179 180 #line 76 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 181 Write(Translate("No products available")); 182 183 184 #line default 185 #line hidden 186 WriteLiteral("</span>\r\n\t</div>\r\n"); 187 188 189 #line 78 "D:\dynamicweb.net\Solutions\nextech\Superhome.swiftstaging.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\DiscountExplanation.cshtml" 190 } 191 192 #line default 193 #line hidden 194 } 195 } 196 } 197
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 23 //CS NT.. 24 25 string DiscountExplanation_Text = "Buy 30 euros worth of products and get this for"; 26 string DiscountExplanation_percentage = "€ 5.25"; 27 28 string DiscountExplanation = ""; 29 foreach (var p in product.ProductFields) 30 { 31 if (p.Key == "DiscountExplanation" && p.Value != null) 32 { 33 DiscountExplanation = p.Value.ToString(); 34 var DiscountExplanation_Unsplitted = DiscountExplanation.Split("$".ToCharArray()); 35 if (DiscountExplanation_Unsplitted.Length == 2) 36 { 37 if (!string.IsNullOrWhiteSpace(DiscountExplanation_Unsplitted[0])) 38 { 39 DiscountExplanation_Text = DiscountExplanation_Unsplitted[0]; 40 } 41 if (!string.IsNullOrWhiteSpace(DiscountExplanation_Unsplitted[1])) 42 { 43 DiscountExplanation_percentage = DiscountExplanation_Unsplitted[1]; 44 } 45 DiscountExplanation_Text = DiscountExplanation_Text + " " + DiscountExplanation_percentage; 46 } 47 else 48 { 49 DiscountExplanation_Text = DiscountExplanation_Unsplitted; 50 } 51 break; 52 } 53 } 54 55 //TODO split based on $ character DiscountExplanation_Text 56 57 } 58 59 60 @if (product is object) 61 { 62 63 string fontsize_style = "font-size:" + Model.Item.GetRawValueString("Font_Size", "12px") + ";"; 64 65 66 <div class="DiscountExplanation_Container"> 67 @if(!string.IsNullOrWhiteSpace(DiscountExplanation_Text)) 68 { 69 <div style="width:100%" class="DiscountExplanation" style="@fontsize_style">@DiscountExplanation_Text</div> 70 } 71 </div> 72 } 73 else if (Pageview.IsVisualEditorMode) 74 { 75 <div class="alert alert-dark m-0" role="alert"> 76 <span>@Translate("No products available")</span> 77 </div> 78 }
WENKO T.PAPER HOLDER COVER CHROME
0222356
In stock