Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        public TimedSynchronizerService(
            ISyncJobExecutionQueue jobExecutionQueue,
            ISyncJob syncJob,
            ILogger <TimedSynchronizerService> logger)
        {
            _jobExecutionQueue = jobExecutionQueue;
            _syncJob           = syncJob;

            _logger = logger;
        }
Ejemplo n.º 3
0
        public PusherService(
            ISmintIoSettingsDatabaseProvider smintIoSettingsDatabaseProvider,
            ISmintIoTokenDatabaseProvider smintIoTokenDatabaseProvider,
            ISyncJobExecutionQueue jobExecutionQueue,
            ISyncJob syncJob,
            ILogger <PusherService> logger)
        {
            _smintIoSettingsDatabaseProvider = smintIoSettingsDatabaseProvider;
            _smintIoTokenDatabaseProvider    = smintIoTokenDatabaseProvider;

            _jobExecutionQueue = jobExecutionQueue;
            _syncJob           = syncJob;

            _logger = logger;
        }
Ejemplo n.º 4
0
        /// <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");
                }
            }
        }
Ejemplo n.º 5
0
        // Private Methods (3) 

        private void AddListItemForJob(ISyncJob job)
        {
            this.SyncJobList_Main
            .Jobs
            .Add(job);
        }
Ejemplo n.º 6
0
        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();
        }