在控制台应用程序项目中向Nop Commerce客户发送邮件

时间:2012-11-08 10:01:09

标签: c# oop e-commerce nopcommerce

我是Nop Commerce Project 2.30的初学者。我尝试将邮件发送到我的Nop Commerce

特定层间(每12小时)的客户端(在数据库中)。

我在界面

中创建了新方法(用于创建客户列表列表)

Nop.Services.Customers.ICustomerService 并实现此功能,类是

Nop.Services.Customers.CustomerService 即可。但是我无法创建这种方法的问题

作为静态方法。请看图片

enter image description here

因为 CustomerService 类不包含默认值

构造。这是CustomerService类中唯一的一个构造函数。

请参阅下文。

 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;
        }

我无法在外部程序中调用此参数化构造函数。所以我试试

使我的功能是静态的。任何想法在nop中创建静态方法。请帮忙

1 个答案:

答案 0 :(得分:1)

我使用WebClient函数执行此任务。我在我的MVC应用程序中创建一个Action用于发送 电子邮件。通过webclient在我的控制台应用程序中以特定的间隔调用此操作。

请参阅此链接了解更多信息。

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+