public SyncSession AddJob(ISyncJob job) { if (string.IsNullOrWhiteSpace(job.Name)) throw new ApplicationException("Job name cannot be empty"); if (_jobs.Any(j => j.Name == job.Name)) throw new ApplicationException("Job names must be unique. Already have job: " + job.Name); _jobs.Add(job); return this; }
public TimedSynchronizerService( ISyncJobExecutionQueue jobExecutionQueue, ISyncJob syncJob, ILogger <TimedSynchronizerService> logger) { _jobExecutionQueue = jobExecutionQueue; _syncJob = syncJob; _logger = logger; }
public PusherService( ISmintIoSettingsDatabaseProvider smintIoSettingsDatabaseProvider, ISmintIoTokenDatabaseProvider smintIoTokenDatabaseProvider, ISyncJobExecutionQueue jobExecutionQueue, ISyncJob syncJob, ILogger <PusherService> logger) { _smintIoSettingsDatabaseProvider = smintIoSettingsDatabaseProvider; _smintIoTokenDatabaseProvider = smintIoTokenDatabaseProvider; _jobExecutionQueue = jobExecutionQueue; _syncJob = syncJob; _logger = logger; }
/// <summary> /// Assigns the new job id to the link control. /// </summary> /// <param name="form">The SyncConfirmation form.</param> /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param> public static void OnLoadStep(ISyncJobConfirmation form, EventArgs args) { IWebDialogService dialogService = form.Services.Get <IWebDialogService>(); if (dialogService.DialogParameters.ContainsKey("NewSyncJobName")) { var jobName = dialogService.DialogParameters["NewSyncJobName"]; if (jobName != null) { ISyncJob syncJob = EntityFactory.GetRepository <ISyncJob>().FindFirstByProperty("JobName", jobName.ToString()); if (syncJob != null) { form.lnkViewSyncJob.EntityId = syncJob.Id.ToString(); form.lnkViewSyncJob.Text = String.Format(form.GetResource("jobName.Caption").ToString(), jobName); } else { form.lnkViewSyncJob.Visible = false; form.lblMessage.Text = form.GetResource("DialogHeader.Caption").ToString(); } dialogService.DialogParameters.Remove("NewSyncJobName"); } } }
// Private Methods (3) private void AddListItemForJob(ISyncJob job) { this.SyncJobList_Main .Jobs .Add(job); }
private void StartJob(JobContext jobContext, ISyncJob job) { jobContext.JobContextChanged += (obj, arg) => SaveContextToDb(); if(jobContext.StartTime == null) jobContext.StartTime = DateTime.Now; Logger.Info(string.Format("Start job {0} at record {1}", job.Name, jobContext.CurrentRecord)); SaveContextToDb(); job.Start(jobContext); Logger.Trace("Job finished: " + job.Name); jobContext.FinishedTime = DateTime.Now; SaveContextToDb(); }