BioLegend - Latest Orders

Error executing template "Designs/BioLegend/DataManagement/Publishings/Custom/latestOrders.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_52569c22a1dc42568951cfb9b63ebe6f.Execute() in f:\Domains\Sites\sandbox.biolegend.com\Files\Templates\Designs\BioLegend\DataManagement\Publishings\Custom\latestOrders.cshtml:line 8
   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 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 2 @using Dynamicweb.Rendering; 3 @using Dynamicweb.Modules.UserManagement; 4 5 @{ 6 string str_path = "/Default.aspx?ID=" + GetGlobalValue("Global:Page.ID"); 7 // todo remove the following code after DK correct the issue 8 if(System.Web.HttpContext.Current.Session["DW_extranet_AccessSecondaryUserID"] == null && Pageview.User.CurrentSecondaryUser != null) 9 { 10 System.Web.HttpContext.Current.Session["DW_extranet_AccessSecondaryUserID"] = Int32.Parse(Pageview.User.CurrentSecondaryUser.ID.ToString()); 11 BioLegend.Shared.WebUtility.Redirect(str_path); 12 } 13 var itemArea = Pageview.Area.Item; 14 var obj_orders = GetLoop("Rows"); 15 int totalPagesNum = GetLoop("DwPaging.LoopAllPages").Count; 16 string paragraphId = itemArea["LatestOrders"].ToString(); 17 18 string paramReOrder = System.Web.HttpContext.Current.Request.Params["reordered"] ?? ""; 19 string orderCartAdded = Translate("orderCartAdded","The order has been added to your cart."); 20 21 string orderContext = itemArea["OrderContext"] != null ? itemArea["OrderContext"].ToString() : ""; 22 23 bool bol_userLogged = Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn(); 24 string siteCurrency = Dynamicweb.Frontend.PageView.Current().Area.EcomCurrencyId; 25 string userCurrency = bol_userLogged ? Dynamicweb.Security.UserManagement.User.GetCurrentUser().Currency : siteCurrency; 26 } 27 @if(System.Web.HttpContext.Current.Request.Params["OrderID"] == null) { 28 <table id="myOrdersTable" name="UserManagementEditForm" class="col-xs-12 noPadding text-left evenTable"> 29 <thead> 30 <tr> 31 <th> 32 @Translate("Date") 33 <a href="@(str_path)&ViewPID=@(paragraphId)&sortby=OrderCompletedDate&sortorder=ASC"> 34 <i class="fa fa-caret-up"></i> 35 </a> 36 <a href="@(str_path)&ViewPID=@(paragraphId)&sortby=OrderCompletedDate&sortorder=DESC"> 37 <i class="fa fa-caret-down"></i> 38 </a> 39 </th> 40 <th> 41 @Translate("orderID","Order ID") 42 <a href="@(str_path)&ViewPID=@(paragraphId)&sortby=OrderID&sortorder=ASC"> 43 <i class="fa fa-caret-up"></i> 44 </a> 45 <a href="@(str_path)&ViewPID=@(paragraphId)&sortby=OrderID&sortorder=DESC"> 46 <i class="fa fa-caret-down"></i> 47 </a> 48 </th> 49 <th> 50 @Translate("price","Price") 51 <a href="@(str_path)&ViewPID=@(paragraphId)&sortby=OrderPriceWithVAT&sortorder=ASC"> 52 <i class="fa fa-caret-up"></i> 53 </a> 54 <a href="@(str_path)&ViewPID=@(paragraphId)&sortby=OrderPriceWithVAT&sortorder=DESC"> 55 <i class="fa fa-caret-down"></i> 56 </a> 57 </th> 58 <th class="hidden"> 59 @Translate("status","Status") 60 <a href="@(str_path)&ViewPID=@(paragraphId)&sortby=OrderStateName&sortorder=ASC"> 61 <i class="fa fa-caret-up"></i> 62 </a> 63 <a href="@(str_path)&ViewPID=@(paragraphId)&sortby=OrderStateName&sortorder=DESC"> 64 <i class="fa fa-caret-down"></i> 65 </a> 66 </th> 67 <th> 68 @Translate("trackNumber", "Tracking Number") 69 </th> 70 <th> 71 @Translate("actions","Actions") 72 </th> 73 </tr> 74 </thead> 75 <tbody> 76 @if(obj_orders.Any()){ 77 foreach(LoopItem order in obj_orders){ 78 string pageId = GetGlobalValue("Global:Page.ID"); 79 string detail = "/Default.aspx?ID="+ pageId + "&CC"+paragraphId+"=Order&OrderID="+order.GetString("OrderID"); 80 string reorder = "/Default.aspx?ID="+ pageId + "&CC"+paragraphId+"=Orders&ReorderID="+order.GetString("OrderID")+"&reordered=true"+"&OrderContext="+orderContext; 81 82 <tr> 83 <td>@order.GetDate("OrderCompletedDate").ToString("MM/dd/yyyy")</td> 84 <td><a href="@detail">@order.GetString("OrderID")</a></td> 85 <td>@Dynamicweb.Ecommerce.Common.Context.Currency.Format(order.GetDouble("OrderPriceWithVAT"), true)</td> 86 <td class="hidden">@order.GetString("OrderStateName")</td> 87 <td>@order.GetString("OrderTrackTraceNumber")</td> 88 <td> 89 @if(userCurrency != siteCurrency){ 90 <a class="grayAA" data-toggle="tooltip" title="@(Translate("CurrencyMissmatch","Your currency does not match the websites currency. Please navigate to the proper page."))" href="javascript:void(0)">@Translate("reorder", "Reorder")</a> 91 } 92 else { 93 <a href="@reorder">@Translate("reorder", "Reorder")</a> 94 } 95 / <a href="@(detail)&print=true">@Translate("print", "Print")</a> 96 </td> 97 </tr> 98 } 99 } 100 else 101 { 102 <tr> 103 <td colspan="6">@Translate("No orders found")</td> 104 </tr> 105 } 106 </tbody> 107 </table> 108 109 if (totalPagesNum > 1) 110 { 111 string pageParameter = "PID=" + paragraphId, 112 urlBack = GetString("DwPaging.PreviousPageLink"), 113 urlNext = GetString("DwPaging.NextPageLink"), 114 pageText =""; 115 116 <div class="Paging text-center"> 117 @if (urlBack != "") 118 { 119 pageText = Translate("Prev Page"); 120 @PageItem("",urlBack, pageText) 121 } 122 &nbsp; 123 &nbsp; 124 &nbsp; 125 &nbsp; 126 @if (urlNext != "") 127 { 128 pageText = Translate("Next Page"); 129 130 @PageItem("", urlNext, pageText) 131 } 132 </div> 133 } 134 135 if(!string.IsNullOrWhiteSpace(paramReOrder)) 136 { 137 @SnippetStart("jsOnLoad") 138 @: alert("@orderCartAdded") 139 @SnippetEnd("jsOnLoad") 140 } 141 } 142 143 144 @helper PageItem (string cssClass, string href, string text) { 145 <a class="btn btn-default" href="@href">@text</a> 146 } 147 148
ProductsHere
Insert Note Here
Save Close Clear
Lab Timer
Tools
Login / Register
Remember me
Forgot your password? Reset password?
Create an Account