sharefavoriteslist_confirm
Rental
Inga produkter valda

Din orderlista är tom

Error executing template "/Designs/SkanskaMaskin/Paragraph/_form_sharefavoritelist_confirm.cshtml"
Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Path '', line 0, position 0.
   at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
   at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
   at CompiledRazorTemplates.Dynamic.RazorEngine_96ee710b3877452092ffb07b70fd8291.Execute() in D:\wwwroot\rental.skanska.se\Files\Templates\Designs\SkanskaMaskin\Paragraph\_form_sharefavoritelist_confirm.cshtml:line 78
   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.Globalization 2 @using Newtonsoft.Json.Linq; 3 @using Softgear.Skanskamaskin.Document.Business 4 @using Softgear.SkanskaMaskin.Communication.Business 5 @using Softgear.Skanskamaskin.Document.Entities.Favorites 6 @using Softgear.SkanskaMaskin.Data.Business 7 @using System.Web 8 @using System.IO 9 @{ 10 string sharelistEmail; 11 string sharelistReceiver; 12 string sharelistMessage; 13 string sharelistName; 14 string sharelistId; 15 16 17 18 try 19 { 20 var input = new StreamReader(HttpContext.Current.Request.InputStream).ReadToEnd(); 21 JObject json = JObject.Parse(input); 22 23 sharelistEmail = HttpContext.Current.Server.UrlDecode(Convert.ToString(json["sharelist-email"])); 24 sharelistReceiver = HttpContext.Current.Server.UrlDecode(Convert.ToString(json["sharelist-receiver"])); 25 sharelistMessage = HttpContext.Current.Server.UrlDecode(Convert.ToString(json["sharelist-message"])); 26 sharelistName = HttpContext.Current.Server.UrlDecode(Convert.ToString(json["sharelist-name"])); 27 sharelistId = HttpContext.Current.Server.UrlDecode(Convert.ToString(json["sharelist-id"])); 28 29 var excelFavolista = new ExcelFavorites(); 30 var excelFavolistaHeader = new ExcelFavoritesHeaders(); 31 var excelFavolistaRow = new List<ExcelFavoritesRows>(); 32 33 //var document = new OrderDocument(); 34 //var header = new OrderDocumentHeader(); 35 //var rows = new List<OrderDocumentRow>(); 36 37 38 const string subject = @"Jag har skapat en favoritlista hos Skanska Rental. Ta gärna en titt!"; 39 40 if (string.IsNullOrEmpty(sharelistMessage) == false) 41 { 42 sharelistMessage = sharelistMessage.Replace("\n", "<br/>"); 43 } 44 45 var listId = Convert.ToInt16(sharelistId); 46 var favprodlist = WebHelper.GetFavoriteProducts(listId); 47 48 var userData = Dynamicweb.Security.UserManagement.User.GetCurrentUser(); 49 excelFavolistaHeader.CompanyName = userData.Company; 50 excelFavolistaHeader.ContactPersonName = userData.Name; 51 excelFavolistaHeader.ContactPersonEmail = userData.Email; 52 53 54 55 foreach (var row in favprodlist) 56 { 57 excelFavolistaRow.Add(new ExcelFavoritesRows 58 { 59 ProductName = row.ProductName, 60 ProductNumber = row.ProductId, 61 ProductCategory = row.ProductCategory 62 }); 63 excelFavolistaHeader.FavoriteListName = row.FavoriteListName; 64 } 65 66 excelFavolista.ExcelFavoritesHeader = excelFavolistaHeader; 67 excelFavolista.ExcelFavoritesRow = excelFavolistaRow; 68 var service = new ExcelManager(); 69 var fileStream = service.CreateFavoritesExcelStream(excelFavolista); 70 71 var manager = new MailManager(); 72 manager.SendSharedFavoriteList(fileStream, sharelistReceiver, @"noreply@rental.skanska.se", subject, sharelistMessage); 73 74 } 75 catch (Exception e) 76 { 77 Console.WriteLine(e); 78 throw; 79 } 80 } 81 <div class="Grid Grid--equalPush Grid--withGutter"> 82 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2"> 83 <div class="Type"> 84 <h2 class="Input-aligned">Din favoritlista är delad!</h2> 85 <p>Här är informationen som skickades:</p> 86 </div> 87 </div> 88 <div class="Grid-cell Grid--push u-sizeFull u-md-size1of2 u-lg-size1of2"> 89 <div class="Type"> 90 <h4>Ditt namn</h4> 91 <p>@sharelistName</p> 92 </div> 93 </div> 94 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2"> 95 <div class="Type"> 96 <h4>Din-epost</h4> 97 <p>@sharelistEmail</p> 98 </div> 99 </div> 100 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2"> 101 <div class="Type"> 102 <h4>Mottagarens-epost</h4> 103 <p>@sharelistReceiver</p> 104 </div> 105 </div> 106 <div class="Grid-cell u-sizeFull"> 107 <h4>Meddelande</h4> 108 <div class="Type u-textNoWrap"> 109 <p>@sharelistMessage</p> 110 </div> 111 </div> 112 </div> 113 <div class="Grid Grid--withGutter"> 114 <div class="Grid-cell u-sizeFull u-textRight"> 115 <button class="Button js-overlayClose">Ok, jag förstår</button> 116 </div> 117 </div>
forEach