Error executing template "/Designs/elsalg/searchresult/Paragraph/search.cshtml"
SolrNet.Exceptions.SolrConnectionException: Unable to connect to the remote server ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8983
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetResponse()
   at HttpWebAdapters.Adapters.HttpWebRequestAdapter.GetResponse()
   at SolrNet.Impl.SolrConnection.GetResponse(IHttpWebRequest request)
   at SolrNet.Impl.SolrConnection.Get(String relativeUrl, IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at SolrNet.Impl.SolrConnection.Get(String relativeUrl, IEnumerable`1 parameters)
   at SolrNet.Impl.SolrQueryExecuter`1.Execute(ISolrQuery q, QueryOptions options)
   at SolrNet.Impl.SolrBasicServer`1.Query(ISolrQuery query, QueryOptions options)
   at SolrNet.Impl.SolrServer`1.Query(ISolrQuery query, QueryOptions options)
   at SolrNet.Impl.SolrServer`1.Query(ISolrQuery q)
   at SolrNet.Impl.SolrServer`1.Query(String q)
   at eela.custom.Providers.SearchProvider.Search(String query, String isButik, String type, Int32 pageIndex, Int32 pageSize, String sort)
   at CompiledRazorTemplates.Dynamic.RazorEngine_eefcdee811394021a6425ada31b806af.Execute() in d:\websites\euronics.dk\application\Files\Templates\Designs\elsalg\searchresult\Paragraph\search.cshtml:line 40
   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.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @using System.Web.Script.Serialization 2 @using System.Reflection 3 @using System.Text.RegularExpressions 4 @using System.Web 5 @using Newtonsoft.Json; 6 @using Newtonsoft.Json.Linq; 7 @using Dynamicweb.Frontend; 8 @using Dynamicweb.Ecommerce 9 @using Dynamicweb.Ecommerce.Products; 10 @using Dynamicweb.Ecommerce.Shops; 11 @using eela.custom; 12 @using eela.custom.Models; 13 @using eela.custom.Providers; 14 15 @{ 16 if (HttpContext.Current.Request.QueryString != null && HttpContext.Current.Request.QueryString["q"] != null && !string.IsNullOrWhiteSpace(HttpContext.Current.Request.QueryString["q"])) 17 { 18 string q = HttpContext.Current.Request.QueryString["q"]; 19 string t = HttpContext.Current.Request.QueryString["t"]; 20 if (string.IsNullOrEmpty(t)) 21 { 22 t = "product"; 23 } 24 if (!string.IsNullOrEmpty(q)) 25 { 26 q = q.Replace(" -", ""); 27 q = q.Trim(); 28 } 29 30 string isButik = "false"; 31 var butiksNumber = HttpContext.Current.Request.Cookies["butiksnummer"]; 32 var alternativeDisplay = HttpContext.Current.Request.Cookies["butiksudstilling"]; 33 34 if (butiksNumber != null && !string.IsNullOrEmpty(butiksNumber.Value) && 35 alternativeDisplay != null && !string.IsNullOrEmpty(alternativeDisplay.Value) && alternativeDisplay.Value == "true") 36 { 37 isButik = "true"; 38 } 39 40 var result = SearchProvider.Search(q, isButik, t); 41 42 if (HttpContext.Current.Request.QueryString != null) 43 { 44 @RenderSearchResults(t, result, isButik); 45 } 46 } 47 else 48 { 49 <div class="title"> 50 <div class="container_4 clearfix"> 51 <div class="grid_4"> 52 <div>Din søgning gav ingen svar.</div> 53 </div> 54 55 </div> 56 </div> 57 } 58 59 } 60 61 62 63 @helper RenderSearchResults(string t, List<SearchResult> result, string isButik) 64 { 65 <!--@SnippetStart(cssFiles)--> 66 <link rel="stylesheet" type="text/css" media="all" href="/files/templates/designs/elsalg/assets/css/jquery-ui-1.10.3.custom.css" /> 67 <!--@SnippetEnd(cssFiles)--> 68 69 70 <style> 71 .categories label { 72 font-size: smaller; 73 } 74 </style> 75 76 <section id="main"> 77 78 <div class="title"> 79 <div class="container_4 clearfix"> 80 <div class="grid_4"> 81 <h1>S&oslash;geresultater</h1> 82 </div> 83 84 </div> 85 </div> 86 87 @RenderItems(t, result, isButik) 88 89 </section> 90 91 <style> 92 li[data-showing="0"] { 93 opacity: 0.4; 94 color: grey !Important; 95 } 96 </style> 97 } 98 99 100 @helper RenderItems(string t, List<SearchResult> result, string isButik) 101 { 102 103 <div class="shadow products-options" id="products-options-top"> 104 <div class="container_4 clearfix"> 105 <div class="grid_1"> 106 <div class="title"> 107 Begr&#198;ns resultater 108 </div> 109 </div> 110 <div class="grid_3 clearfix"> 111 <div class="sorting"> 112 </div> 113 114 <div class="pagination"> 115 </div> 116 </div> 117 </div> 118 </div> 119 120 <div class="container_4 clearfix"> 121 122 <div class="products-filters grid_1" id="products-filters"> 123 124 @RenderFilterTypes(t, result) 125 </div> 126 127 <div class="products product-list grid_3" id="products"> 128 <div id="products-data"> 129 <div id="products-data-loading"></div> 130 <div id="products-data-items"> 131 @{ 132 var resItem = result.FirstOrDefault(r => r.Type == t); 133 if (resItem == null || resItem.Items.Count == 0) 134 { 135 <div class="product"> 136 <div class="title"> 137 Ingen resultater fundet 138 </div> 139 </div> 140 141 } 142 else 143 { 144 145 <!--@SnippetStart(scripts)--> 146 147 <!-- ### NB: including the underscore javascript lib in order to use some nifty functions like isEqual --> 148 <script type="text/javascript" src="/files/templates/designs/elsalg/assets/scripts/underscore-min.js"></script> 149 <!-- ### ### --> 150 151 <!-- ### HISTORY HASHCHANGE PLUGIN FOR HISTORY HANDLING ### --> 152 <script type="text/javascript" src="/files/templates/designs/elsalg/assets/scripts/jquery.history-hashchange.js"></script> 153 <!-- ### ### --> 154 155 <script src="/files/templates/designs/elsalg/assets/scripts/search-filtering.js?ver=1"></script> 156 <script type="text/javascript" src="/searchresults-js?q=@(HttpContext.Current.Request.QueryString["q"])&t=@(t)&isButik=@(isButik)&ver=@DateTime.Now.ToFileTime()" ></script> 157 <!--@SnippetEnd(scripts)--> 158 159 if (t == "product") 160 { 161 foreach (var item in resItem.Items) 162 { 163 try 164 { 165 var product = Services.Products.GetProductById(item.ItemId, string.Empty, false); 166 167 var altPictureId = product.ProductFieldValues.GetProductFieldValue("ELSAlternatePictureID") == null || 168 product.ProductFieldValues.GetProductFieldValue("ELSAlternatePictureID").Value == null || 169 string.IsNullOrEmpty(product.ProductFieldValues.GetProductFieldValue("ELSAlternatePictureID").Value.ToString()) ? "0000000000001" : product.ProductFieldValues.GetProductFieldValue("ELSAlternatePictureID").Value.ToString(); 170 171 var productsSymbolsJson = product.ProductFieldValues.GetProductFieldValue("ELSProductSymbols") == null || product.ProductFieldValues.GetProductFieldValue("ELSProductSymbols").Value == null ? string.Empty : product.ProductFieldValues.GetProductFieldValue("ELSProductSymbols").Value.ToString(); 172 JArray productsSymbolsArray = new JArray(); 173 if (productsSymbolsJson != string.Empty && productsSymbolsJson != "[]") 174 { 175 productsSymbolsArray = JsonConvert.DeserializeObject(productsSymbolsJson) as JArray; ; 176 } 177 178 var imgSrc = "https://cdn1.elsalg.dk/inetimagegen.ashx?altFmImage_path=/Files/ELSALG/eCom/Pictures/" + altPictureId + ".png&amp;image=/files/ELSALG/eCom/Pictures/" + product.ProductFieldValues.GetProductFieldValue("ELSEan").Value.ToString() + ".png&amp;height=144&amp;width=144&amp;crop=5"; 179 var imgSrcError = "https://cdn1.elsalg.dk/inetimagegen.ashx?altFmImage_path=/Files/ELSALG/eCom/Pictures/0000000000001.png&height=144&width=144&crop=5"; 180 181 bool hasDiscount = false; 182 if (product.ProductFieldValues.GetProductFieldValue("ELSUnitSavings") != null && product.ProductFieldValues.GetProductFieldValue("ELSUnitSavings").Value != null) 183 { 184 hasDiscount = product.ProductFieldValues.GetProductFieldValue("ELSUnitSavings").Value.ToString() != "0" ? true : false; 185 } 186 187 string baseUrl = String.Format("Default.aspx?ID={0}&ProductID={1}-at-SHOP2", "9", product.Number); 188 string url = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(baseUrl).ToString(); 189 string buyURL = String.Format("{0}?cartcmd=add", url); 190 191 var primaryGroup = ProductProvider.GetPrimaryParentGroup(product.Id); 192 var elsEnergy = product.ProductFieldValues.GetProductFieldValue("ELSEnergy").Value.ToString(); 193 var energyImgPath = ProductProvider.GetEnergyImagePath(product.ProductFieldValues.GetProductFieldValue("ELSEan").Value.ToString(), elsEnergy, primaryGroup.Id.Replace("-at-SHOP2", "")); 194 195 <article class='product grid_1 @(hasDiscount ? "has-discount" : "")'> 196 <div class='product-content' title="@product.Name"> 197 <div class='image'> 198 199 <div class="imgwraprod"> 200 <a href="@url" class="clearfix"> 201 @if (!ProductProvider.ElectraImgExists(product.ProductFieldValues.GetProductFieldValue("ELSEan").Value.ToString(), product.Number)) 202 { 203 <img id='productImg' alt='@product.Name' src="@imgSrc" onerror="src='@imgSrcError'"> 204 } 205 else 206 { 207 var electraImgUrl = ProductProvider.GetElectraImgUrl(product.Number); 208 209 <img id='productImg' alt='@product.Name' src="@electraImgUrl" onerror="src='@imgSrcError'"> 210 } 211 </a> 212 </div> 213 214 <div class="product"> 215 <ul class="notes"> 216 @{ 217 foreach (JToken productSymbol in productsSymbolsArray) 218 { 219 <li class="test-winner" data-symbol="@productSymbol["value"].ToString()"><span class="ico" style="background-image:url('https://elsalg.dk/files/images/symbols/@(productSymbol["value"])')"></span><span class="txt">@productSymbol["description"]</span></li> 220 } 221 } 222 223 @if (hasDiscount) 224 { 225 <li class="discount" data-symbol="discount"><span class="ico" style="background-image: url('https://elsalg.dk/files/images/symbols/discount.png')"></span><span class="txt">Tilbud</span></li> 226 } 227 </ul> 228 </div> 229 </div> 230 <div class='text'> 231 <div class='description'> 232 <div class='title'> 233 <a href="@url">@product.Name</a> 234 </div> 235 <p class="productsubheader"> 236 @product.ProductFieldValues.GetProductFieldValue("ELSProductSubHeader").Value.ToString() 237 </p> 238 <div class="header-list">@product.ProductFieldValues.GetProductFieldValue("ELSProductShortText").Value.ToString()</div> 239 </div> 240 <div class='pricing clearfix'> 241 @if (!string.IsNullOrEmpty(energyImgPath)) 242 { 243 <span class="energy-pg"> 244 <a href="@string.Format("{0}?tab=specifications", url)"> 245 <img src="@energyImgPath" alt="" /> 246 </a> 247 </span> 248 } 249 250 <span class='price'> 251 @if (hasDiscount) 252 { 253 <span class='discount'>@(Convert.ToDecimal(product.ProductFieldValues.GetProductFieldValue("ELSUnitSavings").Value.ToString()) != 0 ? "Spar " + Convert.ToDouble(product.ProductFieldValues.GetProductFieldValue("ELSUnitSavings").Value.ToString()).ToString("0,0.00").Replace(",00", ",-") : "")</span> 254 } 255 @product.GetPrice("DKK","DK").PriceWithVAT.ToString("0,0.00").Replace(",00", ",-") 256 </span> 257 <span class='stockinfo'>@product.ProductFieldValues.GetProductFieldValue("ELSDeliveryText").Value.ToString()</span> 258 <div class='buy clearfix'> 259 <a onclick="AddToCartWithSupplemental('@buyURL', '@product.Number', '@String.Format("{0}-at-SHOP2", product.Number)', '@HttpUtility.HtmlEncode(product.Name)');return false;" class='button button-orange'> 260 K&#248;b 261 </a> 262 </div> 263 264 <span class="prod-spec-tab"><a href="@string.Format("{0}?tab=specifications", url)">Datablad</a></span> 265 </div> 266 </div> 267 </div> 268 </article> 269 } 270 catch (Exception ex) 271 { 272 } 273 } 274 } 275 276 if (t == "tip") 277 { 278 foreach (var item in resItem.Items) 279 { 280 try 281 { 282 <article class="product misc grid_1 tip" onclick="fnNavigateToProd(this)" data-href="default.aspx?id=@(item.ItemFoundOnPageId)#item@(item.ItemId)"> 283 <div class="misc-content product-content"> 284 <div class="title"> 285 <a onclick="fnNavigateToProd(this)" data-href="default.aspx?id=@(item.ItemFoundOnPageId)#item@(item.ItemId)">@item.ItemName</a> 286 </div> 287 <div class="description"></div> 288 <div class="more"> 289 <a onclick="fnNavigateToProd(this)" data-href="default.aspx?id=@(item.ItemFoundOnPageId)#item@(item.ItemId)">Læs mere</a> 290 </div> 291 </div> 292 </article> 293 } 294 catch (Exception ex) 295 { 296 } 297 } 298 } 299 300 if (t == "group") 301 { 302 foreach (var item in resItem.Items) 303 { 304 try 305 { 306 <article class="product misc grid_1 tip" onclick="fnNavigateToProd(this)" data-href="@item.Link"> 307 <div class="misc-content product-content"> 308 <div class="title"> 309 <a href="@item.Link">@item.ItemName</a> 310 </div> 311 <div class="description"></div> 312 <div class="more"> 313 <a href="@item.Link">Læs mere</a> 314 </div> 315 </div> 316 </article> 317 } 318 catch (Exception ex) 319 { 320 } 321 } 322 } 323 } 324 } 325 </div> 326 </div> 327 </div> 328 329 </div> 330 331 <div class="container_4 clearfix"> 332 <div class="grid_1">&#160;</div> 333 <div class="grid_3 clearfix"> 334 <div id="products-options-bottom"> 335 <div class="sorting"> 336 </div> 337 338 <div class="pagination"> 339 </div> 340 </div> 341 </div> 342 </div> 343 344 } 345 346 @helper RenderFilterTypes(string t, List<SearchResult> result) 347 { 348 349 <div class="products-filter notFilter"> 350 <div class="title">Type</div> 351 <div class="items"> 352 <ul> 353 @foreach (var item in result) 354 { 355 <li class="@(item.Type == t ? "current selected" : "")"> 356 <a class="@(item.Type == t ? "selected" : "")" onclick="setLoading(true)" href="@String.Format("/soegeresultat?q={0}&t={1}", HttpContext.Current.Request.QueryString["q"], item.Type)">@String.Format("{0} ({1})", item.DisplayType, item.TotalCount)</a> 357 </li> 358 } 359 </ul> 360 </div> 361 </div> 362 }
Gå til kurv