Maskinuthyrning

Orderlistan är tom

Exception in template (Designs\SkanskaMaskin\Paragraph\_form_customerservice_confirm.cshtml): System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.cbabefbb.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
   at Dynamicweb.Rendering.Template.Output()
@using System.Net; @using System.IO; @using System.Web; @using skanskamaskin.se.Helper; @using skanskamaskin.se.common; @using Softgear.Skanskamaskin.Excel; @using Dynamicweb; @using Dynamicweb.Extensibility; @using Dynamicweb.Rendering; @{ String name = Base.Request("sharelist-name"); String company = Base.Request("sharelist-company"); String email = Base.Request("sharelist-email"); String phone = Base.Request("sharelist-phone"); String message = Base.Request("sharelist-message"); String recipientMail; Int16 storeID = Convert.ToInt16(Base.Request("selectedStore")); Dynamicweb.Modules.UserManagement.User selectedStore = Dynamicweb.Modules.UserManagement.User.GetUserByID(storeID); recipientMail = selectedStore.Email; //recipientMail = "aki.ruuskanen@softgear.se"; /* TEST */ /*Send order*/ var service = new Excel(); //var dwOrder = new skanskamaskin.se.Helper.DwOrder(); //var order = dwOrder.GetDwCart("Cart2"); var order = Dynamicweb.eCommerce.Common.Context.Cart; order.ShopID = "SHOP1"; order.Comment = String.Format("Hämtas i {0}", selectedStore.Name); order.CustomerName = name; order.CustomerCompany = company; order.CustomerEmail = email; order.CustomerPhone = phone; order.CustomerComment = message; order.CheckOrder(); order.Complete = true; order.CompletedDate = DateTime.Now; order.IsCart = false; order.UpdateStepInfo(); order.UpdateCartToOrder(); order.Save(); /* Create orderconfirmation för Customer Cetner (Excel) */ var fileFullName = IoHelper.GetTemporaryFileName(); var fileData = service.CreateOrderExcel("Order", order, fileFullName, selectedStore); var memoryStream = IoHelper.GetAsMemoryStream(fileFullName); var customerMemoryStream = IoHelper.GetAsMemoryStream(fileFullName); /* Create orderconfirmation for customer (PDF)*/ Template template = new Template(); template.LoadTemplate("pdf/orderConfirmationPdf.cshtml"); WebHelper.FillOrderConfirmation(template, order, selectedStore); var fileBytes = WebHelper.GeneratePdfFromTemplate(template); // pdhHelper.SavePdfFromTemplate(template, Server.MapPath("/Files/Files/RMA/" + rmaNumber + ".pdf")); /* Send confirmationmails */ var manager = new EmailManager(); Dynamicweb.eCommerce.Frontend.Cart.CartCatch.ClearCart(); String storeSubject; String storBody; String customerSubject; String customerBody; String recipiantNameForOrderfileName; if (!String.IsNullOrWhiteSpace(company)){ recipiantNameForOrderfileName = company; } else { recipiantNameForOrderfileName = name; } storeSubject = String.Format("Orderförfrågan: ", company); storBody = String.Format("Ni har mottagit en orderförfrågan. Detaljerad information finns i bifogad orderfil.<br/><br/>Återkom till kund senast nästkommande vardag.<br/><br/>Meddelande:<br/>{0}", message); customerSubject = "Orderförfrågan"; customerBody = "Vi har mottagit din orderförfrågan och återkommer till dig senast nästkommande vardag.<br/><br/>I bifogat dokument finner du information om din beställning.<br/><br/> Vänliga hälsningar<br/> Skanska Maskin"; //MemoryStream customerMemoryStream = new MemoryStream(); //memoryStream.CopyTo(customerMemoryStream); /* Bekräftelse till kundcenter*/ manager.SendOrderFile(memoryStream, recipientMail, "noreply@maskinuthyrning.skanska.se", order.ID, storeSubject, storBody, recipiantNameForOrderfileName); /* Bekräftelse till kund */ manager.SendOrderFile(fileBytes, email, "noreply@maskinuthyrning.skanska.se", order.ID, customerSubject, customerBody, recipiantNameForOrderfileName); IoHelper.DeleteFile(fileFullName); } <section> <div class="Stack"> <div class="Container"> <div class="Grid Grid--equalPush Grid--withGutter"> <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2"> <div class="Type"> <h2 class="Input-aligned">@Translate("Orderlistan_ar_skickad", "Orderlistan är skickad!")</h2> <p>Ditt utvalda kundcenter har mottagit din förfrågan och återkommer till dig nästa vardag.</p> </div> </div> <div class="Grid-cell Grid--push u-sizeFull u-md-size1of2 u-lg-size1of2"> <div class="Type"> <h4>Namn</h4> <p>@name</p> </div> </div> <div class="Grid-cell Grid--push u-sizeFull u-md-size1of2 u-lg-size1of2"> <div class="Type"> <h4>Företagsnamn</h4> <p>@company</p> </div> </div> <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2"> <div class="Type"> <h4>Din-epost</h4> <p>@email</p> </div> </div> <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2"> <div class="Type"> <h4>Mobilnummer</h4> <p>@phone</p> </div> </div> <div class="Grid-cell u-sizeFull"> <h4></h4> <div class="Type u-textNoWrap"> <p>Hej,</p> <p>@message</p> </div> </div> </div> </div> </div> </section>