Esempio n. 1
0
        public Job CreateJob(Guid typeId, dynamic attributes, JobPriority priority = 0, Guid?creatorId = null, Guid?schedulePlanId = null, Guid?jobId = null)
        {
            JobType type = JobTypes.FirstOrDefault(t => t.Id == typeId);

            if (type == null)
            {
                Log log = new Log();
                log.Create(LogType.Error, "JobManager.CreateJob", "Create job failed!", $"Type with id '{typeId}' can not be found.", saveDetailsAsJson: true);
                return(null);
            }

            if (!Enum.IsDefined(typeof(JobPriority), priority))
            {
                priority = type.DefaultPriority;
            }

            Job job = new Job();

            job.Id                = jobId.HasValue ? jobId.Value : Guid.NewGuid();
            job.TypeId            = type.Id;
            job.Type              = type;
            job.TypeName          = type.Name;
            job.Assembly          = type.Assembly;
            job.CompleteClassName = type.CompleteClassName;
            job.MethodName        = type.MethodName;
            job.Status            = JobStatus.Pending;
            job.Priority          = priority;
            job.Attributes        = attributes;
            job.CreatedBy         = creatorId;
            job.LastModifiedBy    = creatorId;
            job.SchedulePlanId    = schedulePlanId;

            return(JobService.CreateJob(job));
        }
Esempio n. 2
0
 public EmployerJobViewModel()
 {
     JobTypes  = Mapper.Map <ObservableCollection <JobTypeViewModel> >(JobTypesService.GetAll());
     JobType   = JobTypes.FirstOrDefault();
     Employees = new List <JobUserViewModel>();
     IsLookingForNewEmployees = true;
     StartDate = DateTime.Now;
 }