Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 2 of 2

Thread: Get ThisCustomer In Custom Class

  1. #1
    DotNetDevelopments is offline Senior Member
    Join Date
    Jul 2008
    Location
    Harlow / Essex / UK
    Posts
    619

    Question Get ThisCustomer In Custom Class

    I have created a custom class inside App_Code and it worked fine.
    However I needed to use localization which requires the customers current currency setting. However how can I get ThisCustomer inside my class without requiring it in the xslt call.

    Here is a snippet of the code
    C#/VB.NET Code:
    public virtual string PriceRange(string sProductID)
        {
    string pricef Localization.CurrencyStringForDisplayWithExchangeRate(priceThisCustomer.CurrencySetting);
    return 
    pricef;
        } 
    For argument sake lets say this code works fine. Now the problem is I want ThisCustomer in my class without having to change the xslt call to PriceRange(string sProductID, customer ThisCustomer)

    At the start of the class I have
    C#/VB.NET Code:
    public Customer ThisCustomer
        
    {
            
    get
            
    {
                return 
    m_ThisCustomer;
            }
            
    set
            
    {
                
    m_ThisCustomer value;
            }
        } 
    But it is not working.

    How can I get the current customer?
    Thanks in advance.

    Edit:
    The error is; Object reference not set to an instance of an object.
    Last edited by DotNetDevelopments; 04-07-2011 at 03:22 AM.
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience

  2. #2
    DotNetDevelopments is offline Senior Member
    Join Date
    Jul 2008
    Location
    Harlow / Essex / UK
    Posts
    619

    Default

    Fixed!

    change ThisCustomer to Customer.Current
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience