public RestResult Post(string id) { if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException(nameof(id)); } var job = _repository.GetById(int.Parse(id)); if (job == null) { return(Rest(null)); } var jobInstance = job.InstanceId != Guid.Empty ? _repository.Get(job.InstanceId) : _repository.Create(job); _executor.StartAsync(jobInstance, new JobExecutionOptions { Trigger = ScheduledJobTrigger.User }); return(Rest(null)); }
public static void CreateJobIndexPointWithValuesFromMatrix(KeyValuePair <JobPosition, Dictionary <string, List <string> > > jobPositionWithValue, JobRepository jobRep, JobIndexRepository jobIndexRep, InquiryJobIndexPointRepository inquiryRep, JobPositionRepository jobPositionRepository) { var jobPosition = jobPositionRepository.GetBy(jobPositionWithValue.Key.Id); foreach (var itm in jobPosition.ConfigurationItemList) { var job = jobRep.GetById(itm.JobPosition.JobId); foreach (var jobIndexId in job.JobIndexList) { var jobIndex = (JobIndex)jobIndexRep.GetById(jobIndexId.JobIndexId); PMSMigrationUtility.CreateJobIndexIndexPointWithValue(inquiryRep, jobIndex, itm, jobPositionWithValue.Value[jobIndex.DictionaryName]); } } }
private void OnPreRender(object sender, EventArgs eventArgs) { var id = Convert.ToInt32(Request["pluginId"]); var job = _repo.GetById(id); jobName = job.Name; jobId = job.Id; var logs = _logRepo.GetAsync(job.InstanceId, 0, 10) .GetAwaiter() .GetResult() .PagedResult .OrderBy(i => i.CompletedUtc) .ToList(); times = logs.Select(l => $"\"{l.CompletedUtc:yyyy-MM-dd HH:mm:ss}\""); durations = logs.Select(l => l.Duration ?? TimeSpan.Zero); DataBind(); }
public void GetById_Should_Return_Correct_Job() { RunTest(() => { var jobOne = new Job { Id = Guid.NewGuid() }; var jobTwo = new Job { Id = Guid.NewGuid() }; using (var database = _context.LiteDatabase) { var collection = database.GetCollection <Job>(); collection.InsertBulk(new[] { jobOne, jobTwo }); } var job = _jobRepository.GetById(jobTwo.Id); job.Should().NotBeNull(); job.Id.Should().Be(jobTwo.Id); }); }
public JobWithRoles GetById(Guid id) { return(_jobRepository.GetById(id)); }
public JobSkillType( JobRepository jobRepository, SkillRepository skillRepository, JobSkillRepository jobSkillRepository ) { Field(x => x.Id, type: typeof(IdGraphType)); Field(x => x.Level, nullable: true); Field(x => x.Description, nullable: true); Field <JobType>( "job", resolve: context => { if (context.Source.JobId != null) { return(jobRepository.GetById((Guid)context.Source.JobId)); } return(null); } ); //// Async test //FieldAsync<JobType>( // "job", // resolve: async context => // { // if (context.Source.JobId != null) { // return await context.TryAsyncResolve( // async c => await jobRepository.GetByIdAsync((Guid)context.Source.JobId) // ); // } // // return null; // } //); Field <SkillType>( "skill", resolve: context => { if (context.Source.SkillId != null) { return(skillRepository.GetById((Guid)context.Source.SkillId)); } return(null); } ); //// Async test //FieldAsync<SkillType>( // "skill", // resolve: async context => // { // if (context.Source.SkillId != null) { // return await context.TryAsyncResolve( // async c => await skillRepository.GetByIdAsync((Guid)context.Source.SkillId) // ); // } // // return null; // } //); Field(x => x.CreatedByUserId, type: typeof(IdGraphType)); // TODO: Field(x => x.CreatedByUser, type: typeof(UserType)); Field(x => x.ModifiedByUserId, type: typeof(IdGraphType)); // TODO: Field(x => x.ModifiedByUser, type: typeof(UserType)); }
public Task <JobVacancy> GetById(int id) { return(jobRepository.GetById(id)); }
public RJMQuery( DocumentRepository documentRepository, DocumentTypeRepository documentTypeRepository, ResumeRepository resumeRepository, ResumeStateRepository resumeStateRepository, SkillRepository skillRepository, SkillAliasRepository skillAliasRepository, JobRepository jobRepository, JobStateRepository jobStateRepository ) { this.AuthorizeWith("Authorized"); // Documents Field <ListGraphType <DocumentType> >( "documents", resolve: context => documentRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<DocumentType>>( // "documents", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await documentRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <DocumentType>( "document", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => documentRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<DocumentType>( // "document", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await documentRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); // DocumentTypes Field <ListGraphType <DocumentTypeType> >( "documentTypes", resolve: context => documentTypeRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<DocumentTypeType>>( // "documentTypes", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await documentTypeRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <DocumentTypeType>( "documentType", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => documentTypeRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<DocumentTypeType>( // "documentType", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await documentTypeRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); // Resumes Field <ListGraphType <ResumeType> >( "resumes", resolve: context => resumeRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<ResumeType>>( // "resumes", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await resumeRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <ResumeType>( "resume", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => resumeRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<ResumeType>( // "resume", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await resumeRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); // ResumeStates Field <ListGraphType <ResumeStateType> >( "resumeStates", resolve: context => resumeStateRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<ResumeStateType>>( // "resumeStates", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await resumeStateRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <ResumeStateType>( "resumeState", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => resumeStateRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<ResumeStateType>( // "resumeState", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await resumeStateRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); // Skills Field <ListGraphType <SkillType> >( "skills", resolve: context => skillRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<SkillType>>( // "skills", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await skillRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <SkillType>( "skill", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => skillRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<SkillType>( // "skill", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await skillRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); // SkillAliases Field <ListGraphType <SkillAliasType> >( "skillAliases", resolve: context => skillAliasRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<SkillAliasType>>( // "skillAliases", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await skillAliasRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <SkillAliasType>( "skillAlias", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => skillAliasRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<SkillAliasType>( // "skillAlias", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await skillAliasRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); // Jobs Field <ListGraphType <JobType> >( "jobs", resolve: context => jobRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<JobType>>( // "jobs", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await jobRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <JobType>( "job", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => jobRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<JobType>( // "job", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await jobRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); // JobStates Field <ListGraphType <JobStateType> >( "jobStates", resolve: context => jobStateRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<JobStateType>>( // "jobStates", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await jobStateRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <JobStateType>( "jobState", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => jobStateRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<JobStateType>( // "jobState", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await jobStateRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); }