private string ValidateAndGetJobId(string validatorId, string validatorInstanceId)
        {
            Guard.NotNullOrEmpty(validatorId, "validatorId", log);
            Guard.NotNullOrEmpty(validatorInstanceId, "validatorInstanceId", log);

            return(JobIdUtils.GetJobId(validatorId, validatorInstanceId));
        }
        public bool IsValidationScheduled(string validatorId, string validatorInstanceId)
        {
            log.Info("HangFireScheduler IsValidationScheduled starting for validationId {ValidationId} and validatorInstanceId {ValidatorInstanceId}", validatorId, validatorInstanceId);

            IEnumerable <IScheduledValidation> recurringJobs = this.GetRecurringJobs();
            var  jobId        = JobIdUtils.GetJobId(validatorId, validatorInstanceId);
            var  recurringJob = recurringJobs.Where(job => job.JobId == jobId).SingleOrDefault();
            bool scheduled    = recurringJob != null;

            log.Debug("HangFireScheduler IsValidationScheduled for JobId {JobId}: {IsScheduled}", jobId, scheduled);

            return(scheduled);
        }
        private IScheduledValidation AddOrEditValidationSchedule(IScheduleRequest scheduleRequest)
        {
            string jobId = JobIdUtils.GetJobId(scheduleRequest.ValidatorId, scheduleRequest.ValidatorInstanceId);

            var cronTabExpression = scheduleRequest.CronTabExpression;

            this._sheduleCallbacker.ScheduleValidator(jobId, cronTabExpression);

            var scheduledValidation = new ScheduledValidation(jobId, cronTabExpression, DateTime.Now)
            {
            };

            return(scheduledValidation as IScheduledValidation);
        }
        public void ScheduleCallBack(string jobId)
        {
            Guard.NotNull(jobId, "jobId", log);

            ValidatorInstanceInfo validatorInfo = JobIdUtils.GetInstanceInfo(jobId);
            var validatorInfoArgs = new ValidatorInfoArgs(validatorInfo);

            if (RunValidatorEvent != null)
            {
                log.Debug("HangFireScheduleCallback ScheduleCallBack: schedule call back for job id {JobId}", jobId);
                RunValidatorEvent(this, validatorInfoArgs);
            }

#if DEBUG
            HangFireScheduler.JobsScheduledCalledBack++;
#endif
        }