project
Rental
Inga produkter valda
Error executing template "/Designs/SkanskaMaskin/Paragraph/_service_account.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at Softgear.SkanskaMaskin.Data.Business.ProjectManager.GetProjects(User u)
   at Softgear.SkanskaMaskin.Data.Business.AccountManager.GetProjectForLoggedInUser(String number)
   at Softgear.SkanskaMaskin.Data.Business.AccountManager.setCurrentProject(String code)
   at CompiledRazorTemplates.Dynamic.RazorEngine_3812c9f4146b440d87b349dfe154d33d.Execute() in D:\wwwroot\rental.skanska.se\Files\Templates\Designs\SkanskaMaskin\Paragraph\_service_account.cshtml:line 11
   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.Web 2 @using Dynamicweb.Environment 3 @using Softgear.SkanskaMaskin.Data.Business 4 @{ 5 6 var newCode = Dynamicweb.Context.Current.Request.GetString("code"); 7 const string notFound = "not found"; 8 9 if (HttpContext.Current.Request.Headers["x-requested-with"] == null) 10 { 11 var newProject = AccountManager.setCurrentProject(newCode); 12 HttpContext.Current.Response.Redirect("/", true); 13 } 14 else 15 { 16 var newProject = AccountManager.GetProjectForLoggedInUser(newCode); 17 18 if (newProject != null) 19 { 20 @WebHelper.serializeToJson(AccountManager.getProjectByNumber(newCode)); 21 22 /* 23 Dynamicweb.Ecommerce.Common.Context.CartContext = OrderContext.GetOrderContextById(newCode); 24 if (Dynamicweb.Ecommerce.Common.Context.CartContext == null) 25 { 26 var cart = Dynamicweb.Ecommerce.Common.Context.Cart; 27 28 if (cart == null) 29 { 30 cart = new Order() { IsCart = true, LanguageID = "LANG1", ShopID = "SHOP1", OrderContextID = newCode }; 31 cart.Save(); 32 Dynamicweb.Ecommerce.Common.Context.SetCart(cart); 33 } 34 } 35 */ 36 37 } 38 else 39 { 40 41 HttpContext.Current.Response.StatusCode = 418; 42 @notFound 43 } 44 } 45 } 46 47 48