Beispiel #1
0
 public static MVCApp.Models.Job Map(DataLib.Models.Job modelJob)
 {
     return(new MVCApp.Models.Job()
     {
         JobId = modelJob.JobId,
         Name = modelJob.Name,
         DoAfter = modelJob.DoAfter,
         Status = modelJob.Status
     });
 }
Beispiel #2
0
        public static void ChangeStatus(this DataLib.Models.Job job, JobStatus newStatus)
        {
            if (newStatus == JobStatus.Failed)
            {
                job.FailedCounter++;
                //SingleJobsFailedCounter.Instance.FailedJobs.Add(job);
            }

            job.Status = job.FailedCounter < 5 ? newStatus : JobStatus.Closed;
        }
Beispiel #3
0
        private bool ProcessJob(DataLib.Models.Job job)
        {
            Random rand = new Random();

            if (rand.Next(10) < 5)
            {
                Thread.Sleep(2000);
                return(false);
            }
            else
            {
                Thread.Sleep(1000);
                return(true);
            }
        }
Beispiel #4
0
 private void UpdateJobStatus(IJobsRepository jobsRepository, JobStatus status, DataLib.Models.Job job)
 {
     job.ChangeStatus(JobStatus.Done);
     jobsRepository.Update(job);
 }