/// <summary> /// Ctor for Task /// </summary> /// <param name="task">Task </param> public Task(ScheduleTask task) { this._taskType = Type.GetType(task.Type); this._enabled = task.Enabled; this._stopOnError = task.StopOnError; this._name = task.Name; }
/// <summary> /// Updates the task /// </summary> /// <param name="task">Task</param> public virtual void UpdateTask(ScheduleTask task) { if (task == null) throw new ArgumentNullException("task"); _taskRepository.Update(task); }
/// <summary> /// Ctor for Task /// </summary> /// <param name="task">Task </param> public Task(ScheduleTask task) { this._type = task.Type; this._enabled = task.Enabled; this._stopOnError = task.StopOnError; this._name = task.Name; }
public void Can_save_and_load_scheduleTask() { var scheduleTask = new ScheduleTask { Name = "Task 1", Seconds = 1, Type = "some type 1", Enabled = true, StopOnError = true, LeasedByMachineName = "LeasedByMachineName 1", LeasedUntilUtc = new DateTime(2009, 01, 01), LastStartUtc = new DateTime(2010, 01, 01), LastEndUtc = new DateTime(2010, 01, 02), LastSuccessUtc= new DateTime(2010, 01, 03), }; var fromDb = SaveAndLoadEntity(scheduleTask); fromDb.ShouldNotBeNull(); fromDb.Name.ShouldEqual("Task 1"); fromDb.Seconds.ShouldEqual(1); fromDb.Type.ShouldEqual("some type 1"); fromDb.Enabled.ShouldEqual(true); fromDb.StopOnError.ShouldEqual(true); fromDb.LeasedByMachineName.ShouldEqual("LeasedByMachineName 1"); fromDb.LeasedUntilUtc.ShouldEqual(new DateTime(2009, 01, 01)); fromDb.LastStartUtc.ShouldEqual(new DateTime(2010, 01, 01)); fromDb.LastEndUtc.ShouldEqual(new DateTime(2010, 01, 02)); fromDb.LastSuccessUtc.ShouldEqual(new DateTime(2010, 01, 03)); }
protected virtual ScheduleTaskModel PrepareScheduleTaskModel(ScheduleTask task) { var model = new ScheduleTaskModel { Id = task.ID, Name = task.Name, Seconds = task.Seconds, Enabled = task.Enabled, StopOnError = task.StopOnError, LastStartUtc = task.LastStartUtc.HasValue ? _dateTimeHelper.ConvertToUserTime(task.LastStartUtc.Value, DateTimeKind.Utc).ToString("G") : "", LastEndUtc = task.LastEndUtc.HasValue ? _dateTimeHelper.ConvertToUserTime(task.LastEndUtc.Value, DateTimeKind.Utc).ToString("G") : "", LastSuccessUtc = task.LastSuccessUtc.HasValue ? _dateTimeHelper.ConvertToUserTime(task.LastSuccessUtc.Value, DateTimeKind.Utc).ToString("G") : "", }; return model; }
/// <summary> /// Installs the sync task. /// </summary> private void InstallSyncTask() { //Check the database for the task var task = FindScheduledTask(); if (task == null) { task = new ScheduleTask { Name = "MailChimp sync", //each 60 minutes Seconds = 3600, Type = "Nop.Plugin.Misc.MailChimp.MailChimpSynchronizationTask, Nop.Plugin.Misc.MailChimp", Enabled = false, StopOnError = false, }; _scheduleTaskService.InsertTask(task); } }
public void Can_save_and_load_scheduleTask() { var scheduleTask = new ScheduleTask { Name = "Task 1", Seconds = 1, Type = "some type 1", Enabled = true, StopOnError = true }; var fromDb = SaveAndLoadEntity(scheduleTask); fromDb.ShouldNotBeNull(); fromDb.Name.ShouldEqual("Task 1"); fromDb.Seconds.ShouldEqual(1); fromDb.Type.ShouldEqual("some type 1"); fromDb.Enabled.ShouldEqual(true); fromDb.StopOnError.ShouldEqual(true); }
internal TaskThread(ScheduleTask scheduleTask) { this._tasks = new Dictionary<string, Task>(); this._seconds = scheduleTask.Seconds; this._isRunning = false; }
/// <summary> /// Install plugin /// </summary> public override void Install() { //settings var settings = new FroogleSettings() { ProductPictureSize = 125, PassShippingInfo = false, FtpHostname = "ftp://uploads.google.com", StaticFileName = string.Format("froogle_{0}.xml", CommonHelper.GenerateRandomDigitCode(10)), }; _settingService.SaveSetting(settings); //data _objectContext.Install(); //locales this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.ClickHere", "Click here"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.Currency", "Currency"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.Currency.Hint", "Select the default currency that will be used to generate the feed."); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.DefaultGoogleCategory", "Default Google category"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.DefaultGoogleCategory.Hint", "The default Google category will be useds if other one is not specified."); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.FtpHostname", "FTP Hostname"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.FtpHostname.Hint", "Google FTP server hostname."); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.FtpFilename", "FTP File name"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.FtpFilename.Hint", "Feed file name."); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.FtpUsername", "FTP Username"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.FtpUsername.Hint", "Google FTP account username."); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.FtpPassword", "FTP Password"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.FtpPassword.Hint", "Google FTP account password."); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.FtpUploadStatus", "Froogle feed upload status: {0}"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.General", "General"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.Generate", "Generate feed"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.Override", "Override product settings"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.ProductPictureSize", "Product thumbnail image size"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.ProductPictureSize.Hint", "The default size (pixels) for product thumbnail images."); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.Products.ProductName", "Product"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.Products.GoogleCategory", "Google Category"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.SuccessResult", "Froogle feed has been successfully generated. {0} to see generated feed"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.Upload", "Upload feed to Google FTP server"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.TaskEnabled", "Automatically generate a file"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.TaskEnabled.Hint", "Check if you want a file to be automatically generated."); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.GenerateStaticFileEachMinutes", "A task period (minutes)"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.GenerateStaticFileEachMinutes.Hint", "Specify a task period in minutes (generation of a new Froogle file)."); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.TaskRestart", "If a task settings ('Automatically generate a file') have been changed, please restart the application"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.StaticFilePath", "Generated file path (static)"); this.AddOrUpdatePluginLocaleResource("Plugins.Feed.Froogle.StaticFilePath.Hint", "A file path of the generated Froogle file. It's static for your store and can be shared with the Froogle service."); //install a schedule task var task = FindScheduledTask(); if (task == null) { task = new ScheduleTask { Name = "Froogle static file generation", //each 60 minutes Seconds = 3600, Type = "Nop.Plugin.Feed.Froogle.StaticFileGenerationTask, Nop.Plugin.Feed.Froogle", Enabled = false, StopOnError = false, }; _scheduleTaskService.InsertTask(task); } base.Install(); }
private void InstallScheduleTask() { //Check the database for the task var task = FindScheduledTask(); if (task == null) { task = new ScheduleTask { Name = "Send SMS", //each 60 minutes Seconds = 60, Type = "Nop.Plugin.SMS.Twillio.QueuedSmsSendTask, Nop.Plugin.SMS.Twillio", Enabled = false, StopOnError = false, }; _scheduleTaskService.InsertTask(task); } }
/// <summary> /// Installs the sync task. /// </summary> private void InstallSyncTask() { //Check the database for the task var task = FindScheduledTask(); if (task == null) { task = new ScheduleTask { Name = "NopCommerceC5Connector sync", //each 60 minutes Seconds = 3600, Type = "Nop.Plugin.Other.NopCommerceC5Connector.NopCommerceC5ConnectorSynchronizationTask, Nop.Plugin.Other.NopCommerceC5Connector", Enabled = false, StopOnError = false, }; _scheduleTaskService.InsertTask(task); } }