Kvitteringssiden

Error executing template "/Designs/elsalg/customerservice/Paragraph/4yearWarrantySuccess.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_efd2820e8a6d4476a08603fb2fc69c19.Execute() in d:\websites\elsalg.dk\application\Files\Templates\Designs\elsalg\customerservice\Paragraph\4yearWarrantySuccess.cshtml:line 42
   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 eela.custom; 2 @using eela.custom.Models; 3 @using eela.custom.Providers; 4 @using System.Web; 5 6 <div class="grid_3"> 7 @GetValue("ParagraphText") 8 @{ 9 Warranty warranty = (Warranty)HttpContext.Current.Cache.Get(string.Format("Current_warranty_{0}", HttpContext.Current.Session.SessionID)); 10 11 if (!string.IsNullOrWhiteSpace(HttpContext.Current.Request.QueryString["model"])) 12 { 13 string model = Uri.UnescapeDataString(HttpContext.Current.Request.QueryString["model"]); 14 15 HttpContext.Current.Response.Clear(); 16 HttpContext.Current.Response.ContentType = "application/pdf"; 17 18 byte[] content = WarrantyProvider.CreateWarrantyPDF(warranty, warranty.Products.FirstOrDefault(m => m.ModelNo == model)); 19 HttpContext.Current.Response.AddHeader("content-length", content.Length.ToString()); 20 HttpContext.Current.Response.BinaryWrite(content); 21 HttpContext.Current.Response.Flush(); 22 } 23 } 24 25 @if (warranty != null) 26 { 27 foreach (WarrantyProduct product in warranty.Products) 28 { 29 <div> 30 <a href="https://elsalg.dk/kundeservice/4-aars-garanti/kvitteringssiden?model=@product.ModelNo&timestamp=@DateTime.Now.ToString("yyyyMMddHHmmss")" id="download-pdf">Klik her for at hente garantibeviset for produktet @product.Brand - @product.ModelNo.</a> 31 </div> 32 } 33 } 34 </div> 35 36 <script> 37 dataLayer = []; 38 </script> 39 40 <script type="text/javascript"> topppp 41 $(function () { 42 @if(((Warranty)HttpContext.Current.Cache.Get(string.Format("Current_warranty_{0}", HttpContext.Current.Session.SessionID))).Subscribe) 43 { 44 <text> 45 //Google analytics send checkout event 46 47 var butiksNummer = $.cookie('butiksnummer'); 48 49 if (butiksNummer != undefined && butiksNummer != "") { 50 51 $.ajax({ 52 type: "GET", 53 url: ELSALG.urls.get.dealerinfo, 54 data: { id: butiksNummer, callback:'' }, 55 dataType: "json", 56 success: function (data) { 57 dataLayer.push({ 58 'event': 'gaPermission', 59 'gaEventCategory': 'Permission', 60 'gaEventAction': 'Warranty', 61 'gaEventLabel': data, 62 'gaEventValue': '' 63 }) 64 }, 65 error: function (xhr, status, error) { 66 dataLayer.push({ 67 'event': 'gaPermission', 68 'gaEventCategory': 'Permission', 69 'gaEventAction': 'Warranty', 70 'gaEventLabel': 'www', 71 'gaEventValue': '' 72 }) 73 } 74 }); 75 } else { 76 dataLayer.push({ 77 'event': 'gaPermission', 78 'gaEventCategory': 'Permission', 79 'gaEventAction': 'Warranty', 80 'gaEventLabel': 'www', 81 'gaEventValue': '' 82 }) 83 } 84 </text> 85 } 86 }); 87 </script>