public Task <T> GetOrganization <T>(IOrganizationRecruiter re) where T : RecruiterOrganizationOutput { return(Repository.Queryable() .Where(x => x.Id == re.OrganizationId) .ProjectTo <T>(ProjectionMapping) .FirstOrDefaultAsync()); }
public DashboardController(IWidgetManager widgetManager, IOrganizationRecruiter recruiter, IServiceProvider serviceProvider) : base(serviceProvider) { _recruiter = recruiter; _widgetManager = widgetManager; }
public async Task <RecruiterChartOutput> GetProviderChartData(IOrganizationRecruiter recruiter, TimeMatrixFilters filters, ChartParams chartParams) { var result = await _matrixService.GetComposedOutput(recruiter, filters); var am = result.Matrix.ToAmData <RecruiterTimeMatrixOutput, RecruiterOrganizationAccountManagerOutput, RecruiterChartDataItem>(result.AccountManagers). FillMissingDays(chartParams.DateBreakdown, filters). TopLevelGrouping(chartParams.DateBreakdown). SecondLevelGrouping(chartParams.DateBreakdown); var co = result.Matrix.ToCoData <RecruiterTimeMatrixOutput, RecruiterOrganizationContractorOutput, RecruiterChartDataItem>(result.Contractors). FillMissingDays(chartParams.DateBreakdown, filters). TopLevelGrouping(chartParams.DateBreakdown). SecondLevelGrouping(chartParams.DateBreakdown); return(new RecruiterChartOutput { Co = co, Am = am, CurrentBreakdown = "co", CurrentDateRange = chartParams.DateBreakdown == DateBreakdown.ByMonth ? "m0" : "w0", DateRanges = GetDateRange(chartParams.DateBreakdown, co), Breakdowns = new Dictionary <string, string> { { "am", "By Account Manager" }, { "co", "By Contractor" } } }); }
public Task <PackedList <T> > GetContractors <T>(IOrganizationRecruiter re, CommonFilters filters) where T : ContractorOutput { return(Repository.Queryable() .ForOrganizationRecruiter(re) .PaginateProjection <Contractor, T>(filters, ProjectionMapping)); }
public async Task <T> GetTimeEntry <T>(IOrganizationRecruiter re, Guid entryId) where T : RecruiterTimeEntryOutput { return(await Repository.Queryable() .FindById(entryId) .ProjectTo <T>(ProjectionMapping) .FirstOrDefaultAsync()); }
public Task <RecruiterCounts> GetCounts(IOrganizationRecruiter principal) { return(Repository.Queryable() .Where(x => x.RecruiterId == principal.RecruiterId && x.OrganizationId == principal.OrganizationId) .ProjectTo <RecruiterCounts>(ProjectionMapping) .FirstOrDefaultAsync()); }
public Task <CandidateResult> CreateExternalCandidate(IOrganizationRecruiter re, Guid providerOrganizationId, CandidateInput model) { _logger.LogInformation(GetLogMessage("For Email: {email}; with code: {code}"), model.EmailAddress, model.ReferralCode); return(CreateCandidate(re, providerOrganizationId, model)); }
public Task <List <T> > GetAgreements <T>(IOrganizationRecruiter principal) where T : RecruitingAgreementOutput { return(Repository.Queryable().Where(x => x.RecruitingOrganizationId == principal.OrganizationId) .Where(x => x.Status == AgreementStatus.Approved) .ProjectTo <T>(ProjectionMapping) .ToListAsync()); }
public static IQueryable <TimeEntry> ForOrganizationRecruiter(this IQueryable <TimeEntry> entities, IOrganizationRecruiter re) { return(entities.Where( x => x.RecruiterId == re.RecruiterId && x.RecruitingOrganizationId == re.OrganizationId)); }
public Task <PackedList <T> > GetCandidates <T>(IOrganizationRecruiter organizationRecruiter, CommonFilters filters) where T : RecruiterCandidateOutput { return(Repository.Queryable() .ForOrganizationRecruiter(organizationRecruiter) .OrderByDescending(x => x.Updated) .PaginateProjection <Candidate, T>(filters, ProjectionMapping)); }
public ContractorController( IContractorService contractorService, IOrganizationRecruiter recruiter, IServiceProvider serviceProvider) : base(serviceProvider) { _contractorService = contractorService; _recruiter = recruiter; }
public OrganizationController( IOrganizationRecruiter recruiter, IOrganizationRecruiterService recruiterService, IServiceProvider provider) : base(provider) { _recruiter = recruiter; _recruiterService = recruiterService; }
public Task <PackedList <T> > GetContracts <T>(IOrganizationRecruiter re, ContractFilters filters) where T : RecruiterContractOutput { return(Repository.Queryable().ForOrganizationRecruiter(re) .ApplyWhereFilters(filters) .OrderByDescending(x => x.Updated) .PaginateProjection <Contract, T>(filters, ProjectionMapping)); }
public Task <T> GetContract <T>(IOrganizationRecruiter re, Guid id) where T : RecruiterContractOutput { return(Repository.Queryable() .ForOrganizationRecruiter(re) .FindById(id) .ProjectTo <T>(ProjectionMapping) .FirstOrDefaultAsync()); }
public AgreementController( IRecruitingAgreementService agreementService, IOrganizationRecruiter recruiter, IServiceProvider serviceProvider) : base(serviceProvider) { _agreementService = agreementService; _recruiter = recruiter; }
public Task <T> GetCandidate <T>(IOrganizationRecruiter organizationRecruiter, Guid candidateId) where T : RecruiterCandidateOutput { return(Repository.Queryable() .ForOrganizationRecruiter(organizationRecruiter) .FindById(candidateId) .ProjectTo <T>(ProjectionMapping) .FirstOrDefaultAsync()); }
public TimeController(ITimeMatrixService timeMatrix, IOrganizationRecruiter recruiter, IServiceProvider serviceProvider, IChartService chartService) : base(serviceProvider) { _recruiter = recruiter; _timeMatrix = timeMatrix; _chartService = chartService; }
public Task <List <T> > GetTimeEntries <T>(IOrganizationRecruiter re, TimeMatrixFilters filters) where T : RecruiterTimeEntryOutput { return(Repository.Queryable() .ForOrganizationRecruiter(re) .ApplyWhereFilters(filters) .ProjectTo <T>(ProjectionMapping) .ToListAsync()); }
public async Task <bool> CreateCandidateComment(IOrganizationRecruiter recruiter, Guid candidateId, CommentInput input) { var candidate = await _candidateRepository.Queryable().ForOrganizationRecruiter(recruiter) .Where(x => x.Id == candidateId) .FirstAsync(); return(await CreateCandidateComment(candidate, input, recruiter.OrganizationId)); }
public CandidateController(ICandidateService candidateService, ICommentService commentService, IOrganizationRecruiter recruiter, IServiceProvider serviceProvider) : base(serviceProvider) { _candidateService = candidateService; _commentService = commentService; _recruiter = recruiter; }
public ContractController( ICommentService commentService, IContractService contractService, IOrganizationRecruiter recruiter, IServiceProvider provider) : base(provider) { _commentService = commentService; _contractService = contractService; _recruiter = recruiter; }
public Task <List <T> > GetContracts <T>(IOrganizationRecruiter re, Guid[] uniqueContractIds) where T : RecruiterContractOutput { return(Repository .Queryable() .ForOrganizationRecruiter(re) .Where(x => uniqueContractIds.Contains(x.Id)) .OrderByDescending(x => x.Updated) .ProjectTo <T>(ProjectionMapping) .ToListAsync()); }
public async Task <CandidateResult> UpdateCandidate(IOrganizationRecruiter re, Guid candidateId, CandidateInput model) { var entity = await Repository.Queryable() .ForOrganizationRecruiter(re) .GetById(candidateId).FirstOrDefaultAsync(); if (entity == null) { return(null); } entity.InjectFrom(model); return(await UpdateCandidate(entity)); }
public async Task <RecruiterTimeMatrixComposedOutput> GetComposedOutput(IOrganizationRecruiter re, TimeMatrixFilters filters) { filters.ProjectId = null; filters.ProjectManagerId = null; filters.ProviderOrganizationId = null; filters.AccountManagerId = null; filters.RecruiterOrganizationId = re.OrganizationId; filters.RecruiterId = re.RecruiterId; var matrix = await _context.TimeMatrix.ApplyWhereFilters(filters) .ProjectTo <RecruiterTimeMatrixOutput>(_mapperConfiguration) .ToListAsync(); var uniqueContractIds = matrix.Select(x => x.ContractId).Distinct().ToArray(); var uniqueContractorIds = matrix.Select(x => x.ContractorId).Distinct().ToArray(); var uniqueAccountManagerIds = matrix.Select(x => x.AccountManagerId).Distinct().ToArray(); var contractsTask = _contractService.GetContracts <RecruiterContractOutput>(re, uniqueContractIds); var accountManagers = _accountManagerService.GetForOrganization <RecruiterOrganizationAccountManagerOutput>( re.OrganizationId, uniqueAccountManagerIds); var contractors = _contractorService.GetForOrganization <RecruiterOrganizationContractorOutput>(re.OrganizationId, uniqueContractorIds); Task.WaitAll(contractsTask, accountManagers, contractors); return(new RecruiterTimeMatrixComposedOutput { Matrix = matrix, Contracts = contractsTask.Result, AccountManagers = accountManagers.Result, Contractors = contractors.Result, }); }
public static IQueryable <OrganizationProjectManager> ForOrganizationRecruiter( this IQueryable <OrganizationProjectManager> entities, IOrganizationRecruiter re) { return(entities.Where(x => x.OrganizationId == re.OrganizationId)); }
public static IQueryable <Contractor> ForOrganizationRecruiter(this IQueryable <Contractor> entities, IOrganizationRecruiter re) { return(entities.Where(x => x.RecruiterOrganizationId == re.OrganizationId && x.RecruiterId == re.RecruiterId)); }
public Task <List <TimeEntryOutput> > GetTimeEntriesForDashboard(IOrganizationRecruiter re) { throw new NotImplementedException(); }
private async Task <CandidateResult> CreateCandidate(IOrganizationRecruiter re, Guid providerOrganizationId, CandidateInput input) { _logger.LogInformation(GetLogMessage("RE: {0}"), re.OrganizationId); var retVal = new CandidateResult(); var isExternal = providerOrganizationId != re.OrganizationId; _logger.LogDebug(GetLogMessage("External Lead: {0}"), isExternal); var recruiter = await _recruiterRepository.Queryable() .Include(x => x.Recruiter) .ThenInclude(x => x.Person) .Where(x => x.RecruiterId == re.RecruiterId && x.OrganizationId == re.OrganizationId) .FirstAsync(); var recruiterBonus = recruiter.RecruiterBonus; var recruitingAgencyBonus = 0m; var recruitingAgencyStream = 0m; var recruiterStream = recruiter.RecruiterStream; _logger.LogDebug( GetLogMessage( $@"Recruiter Found: {recruiter.Recruiter.Person.DisplayName}")); if (isExternal) { var recruitingAgreement = await _recruitingAgreements.Queryable() .Where(x => x.ProviderOrganizationId == providerOrganizationId && x.RecruitingOrganizationId == re.OrganizationId) .FirstOrDefaultAsync(); if (recruitingAgreement == null) { retVal.ErrorMessage = "Recruiting agreement doesn't exist between recruiting and provider organization"; return(retVal); } if (recruitingAgreement.Status != AgreementStatus.Approved) { retVal.ErrorMessage = "Recruiting agreement is not approved"; return(retVal); } _logger.LogTrace( GetLogMessage( $@"Recruiting Agreement found to be valid")); recruiterBonus = recruitingAgreement.RecruiterBonus; recruitingAgencyBonus = recruitingAgreement.RecruitingAgencyBonus; recruitingAgencyStream = recruitingAgreement.RecruitingAgencyStream; recruiterStream = recruitingAgreement.RecruiterStream; } var candidate = new Candidate { Iso2 = input.Iso2, ProvinceState = input.ProvinceState, RecruiterStream = recruiterStream, RecruiterBonus = recruiterBonus, RecruitingAgencyStream = recruitingAgencyStream, RecruitingAgencyBonus = recruitingAgencyBonus, ProviderOrganizationId = providerOrganizationId, RecruiterOrganizationId = re.OrganizationId, RecruiterId = re.RecruiterId, UpdatedById = _userInfo.UserId, CreatedById = _userInfo.UserId, ObjectState = ObjectState.Added, Status = CandidateStatus.New, StatusTransitions = new List <CandidateStatusTransition>() { new CandidateStatusTransition() { Status = CandidateStatus.New, ObjectState = ObjectState.Added } } }.InjectFrom(input) as Candidate; var candidateResult = Repository.Insert(candidate, true); _logger.LogDebug(GetLogMessage("{0} records updated in database."), candidateResult); if (candidateResult > 0) { retVal.Succeeded = true; retVal.CandidateId = candidate.Id; await Task.Run(() => { RaiseEvent(new CandidateCreatedEvent { CandidateId = candidate.Id }); }); } return(retVal); }
public async Task <List <RecruiterProviderOrganizationOutput> > GetProviderOrganizations(IOrganizationRecruiter recruiter) { var result = await _recruitingAgreement.Queryable() .Where(x => x.RecruitingOrganizationId == recruiter.OrganizationId && x.Status == AgreementStatus.Approved) .Select(x => x.ProviderOrganization) .ProjectTo <RecruiterProviderOrganizationOutput>(ProjectionMapping) .ToListAsync(); return(result); }
public async Task <CandidateResult> DeleteCandidate(IOrganizationRecruiter re, Guid candidateId) { return(await DeleteCandidate(candidateId)); }