Error executing template "/Designs/SkanskaMaskin/Paragraph/_form_customerservice.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_1b2471f27016471cb9b01d5cfe398437.Execute() in D:\wwwroot\rental.skanska.se\Files\Templates\Designs\SkanskaMaskin\Paragraph\_form_customerservice.cshtml:line 16
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.<RunCompile>b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @using Softgear.SkanskaMaskin.DataAccess.Helpers
2 @using Newtonsoft.Json;
3 @using Newtonsoft.Json.Linq;
4 @using Softgear.SkanskaMaskin.Data.Business
5 @using System.IO;
6 @using System.Web;
7 @using Dynamicweb
8 @using Softgear.SkanskaMaskin.Data.Entities.Common
9 @using Attribute = Softgear.SkanskaMaskin.Data.Entities.Common.Attribute
10 @using Input = Softgear.SkanskaMaskin.Data.Entities.Common.Input
11
12 @{
13 var hbh = new HandleBarsHelper();
14 var inputAttrs = new List<object>();
15 var input = new System.IO.StreamReader(HttpContext.Current.Request.InputStream).ReadToEnd();
16 var json = JObject.Parse(input);
17 var selectedStoreId = Convert.ToInt16(json["store"]);
18 var selectedStore = Dynamicweb.Security.UserManagement.User.GetUserByID(selectedStoreId);
19 var total = 0;
20 var customerCenters = CacheManager.GetFromCache<Dynamicweb.Security.UserManagement.UserCollection>(60, "customerCentersGroup4", () => Dynamicweb.Security.UserManagement.User.GetUsers(false, true, true, "AccessUserName", true, 0, 100, string.Empty, 4, ref total));
21 var storeItem = Services.Items.GetItem(selectedStore.ItemType, selectedStore.ItemId);
22
23 var storesData = new
24 {
25 baseUrl = "/service/storeinfo?storeid=",
26 className = "Control--light",
27 name = "selectedStore",
28 updateRegion = "#js-id-controlUpdateRegion",
29 redirect = "false",
30 items = from user in customerCenters
31 select new
32 {
33 value = user.ID,
34 text = user.Name,
35 selected = user.ID == selectedStoreId
36 }
37 };
38
39 var inputNameData = new Input
40 {
41 type = "text",
42 label = "Ditt Namn",
43 uid = "sharelist-name",
44 name = "sharelist-name",
45 isFullWidth = true,
46 attrs = new List<Attribute>
47 {
48 new Attribute { prop = "required"}
49 }
50 };
51
52 var nameInputHtml = hbh.render("form-input/index.hbs", inputNameData);
53
54 var inputCompanyData = new Input
55 {
56 type = "text",
57 label = "Företagsnamn",
58 uid = "sharelist-company",
59 name = "sharelist-company",
60 isFullWidth = true,
61 attrs = new List<Attribute>
62 {
63 new Attribute { prop = "required"}
64 }
65 };
66
67 var companyInputHtml = hbh.render("form-input/index.hbs", inputCompanyData);
68
69 var inputEmailData = new Input
70 {
71 type = "email",
72 label = "Din e-post",
73 uid = "sharelist-email",
74 name = "sharelist-email",
75 isFullWidth = true,
76 attrs = new List<Attribute>
77 {
78 new Attribute { prop = "required"}
79 }
80 };
81
82 var emailInputHtml = hbh.render("form-input/index.hbs", inputEmailData);
83
84 var inputPhoneData = new Input
85 {
86 type = "tel",
87 label = "Mobilnummer",
88 uid = "sharelist-phone",
89 name = "sharelist-phone",
90 isFullWidth = true,
91 attrs = new List<Attribute>
92 {
93 new Attribute { prop = "required"}
94 }
95 };
96
97 var phoneInputHtml = hbh.render("form-input/index.hbs", inputPhoneData);
98
99 var orgNrInputHtml = hbh.render("form-input/index.hbs", new Input("Organisationsnummer", "order-orgnr", "", false));
100 var projectNrInputHtml = hbh.render("form-input/index.hbs", new Input("Kundnummer (projektnummer)", "order-projectnr", AccountManager.getActiveProjectCode(), false));
101
102 var invoiceAdressInputHtml = hbh.render("form-input/index.hbs", new Input("Adress", "invoice-adress", "", false));
103 var invoiceZipInputHtml = hbh.render("form-input/index.hbs", new Input("Postnr", "invoice-zip", "", false));
104 var invoiceCityInputHtml = hbh.render("form-input/index.hbs", new Input("Ort", "invoice-city", "", false));
105
106 var deliveryAdressInputHtml = hbh.render("form-input/index.hbs", new Input("Adress", "invoice-adress", "", false));
107 var deliveryZipInputHtml = hbh.render("form-input/index.hbs", new Input("Postnr", "invoice-zip", "", false));
108 var deliveryCityInputHtml = hbh.render("form-input/index.hbs", new Input("Ort", "invoice-city", "", false));
109
110 var referenceInputHtml = hbh.render("form-input/index.hbs", new Input("Referens", "order-reference", "", false));
111 var deliveryDateInputHtml = hbh.render("form-input/index.hbs", new Input("Önskad leveransdatum, -tid", "order-delivery-date", "", false));
112 var invoiceTagInputHtml = hbh.render("form-input/index.hbs", new Input("Fakturamärkning", "order-invoice-tag", "", false));
113
114 /*Message*/
115 var templates = new List<object>();
116 inputAttrs.Add(
117 new
118 {
119 prop = "required"
120 }
121 );
122
123 var inputMessageData = new
124 {
125 type = "text",
126 label = "Meddelande",
127 uid = "sharelist-message",
128 name = "sharelist-message",
129 isTextarea = true,
130 isFullWidth = true,
131 attrs = inputAttrs,
132 template = templates
133 };
134 var partialPathList = new List<string> { "form-input/textarea.hbs" };
135 var messageInputHtml = hbh.render("form-input/index.hbs", partialPathList, inputMessageData);
136 }
137 <!--<form action="/customerservice_confirm" method="post">-->
138 <form action="/default.aspx?id=32" method="post">
139 <div class="Grid Grid--equalPush">
140 <div class="Grid-cell">
141 <div class="Grid Grid--withGutter">
142 <div class="Grid-cell u-sizeFull">
143 <h2 class="Type-h1">Skicka orderförfrågan</h2>
144 </div>
145 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2">
146 <p>Fyll i dina kontaktuppgifter så återkommer vi till dig nästa vardag med prisuppgifter och leveranstider.</p>
147 </div>
148 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2">
149 @hbh.render("control/index.hbs", storesData)
150 </div>
151 </div>
152 </div>
153 <div class="Grid-cell">
154 <div class="Grid Grid--withGutter" id="js-id-controlUpdateRegion">
155 <div class="Grid-cell u-sizeFull u-md-size1of3 u-lg-size1of3">
156 <h4>Besöksadress</h4>
157 <p class="Type-paragraph">@selectedStore.Address</p>
158 </div>
159 <div class="Grid-cell u-sizeFull u-md-size1of3 u-lg-size1of3">
160 <h4>Öppettider</h4>
161 <p class="Type-paragraph">@storeItem["Opening_Hours"]</p>
162 </div>
163 <div class="Grid-cell u-sizeFull u-md-size1of3 u-lg-size1of3">
164 <h4>Telefon</h4>
165 <p class="Type-paragraph">@selectedStore.Phone</p>
166 </div>
167 </div>
168 </div>
169 <div class="Grid-cell">
170 <div class="Grid Grid--withGutter">
171 <div class="Grid-cell u-sizeFull">
172 <div class="Type">
173 <h3 class="Type-h3">Kontaktuppgifter</h3>
174 </div>
175 </div>
176 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2">
177 @nameInputHtml
178 </div>
179 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2">
180 @companyInputHtml
181 </div>
182 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2">
183 @emailInputHtml
184 </div>
185 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2">
186 @phoneInputHtml
187 </div>
188 </div>
189 </div>
190 <div class="Grid-cell">
191 <div class="Grid Grid--withGutter">
192 <div class="Grid-cell u-sizeFull">
193 <div class="Type">
194 <h3 class="Type-h3">Fakturaadress</h3>
195 </div>
196 </div>
197 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2">
198 @invoiceAdressInputHtml
199 </div>
200 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2">
201 @invoiceZipInputHtml
202 </div>
203 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2">
204 @invoiceCityInputHtml
205 </div>
206 </div>
207 </div>
208 <div class="Grid-cell">
209 <div class="Grid Grid--withGutter">
210 <div class="Grid-cell u-sizeFull">
211 <div class="Type">
212 <h3 class="Type-h3">Leveransadress</h3>
213 </div>
214 </div>
215 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2">
216 @deliveryAdressInputHtml
217 </div>
218 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2">
219 @deliveryZipInputHtml
220 </div>
221 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2">
222 @deliveryCityInputHtml
223 </div>
224 </div>
225 </div>
226 <div class="Grid-cell">
227 <div class="Grid Grid--withGutter">
228 <div class="Grid-cell u-sizeFull">
229 <div class="Type">
230 <h3 class="Type-h3">Övrigt</h3>
231 </div>
232 </div>
233 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2">
234 @referenceInputHtml
235 </div>
236 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2">
237 @deliveryDateInputHtml
238 </div>
239 <div class="Grid-cell u-sizeFull u-md-size1of2 u-lg-size1of2">
240 @invoiceTagInputHtml
241 </div>
242 <div class="Grid-cell u-sizeFull">
243 @messageInputHtml
244 </div>
245 </div>
246 </div>
247 <div class="Grid-cell">
248 <div class="Grid Grid--withGutter">
249 <div class="Grid-cell u-sizeFull u-textRight">
250 <button class="Button" type="submit">Skicka förfrågan</button>
251 </div>
252 </div>
253 </div>
254 </div>
255 </form>