CustomerManager.GetCustomerByEmail

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 năm cách đây
Hi folks,

on version 1.80 I used CustomerManager.GetCustomerByEmail, to get the Customer, but now on version 1.90 it does not exist anymore. Searching the library I found out now there is CustomerService, so to get the Customer I tried this:

NopConfig.ConnectionString = ConfigurationManager.ConnectionStrings["NopSqlConnection"].ConnectionString;
CustomerService CustomerManager = new CustomerService(new NopObjectContext(NopConfig.ConnectionString));
Customer customer = CustomerManager.GetCustomerByEmail(strEmail);

but I get the following error:

Object reference not set to an instance of an object

could you tell me, what I'm doing wrong and what has been changed from previuos version?

Many thanks,

Luca
13 năm cách đây
Use the follow code
IoC.Resolve<ICustomerService>().GetCustomerByEmail
13 năm cách đây
a.m. wrote:
Use the follow code
IoC.Resolve<ICustomerService>().GetCustomerByEmail

thanks for the reply, I've tried this:

Customer customer = IoC.Resolve<ICustomerService>().GetCustomerByEmail;

but I get this compilation error:

Error  2044  Cannot convert method group 'GetCustomerByEmail' to non-delegate type 'NopSolutions.NopCommerce.BusinessLogic.CustomerManagement.Customer'. Did you intend to invoke the method?
13 năm cách đây
sysdatanet wrote:
Use the follow code
IoC.Resolve<ICustomerService>().GetCustomerByEmail

thanks for the reply, I've tried this:

Customer customer = IoC.Resolve<ICustomerService>().GetCustomerByEmail;

but I get this compilation error:

Error  2044  Cannot convert method group 'GetCustomerByEmail' to non-delegate type 'NopSolutions.NopCommerce.BusinessLogic.CustomerManagement.Customer'. Did you intend to invoke the method?

sorry, ignore my previous email, I was miles aways, I did not input the email parameter, that's why it did not work. Now it compiles, many thanks.
13 năm cách đây
sysdatanet wrote:
Use the follow code
IoC.Resolve<ICustomerService>().GetCustomerByEmail

thanks for the reply, I've tried this:

Customer customer = IoC.Resolve<ICustomerService>().GetCustomerByEmail;

but I get this compilation error:

Error  2044  Cannot convert method group 'GetCustomerByEmail' to non-delegate type 'NopSolutions.NopCommerce.BusinessLogic.CustomerManagement.Customer'. Did you intend to invoke the method?
sorry, ignore my previous email, I was miles aways, I did not input the email parameter, that's why it did not work. Now it compiles, many thanks.


ok, I've tried this:

Customer customer = IoC.Resolve<ICustomerService>().GetCustomerByEmail(strEmail);

but I still get this error:

Object reference not set to an instance of an object.

Since I'm calling this, from an external page, I thought it could be something related to the ConnectionString , so first I did this:

NopConfig.Init();

and the connection string is ok.
13 năm cách đây
Seems that you made some modifications to your source code. Try to debug the application and see what exactly object is null ("Object reference not set to an instance of an object.")
13 năm cách đây
a.m. wrote:
Seems that you made some modifications to your source code. Try to debug the application and see what exactly object is null ("Object reference not set to an instance of an object.")

ok, thanks, i'll do so.
13 năm cách đây
Hi sysdatanet
any update on your problem,
I am trying to the do the same and I am getting same problem as yours
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.