Maskinuthyrning
Inga produkter valda

Din orderlista ä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.bbbbebbc.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()
@inherits Dynamicweb.Rendering.RazorTemplateBase<RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Softgear.SkanskaMaskin.Se.Helpers; @using Softgear.Skanskamaskin.Excel; @using Dynamicweb; @using Dynamicweb.Rendering; @using Softgear.SkanskaMaskin.Data.Business @{ var name = Base.Request("sharelist-name"); var company = Base.Request("sharelist-company"); var email = Base.Request("sharelist-email"); var phone = Base.Request("sharelist-phone"); var message = Base.Request("sharelist-message"); var orgNr = Base.Request("order-orgnr"); var projectNr = Base.Request("order-projectnr"); var invoiceAdress = Base.Request("invoice-adress"); var invoiceZip = Base.Request("invoice-zip"); var invoiceCity = Base.Request("invoice-city"); var deliveryAdress = Base.Request("invoice-adress"); var deliveryZip = Base.Request("invoice-zip"); var deliveryCity = Base.Request("invoice-city"); var reference = Base.Request("order-reference"); var deliveryDate = Base.Request("order-delivery-date"); var invoiceTag = Base.Request("order-invoice-tag"); var storeID = Convert.ToInt16(Base.Request("selectedStore")); var selectedStore = Dynamicweb.Modules.UserManagement.User.GetUserByID(storeID); var recipientMail = selectedStore.Email; //var 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.CustomerAccessUserID = Dynamicweb.Modules.UserManagement.User.GetCurrentUserID(); 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.CustomerAddress = invoiceAdress; order.CustomerZip = invoiceZip; order.CustomerCity = invoiceCity; order.DeliveryAddress = deliveryAdress; order.DeliveryZip = deliveryZip; order.DeliveryCity = deliveryCity; try { foreach (var orderOrderField in order.OrderFieldValues) { switch (orderOrderField.OrderField.SystemName) { case "reference": orderOrderField.Value = reference; break; case "deliveryDate": orderOrderField.Value = deliveryDate; break; case "invoicetag": orderOrderField.Value = invoiceTag; break; } } } catch (Exception ex) { var exeptionOutPut = string.Format("Message: {0} <br/>Stacktrace: {1} <br/> Innerexecptiob: {2}", ex.Message, ex.StackTrace, ex.InnerException); @exeptionOutPut } 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)*/ var template = new Template(); template.LoadTemplate("pdf/orderConfirmationPdf.cshtml"); WebHelper.fillOrderConfirmation(template, order, selectedStore); var fileBytes = WebHelper.generatePdfFromTemplate(template); /* Send confirmationmails */ var manager = new EmailManager(); Dynamicweb.eCommerce.Frontend.Cart.CartCatch.ClearCart(); string recipiantNameForOrderfileName; if (!string.IsNullOrWhiteSpace(company)) { recipiantNameForOrderfileName = company; } else { recipiantNameForOrderfileName = name; } var storeSubject = string.Format("Orderförfrågan: ", company); var 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); const string customerSubject = "Orderförfrågan"; const string 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"; /* 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>@GetString("ParagraphText")</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>