Hi,
This is my Schedule code
namespace Nop.Plugin.Feed.MYImport.Services
{
/// <summary>
/// Represents a task for keeping the site alive
/// </summary>
public partial class MYUpdateScheduler : ITask
{
private readonly MYImportService _MYImportService;
public MYUpdateScheduler(MYImportService MYImportService)
{
this._MYImportService = MYImportService;
}
/// <summary>
/// Executes a task
/// </summary>
public void Execute()
{
MYImportRecord MYImportRecord = _MYImportService.GetConfig();
try
{
_MYImportService.doUpdateXMLImport(MYImportRecord.UpdateXMLURL);
}
catch (Exception)
{
}
finally
{
MYImportRecord = null;
}
}
}
public partial class MYImportScheduler : ITask
{
private readonly MYImportService _MYImportService;
public MYImportScheduler(MYImportService MYImportService)
{
this._MYImportService = MYImportService;
}
/// <summary>
/// Executes a task
/// </summary>
public void Execute()
{
MYImportRecord MYImportRecord = _MYImportService.GetConfig();
try
{
_MYImportService.doUpdateXMLImport(MYImportRecord.ImportXMLURL);
}
catch (Exception)
{
}
finally
{
MYImportRecord = null;
}
}
}
}
The constructor of the class that is called looks like. This works absolutely fine when called from the config form.
public MYImportService(IRepository<MYImportRecord> MYRepository,
ICacheManager cachManager, IProductService produtSevice,
ICategoryService categoryService, IManufacturerService manfService,
IUrlRecordService urlRecordService, IPictureService pictureService,
IDiscountService discountService, IRepository<MYCategory> MYCategoryRepository)
{
this._MYRepository = MYRepository;
this._cacheManager = cachManager;
this._productService = produtSevice;
this._categoryService = categoryService;
this._manfService = manfService;
this._urlRecordService = urlRecordService;
this._pictureService = pictureService;
this._discountService = discountService;
this._MYCategoryRepository = MYCategoryRepository;
}
Hope that will help a little.
Thanks for the response.
Paul