an ASP.NET Open Source CMS & eCommerce platform
Search:
Skip Navigation LinksHome > DotShoppingCart Forums > Support > Using DotShoppingCart > custom admin role order management getting an e...
Last Post 7/9/2009 1:27:48 PM By bansal_db. 6 replies.
6/10/2009 3:17:03 PM
bansal_db
Posts: 181
Joined: 4/13/2009
custom admin role order management getting an error
Hey Luke,
 
I created a role orderManagement and added to the admin webconfig and sitemap.
 
The user assigned to that role can see the Orders.aspx page but when he clicks on the order number, he gets this error
 

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 40:         if (!IsPostBack) {
Line 41:             btnCancelOrder.OnClientClick = string.Format("return confirm(\"{0}\");", HttpContext.GetGlobalResourceObject("Common", "CancelOrderConfirm"));
Line 42:             lblOrderNumber.Text = Order.OrderNumber; Line 43:             lblOrderDate.Text = Order.Created.ToShortDateString();
Line 44:             lnkUser.Text = string.Format("{0} {1}", Order.BillingAddress.FirstName, Order.BillingAddress.LastName);
 
Source File: c:\DSC\Web\Admin\Order\OrderEdit.aspx.cs    Line: 42 
 
Any Ideas?
 
Thanks
 
-D
6/11/2009 10:13:03 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: custom admin role order management getting an error
Do you have the same issue when you log in as admin?
DotShoppingCart Staff
6/11/2009 10:16:54 AM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: custom admin role order management getting an error
No. Admin is fine.
 
First the web.sitemap looked like this
 
<siteMapNode url="/Admin/Order/Orders.aspx" title="$resources:Common,Orders" allowedRoles="Administrator,OrderManagement"  helplink="Online%20Help/Order%20Processing/Reviewing%20and%20Authorizing%20Orders.aspx">
                    <siteMapNode url="/Admin/Order/OrderEdit.aspx" title="$resources:Common,EditOrder" helplink="Online%20Help/Order%20Processing/Reviewing%20and%20Authorizing%20Orders/51.aspx"></siteMapNode>
                    <siteMapNode url="/Admin/Order/OrderItemEdit.aspx" title="$resources:Common,EditOrderItem" helplink="Online%20Help/Order%20Processing/Reviewing%20and%20Authorizing%20Orders/51.aspx"></siteMapNode>
 
 
I thought may be the user is not getting permissions to orderEdit so i added the allowedRoles part to OrderEdit and OrderItemEdit too. That didn't solve the problem.
6/12/2009 7:05:19 AM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: custom admin role order management getting an error
Anything Luke?
7/9/2009 12:02:00 PM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: custom admin role order management getting an error
Hey Luke,
 
We never figured this one out. It's still an issue.
 
Any ideas?
 
Thanks
7/9/2009 12:23:51 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: custom admin role order management getting an error
Ah, missed this one. In core\DBO\order.cs
 
Change
 
            DbCommand cmd = db.GetStoredProcCommand("DSC_Order_Get", orderId,
                Roles.IsUserInRole("Administrator") ? null : Utils.GetUserName());
 to
            DbCommand cmd = db.GetStoredProcCommand("DSC_Order_Get", orderId,
                Roles.IsUserInRole("Administrator") || Roles.IsUserInRole("Your New Role")  null : Utils.GetUserName());
 
 
 
DotShoppingCart Staff
7/9/2009 1:27:48 PM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: custom admin role order management getting an error
That worked. Thanks