an ASP.NET Open Source CMS & eCommerce platform
Search:
Skip Navigation LinksHome > DotShoppingCart Forums > Support > Using DotShoppingCart > DSC.User Object has no methods
Last Post 5/10/2010 4:32:55 PM By lukezy. 11 replies.
Page 1 of 2 (12 posts) << First < Prev 1 2 Next > Last >> 
5/10/2010 11:09:12 AM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
DSC.User Object has no methods
Hi Luke,
 
When I define  this in my code :
    DotShoppingCart.Commercial.Core.User U = new DotShoppingCart.Commercial.Core.User();
 
I only see data fields and no methods, so where DSC.User.AddUser come from.
 
Thanks,
5/10/2010 11:19:31 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: DSC.User Object has no methods
It's static method.
DotShoppingCart Staff
5/10/2010 11:28:04 AM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: DSC.User Object has no methods
<font face="Courier New" color="#0000ff" size="2"><span style="font-size: 10pt; color: blue; font-family: 'Courier New'">This is the scope of DSC definition in my class library: </span>
 
 
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">DSC.<span style="color: #2b91af">User</span>.AddUser<span style="color: blue"> returns null reference. I just want to check with you the scope definition is correct. Since the only reason it can not create an instant of the object is definiotion.</span></span>
<font face="Courier New" color="#0000ff" size="2"> 
<font face="Courier New" color="#0000ff" size="2"> 
<font face="Courier New" color="#0000ff" size="2"> 
<font face="Courier New" color="#0000ff" size="2"><span style="font-size: 10pt; color: blue; font-family: 'Courier New'">using</span><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'"> DotShoppingCart.Commercial.Base;</span>
<font face="Courier New" color="#0000ff" size="2"><span style="font-size: 10pt; color: blue; font-family: 'Courier New'">using</span><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'"> DotShoppingCart.Commercial.Core;</span>
<font face="Courier New" color="#0000ff" size="2"><span style="font-size: 10pt; color: blue; font-family: 'Courier New'">using</span><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'"> DSC = DotShoppingCart.Commercial.Core;</span>
<font face="Courier New" size="2"> 
<font face="Courier New" color="#0000ff" size="2"><span style="font-size: 10pt; color: blue; font-family: 'Courier New'">namespace</span><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'"> UserEntity</span>
<font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial">{</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">  <span style="color: blue">public</span> <span style="color: blue">class</span> <span style="color: #2b91af">WebUser</span></span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">    {</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">         <span style="color: blue">#region</span> User Private Fields</span>
<font face="Courier New" color="#0000ff" size="2"><span style="font-size: 10pt; color: blue; font-family: 'Courier New'">         #region</span><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'"> WebUser Constractor</span>
<font face="Courier New" color="#0000ff" size="2"><span style="font-size: 10pt; color: blue; font-family: 'Courier New'">         #region</span><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'"> WebUser Properties</span>
<font face="Courier New" color="#0000ff" size="2"><span style="font-size: 10pt; color: blue; font-family: 'Courier New'">         #region</span><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'"> WebUser CRUD Methods</span>
<font face="Courier New" size="2"> 
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">         <span style="color: blue">public</span> <span style="color: blue">int</span> CreateNewUser(<span style="color: #2b91af">WebUser</span> nU)</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">        {</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">            <span style="color: blue">try</span></span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">            {</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">               Validate User </span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">               If ValidUser then <span style="color: #2b91af">Error</span></span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">               Add <span style="color: #2b91af">MembershipUser</span></span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">               If null </span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                  then <span style="color: #2b91af">Error</span></span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">               <span style="color: blue">else</span></span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                {</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                    <span style="color: blue">try</span></span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                    {</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                    <span style="color: blue">int</span> userId = DSC.<span style="color: #2b91af">User</span>.AddUser(nU.UserName, <span style="color: blue">true</span> , <span style="color: #2b91af">CoreHelper</span>.GetReferralId(), nU.FirstName,</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                                       nU.LastName, nU.CompanyName, nU.Address, nU.Address2, nU.City, nU.State,</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                                       nU.Zipcode, nU.CountryId, nU.Phone, nU.PhoneExt, <span style="color: #2b91af">DateTime</span>.Now, <span style="color: blue">true</span>);</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                    }</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                    <span style="color: blue">catch</span> (<span style="color: #2b91af">Exception</span> e)</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                    {</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                        <span style="color: #2b91af">Error</span></span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                        <span style="color: blue">return</span> (0);</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                    }</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                    Add User role   </span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                    <span style="color: blue">return</span> (1);</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                }</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">            }</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">            <span style="color: blue">catch</span> (<span style="color: #2b91af">Exception</span> e)</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">            {</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                <span style="color: #2b91af">Error</span></span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">                <span style="color: blue">return</span> (0);</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">            }</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">        }</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">  }</span>
<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: 'Courier New'">}</span>
<font face="Arial" size="2"> 
5/10/2010 11:30:54 AM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: DSC.User Object has no methods

 

This is the scope of DSC definition in my class library, as in the thread :
 
 
DSC.User.AddUser returns null reference. I just want to check with you the scope definition is correct. Since the only reason it can not create an instant of the object is definiotion.
 
 
 
using DotShoppingCart.Commercial.Base;
using DotShoppingCart.Commercial.Core;
using DSC = DotShoppingCart.Commercial.Core;
 
namespace UserEntity
{
  public class WebUser
    {
         #region User Private Fields
         #region WebUser Constractor
         #region WebUser Properties
         #region WebUser CRUD Methods
 
         public int CreateNewUser(WebUser nU)
        {
            try
            {
               Validate User
               If ValidUser then Error
               Add MembershipUser
               If null
                  then Error
               else
                {
                    try
                    {
                    int userId = DSC.User.AddUser(nU.UserName, true , CoreHelper.GetReferralId(), nU.FirstName,
                                       nU.LastName, nU.CompanyName, nU.Address, nU.Address2, nU.City, nU.State,
                                       nU.Zipcode, nU.CountryId, nU.Phone, nU.PhoneExt, DateTime.Now, true);
                    }
                    catch (Exception e)
                    {
                        Error
                        return (0);
                    }
                    Add User role  
                    return (1);
                }
            }
            catch (Exception e)
            {
                Error
                return (0);
            }
        }
  }
}
 
5/10/2010 12:55:38 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: DSC.User Object has no methods
If you look at the method signature, AddUser returns the userId that is added. I don't understand what you are trying to do.
DotShoppingCart Staff
5/10/2010 1:11:24 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: DSC.User Object has no methods
 I am trying to Add a user and this message returns :
 
<span class="Apple-style-span" style="font-family: Verdana, Arial, Helvetica, sans-serif; border-collapse: collapse; line-height: 18px; "> <h3 style="font: normal normal bold 110%/normal Verdana, Arial, Helvetica, sans-serif; color: rgb(91, 98, 108); margin-top: 10px; margin-bottom: 10px; ">An exception occurred in creating DSC user. <h3 style="font: normal normal bold 110%/normal Verdana, Arial, Helvetica, sans-serif; color: rgb(91, 98, 108); margin-top: 10px; margin-bottom: 10px; ">Object reference not set to an instance of an object. <h3 style="font: normal normal bold 110%/normal Verdana, Arial, Helvetica, sans-serif; color: rgb(91, 98, 108); margin-top: 10px; margin-bottom: 10px; ">System.Collections.ListDictionaryInternalDotShoppingCart.Commercial.Core </span>
5/10/2010 1:12:33 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: DSC.User Object has no methods
 This is the  error message when Adding User in my code :
 
An exception occurred in creating DSC user.

Object reference not set to an instance of an object.

System.Collections.ListDictionaryInternalDotShoppingCart.Commercial.Core
 
5/10/2010 1:21:11 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: DSC.User Object has no methods
As I said many times you need to check the exception to figure out what went wrong.
DotShoppingCart Staff
5/10/2010 1:45:05 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: DSC.User Object has no methods
 
The above is all data comes from exception handler, I got any data item of Object Exception :
 
 
catch (Exception e)
{
 "<h3>An exception occurred in creating DSC user." + "\n\r" + e.Message + "\n\r" + e.Data + "\n\r" + e.Source + "\n\r" + e.HelpLink +  "</h3>";
}
 
 
 
 
 
 
 
 
5/10/2010 1:55:00 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: DSC.User Object has no methods
Try getting e.StackTrace and InnerException StackTrace if possible.
DotShoppingCart Staff
5/10/2010 2:46:39 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: DSC.User Object has no methods
New message :
 
An exception occurred in creating DSC user. at DotShoppingCart.Commercial.Core.CoreHelper.GetReferralId() at UserHandler.WebUser.CreateNewUser(WebUser nU)
 
What is the default value for CoreHelper.GetReferralId ? I see in DSC it comes thru a Wizard. I do not have that Wizard here.
 
 
Page 1 of 2 (12 posts) << First < Prev 1 2 Next > Last >>