0

I am beginner in the Nop Commerce Project 2.30. I try to send mails to my Nop Commerce

Clients ( in the database ) in a specific intervel ( every 12 Hours ).

I create new method ( for create List of client list ) in the interface

Nop.Services.Customers.ICustomerService and implement this function, class is

Nop.Services.Customers.CustomerService. But a problem i can't create this method

as static method. Please see image

enter image description here

Because CustomerService class is not contains the default

constructor. This is the only one constructor in the CustomerService Class.

Please see below.

 public CustomerService(ICacheManager cacheManager,
            IRepository<Customer> customerRepository,
            IRepository<CustomerRole> customerRoleRepository,
            IRepository<CustomerAttribute> customerAttributeRepository,
            IEncryptionService encryptionService, 
            INewsLetterSubscriptionService newsLetterSubscriptionService,
            RewardPointsSettings rewardPointsSettings, 
            CustomerSettings customerSettings,
            IEventPublisher eventPublisher)
        {
            _cacheManager = cacheManager;
            _customerRepository = customerRepository;
            _customerRoleRepository = customerRoleRepository;
            _customerAttributeRepository = customerAttributeRepository;
            _encryptionService = encryptionService;
            _newsLetterSubscriptionService = newsLetterSubscriptionService;
            _rewardPointsSettings = rewardPointsSettings;
            _customerSettings = customerSettings;
            _eventPublisher = eventPublisher;
        }

I am clueless how to call this parameterized constructor in a external program. So i try

to make my function is static. Any Idea to create a static method in nop. Please help

Ian
  • 33,605
  • 26
  • 118
  • 198
Ragesh P Raju
  • 3,879
  • 14
  • 101
  • 136

1 Answers1

1

I use a WebClient function for this task. I create a Action in my MVC application for sending email. Call this action by webclient from my console application in specific intervel.

Please see this link for more.

http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/d60415d9-f1e7-4981-b600-be056f2f7bcd

http://forums.asp.net/t/1858253.aspx/1?Call+a+MVC3+Controller+Action+in+a+Console+Application+

Ragesh P Raju
  • 3,879
  • 14
  • 101
  • 136