//Get Job Details public JobDetailDTO GetJobDetails(int id, string username) { var job = _jobRepo.Get(id); var isAdminUser = checkIfAdmin(username); var contractor = (from c in job select c.Contractor).FirstOrDefault(); var project = (from p in job select p.Project).FirstOrDefault(); return((from j in job select new JobDetailDTO() { Id = j.Id, Name = j.Name, ProjectTitle = project.Title, Estimate = isAdminUser ? j.Estimate : (decimal?)null, Deadline = j.Deadline, Description = j.Description, State = j.State.ToString(), Contractor = new ContractorUserDTO() { Id = contractor.Id, Name = contractor.Name, Title = contractor.Title, CompanyName = contractor.CompanyName, Email = contractor.Email, PhoneNumber = contractor.PhoneNumber, PhoneNumber2 = contractor.PhoneNumber2 } }).FirstOrDefault()); }
public async Task <IActionResult> GetSchoolYear(int id) { var job = await jobRepository.Get(id); if (job == null) { return(NotFound(new { status = ResultStatus.STATUS_NOT_FOUND, message = "Không tìm thấy nghề nghiệp" })); } return(Ok(new { status = ResultStatus.STATUS_OK, data = job })); }
public void PlannerUsesRenamePluginIfDestinationEssenceFilenameIsPresent() { var wfsPluginMock = CreateWfsMock("1"); wfsPluginMock.SetupGet(p => p.Busy).Returns(false); wfsPluginMock.Setup(p => p.CheckAndEstimate(It.IsAny <ExecutionTask>())).Returns(true); var fileRenamerPluginMock = CreateFileRenamerMock("1"); fileRenamerPluginMock.SetupGet(p => p.Busy).Returns(false); fileRenamerPluginMock.Setup(p => p.CheckAndEstimate(It.IsAny <ExecutionTask>())).Returns(true); var planner = new SimplePlanner(new List <IPlugin> { wfsPluginMock.Object, fileRenamerPluginMock.Object }, JobRepository, Logging, _callBackService.Object); var job = CreateNewWfsJob(); job.Destination.Files = new List <EssenceFile> { EssenceFile.Template("NewName_%index%.%ext%") }; var jobUrn = job.Urn; JobRepository.Add(job); planner.Calculate(); Assert.That(JobRepository.Get(jobUrn).Plan.Tasks.Count, Is.EqualTo(2)); Assert.That(JobRepository.Get(jobUrn).Plan.Tasks[1].PluginUrn, Is.EqualTo(fileRenamerPluginMock.Object.Urn)); }
public void TestMethod1() { try { MainContext mc = new MainContext(); IJobRepository ijr = new JobRepository(mc); Job j = ijr.Get(x => x.Key.Equals("056781")); if (j == null) { Job newjob = new Job() { Key = "056781", Name = "Desarrollador Sr" }; ijr.Insert(newjob); System.Console.Write("si se pudo perro"); } else { System.Console.Write("Si se consulto perro jajajjajaj"); } } catch (Exception e) { System.Console.Write(e.StackTrace.ToString()); } }
public IHttpActionResult GetJob(Guid id) { var job = JobRepository.Get(id); return(job == null ? (IHttpActionResult)NotFound() : Ok(job)); }
public async Task <IActionResult> Get(int id) { if (id.ToString() == null) { return(BadRequest(new { success = false, error = "id is not null" })); } try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Job job = await jobRepository.Get(w => w.ma_cong_viec == id); if (job == null) { return(NotFound(new { success = false, error = "Job not found" })); } return(Ok(new { success = true, data = job })); } catch { return(NotFound(new { success = false, error = "Job not found" })); } }
public void EssenceGetsCleanedOnUpdate() { var originJob = ActiveJob(); int essenceAmount; JobRepository.Add(originJob); Assert.That(JobRepository.ActiveJobs().Count(), Is.EqualTo(1)); Assert.That(JobRepository.DoneJobs(), Is.Empty); Assert.That(JobRepository.WaitingJobs(), Is.Empty); var jobFromRepo = JobRepository.Get(originJob.Urn); jobFromRepo.Plan.GetCurrentTask().State = ExecutionState.Done; jobFromRepo.Plan.MoveToNextTask(); JobRepository.Update(jobFromRepo); using (var db = new MarvinEntities()) { essenceAmount = db.essence.Count(); } //There should only be four essencefiles (two job essence and two task essence) Assert.That(essenceAmount, Is.EqualTo(4)); }
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 IEnumerable <Job> GetRevelantJobs(int jobID2) { List <Job> jobList = new List <Job>(); var categories = JobCategoryRepository.Get(filter: m => m.JobID == jobID2).ToArray(); foreach (var item in categories) { var jobIDList = JobCategoryRepository.Get(filter: m => m.CategoryID == item.CategoryID).ToArray(); foreach (var job in jobIDList) { if (job.JobID != jobID2) { var jobItem = JobRepository.Get(filter: a => (a.JobID == job.JobID) && (a.IsPublic) && (a.StartedDate <= DateTime.Now) && (a.EndedDate >= DateTime.Now)).FirstOrDefault(); if (jobItem != null) { jobList.Add(jobItem); } } } } return(jobList.OrderByDescending(m => m.StartedDate).Take(5).Distinct()); }
internal IEnumerable <Job> Get() { return(_repo.Get()); }
//GET public IEnumerable <Job> Get() { return(_repo.Get()); }
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")) // ); // } //); }