Exemplo n.º 1
0
 public Task <T> GetOrganization <T>(IOrganizationRecruiter re) where T : RecruiterOrganizationOutput
 {
     return(Repository.Queryable()
            .Where(x => x.Id == re.OrganizationId)
            .ProjectTo <T>(ProjectionMapping)
            .FirstOrDefaultAsync());
 }
Exemplo n.º 2
0
 public DashboardController(IWidgetManager widgetManager,
                            IOrganizationRecruiter recruiter,
                            IServiceProvider serviceProvider) : base(serviceProvider)
 {
     _recruiter     = recruiter;
     _widgetManager = widgetManager;
 }
Exemplo n.º 3
0
        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" }
                }
            });
        }
Exemplo n.º 4
0
 public Task <PackedList <T> > GetContractors <T>(IOrganizationRecruiter re, CommonFilters filters)
     where T : ContractorOutput
 {
     return(Repository.Queryable()
            .ForOrganizationRecruiter(re)
            .PaginateProjection <Contractor, T>(filters, ProjectionMapping));
 }
Exemplo n.º 5
0
 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());
 }
Exemplo n.º 7
0
        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());
 }
Exemplo n.º 9
0
 public static IQueryable <TimeEntry> ForOrganizationRecruiter(this IQueryable <TimeEntry> entities,
                                                               IOrganizationRecruiter re)
 {
     return(entities.Where(
                x => x.RecruiterId == re.RecruiterId &&
                x.RecruitingOrganizationId == re.OrganizationId));
 }
Exemplo n.º 10
0
 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));
 }
Exemplo n.º 11
0
 public ContractorController(
     IContractorService contractorService,
     IOrganizationRecruiter recruiter,
     IServiceProvider serviceProvider) : base(serviceProvider)
 {
     _contractorService = contractorService;
     _recruiter         = recruiter;
 }
Exemplo n.º 12
0
 public OrganizationController(
     IOrganizationRecruiter recruiter,
     IOrganizationRecruiterService recruiterService,
     IServiceProvider provider) : base(provider)
 {
     _recruiter        = recruiter;
     _recruiterService = recruiterService;
 }
Exemplo n.º 13
0
 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));
 }
Exemplo n.º 14
0
 public Task <T> GetContract <T>(IOrganizationRecruiter re, Guid id) where T : RecruiterContractOutput
 {
     return(Repository.Queryable()
            .ForOrganizationRecruiter(re)
            .FindById(id)
            .ProjectTo <T>(ProjectionMapping)
            .FirstOrDefaultAsync());
 }
Exemplo n.º 15
0
 public AgreementController(
     IRecruitingAgreementService agreementService,
     IOrganizationRecruiter recruiter,
     IServiceProvider serviceProvider) : base(serviceProvider)
 {
     _agreementService = agreementService;
     _recruiter        = recruiter;
 }
Exemplo n.º 16
0
 public Task <T> GetCandidate <T>(IOrganizationRecruiter organizationRecruiter, Guid candidateId)
     where T : RecruiterCandidateOutput
 {
     return(Repository.Queryable()
            .ForOrganizationRecruiter(organizationRecruiter)
            .FindById(candidateId)
            .ProjectTo <T>(ProjectionMapping)
            .FirstOrDefaultAsync());
 }
Exemplo n.º 17
0
 public TimeController(ITimeMatrixService timeMatrix,
                       IOrganizationRecruiter recruiter,
                       IServiceProvider serviceProvider,
                       IChartService chartService) : base(serviceProvider)
 {
     _recruiter    = recruiter;
     _timeMatrix   = timeMatrix;
     _chartService = chartService;
 }
Exemplo n.º 18
0
 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));
        }
Exemplo n.º 20
0
 public CandidateController(ICandidateService candidateService,
                            ICommentService commentService,
                            IOrganizationRecruiter recruiter,
                            IServiceProvider serviceProvider) : base(serviceProvider)
 {
     _candidateService = candidateService;
     _commentService   = commentService;
     _recruiter        = recruiter;
 }
Exemplo n.º 21
0
 public ContractController(
     ICommentService commentService,
     IContractService contractService,
     IOrganizationRecruiter recruiter,
     IServiceProvider provider) : base(provider)
 {
     _commentService  = commentService;
     _contractService = contractService;
     _recruiter       = recruiter;
 }
Exemplo n.º 22
0
 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());
 }
Exemplo n.º 23
0
        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));
        }
Exemplo n.º 24
0
        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();
 }
Exemplo n.º 28
0
        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);
        }
Exemplo n.º 29
0
        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);
        }
Exemplo n.º 30
0
 public async Task <CandidateResult> DeleteCandidate(IOrganizationRecruiter re, Guid candidateId)
 {
     return(await DeleteCandidate(candidateId));
 }