Beispiel #1
0
 public InterviewController(IInterviewRepository InterviewRepo, ICandidateRepository CandidateRepo, IJobOrderRepository JobOrderRepo)
 {
     InterviewRepository = InterviewRepo;
     CandidateRepository = CandidateRepo;
     JobOrderRepository  = JobOrderRepo;
     ViewBag.Name        = System.Web.HttpContext.Current.Session["Name"];
 }
 //
 // Summary:
 //     /// Method responsible for initializing the controller. ///
 //
 // Parameters:
 //   logger:
 //     The logger param.
 //
 //   mapper:
 //     The mapper param.
 //
 //   interviewRepository:
 //     The interviewRepository param.
 //
 //   interviewService:
 //     The interviewService param.
 //
 public InterviewsController(ILogger <InterviewsController> logger, IMapper mapper, IInterviewRepository interviewRepository, IInterviewService interviewService)
 {
     _logger = logger;
     _mapper = mapper;
     _interviewRepository = interviewRepository;
     _interviewService    = interviewService;
 }
Beispiel #3
0
 //
 // Summary:
 //     /// Method responsible for initializing the service. ///
 //
 // Parameters:
 //   interviewRepository:
 //     The interviewRepository param.
 //
 //   personRepository:
 //     The personRepository param.
 //
 //   entityAuditService:
 //     The entityAuditService param.
 //
 //   interviewValidator:
 //     The interviewValidator param.
 //
 public InterviewService(IInterviewRepository interviewRepository, IPersonRepository personRepository, IEntityAuditService entityAuditService, IValidator <InterviewCommand> interviewValidator)
 {
     _interviewRepository = interviewRepository;
     _personRepository    = personRepository;
     _entityAuditService  = entityAuditService;
     _interviewValidator  = interviewValidator;
 }
        public EntityFrameworkRepositoryContext()
        {
            _context = new EntityFrameworkContext();

            _interviewRepository = new InterviewRepository(_context);
            _interviewerRepository = new InterviewerRepository(_context);
        }
Beispiel #5
0
        public InterviewGraphType(IInterviewRepository interviewRepository)
        {
            Field(x => x.Comment);
            Field(x => x.Id);
            Field(x => x.Note);
            Field(x => x.ScheduledDate);

            Field <InterviewEnumType>(Constants.GraphQl.InterviewTypeField);

            Field <CandidateGraphType>
                (Constants.GraphQl.CandidateField,
                resolve: context =>
            {
                return(interviewRepository.FirstOrDefault(x => x.Id == context.Source.Id,
                                                          x => x.Include(x => x.Candidate))
                       .Candidate);
            });

            Field <InterviewerGraphType>
                (Constants.GraphQl.InterviewerField,
                resolve: context =>
            {
                return(interviewRepository.FirstOrDefault(x => x.Id == context.Source.Id,
                                                          x => x.Include(x => x.Interviewer))
                       .Interviewer);
            });
        }
        //
        // Summary:
        //     /// Method responsible for initializing the schema. ///
        //
        // Parameters:
        //   interviewRepository:
        //     The interviewRepository param.
        //
        public InterviewQueryType(IInterviewRepository interviewRepository)
        {
            Name        = "InterviewQuery";
            Description = "Interview Query Type";

            Field <ListGraphType <InterviewType> >(
                name: "allInterviews",
                arguments: new QueryArguments(
                    new QueryArgument <IntGraphType> {
                Name = "skip"
            },
                    new QueryArgument <IntGraphType> {
                Name = "take"
            }
                    ),
                resolve: context => interviewRepository.FindAllAsync());

            Field <InterviewType>(
                name: "interview",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "id"
            }
                    ),
                resolve: context => interviewRepository.FindAsync(context.GetArgument <Guid>("id")));
        }
        //
        // Summary:
        //     /// Method responsible for initializing the validator. ///
        //
        // Parameters:
        //   personRepository:
        //     The personRepository param.
        //
        //   interviewRepository:
        //     The interviewRepository param.
        //
        public InterviewValidator(IPersonRepository personRepository, IInterviewRepository interviewRepository)
        {
            RuleFor(x => x.SchedulingDate)
            .NotEmpty()
            .Must((x) => !(x.DayOfWeek == DayOfWeek.Saturday || x.DayOfWeek == DayOfWeek.Sunday))
            .WithMessage("Não é permitido o agendamento de entrevistas para o final de semana.")
            .Must((x) => x.Hour >= 13 && x.Hour <= 20)
            .WithMessage("Não é permitido o agendamento fora do período (13:00 - 20:00).")
            .Must((x) => x.Minute == 0 || x.Minute == 30)
            .WithMessage("O horário de inicio e termino das entrevistas devem sempre terminar em 00 ou 30(ex: 14:30, 16:00).")
            .MustAsync(async(request, val, token) =>
            {
                Interview interview = await interviewRepository.FindInterviewByPersonIdAndDate(request.PersonId, request.SchedulingDate);

                return(interview is null);
            })
            .WithMessage("Deve haver um intervalo de 3 horas entre as entrevistas para o mesmo candidato no mesmo dia.")
            .MustAsync(async(request, val, token) =>
            {
                Interview interview = await interviewRepository.FindInterviewBySquadAndDate(request.Squad, request.SchedulingDate);

                return(interview is null);
            })
            .WithMessage("Deve haver um intervalo de 3 horas entre as entrevistas para o mesmo squad no mesmo dia.");

            RuleFor(x => x.Squad)
            .IsInEnum()
            .WithMessage("Squad inválido, forneça opções entre 1 - 8.");

            RuleFor(x => x.PersonId)
            .NotEmpty()
            .MustAsync(async(request, val, token) =>
            {
                Person person = await personRepository.FindAsync(val);

                return(person != null);
            }).WithMessage("O valor informado em PersonId não localizado no banco de dados.")
            .MustAsync(async(request, val, token) =>
            {
                Interview interview = await interviewRepository.FindInterviewCurrentYearByPersonIdAndSquad(request.PersonId, request.Squad);

                if (interview is null)
                {
                    return(true);
                }

                if (request.Id is null)
                {
                    return(false);
                }

                if (request.Id != null && interview.Id == request.Id)
                {
                    return(true);
                }

                return(false);
            })
            .WithMessage("Já existe uma entrevista agendada para este candidato e squad neste ano.");
        }
Beispiel #8
0
 //
 // Summary:
 //     /// Method responsible for initializing the service. ///
 //
 // Parameters:
 //   personRepository:
 //     The personRepository param.
 //
 //   addressRepository:
 //     The addressRepository param.
 //
 //   interviewRepository:
 //     The interviewRepository param.
 //
 //   entityAuditService:
 //     The entityAuditService param.
 //
 //   personValidator:
 //     The personValidator param.
 //
 public PersonService(IPersonRepository personRepository, IAddressRepository addressRepository, IInterviewRepository interviewRepository, IEntityAuditService entityAuditService, IValidator <PersonCommand> personValidator)
 {
     _personRepository    = personRepository;
     _addressRepository   = addressRepository;
     _interviewRepository = interviewRepository;
     _entityAuditService  = entityAuditService;
     _personValidator     = personValidator;
 }
Beispiel #9
0
 public InterviewService(
     IInterviewRepository interviewRepository,
     IMapper mapper, UserManager <AppUser> userManager)
 {
     this.interviewRepository = interviewRepository;
     this.mapper      = mapper;
     this.userManager = userManager;
 }
 public SurveyController(IQuestionRepository questionRepository,
                         IAnswerRepository answerRepository,
                         IInterviewRepository interviewRepository)
 {
     _questionRepository  = questionRepository;
     _answerRepository    = answerRepository;
     _interviewRepository = interviewRepository;
 }
        public StartQuestionHandler(IInterviewRepository interviewRepository, IUnitOfWork unitOfWork)
        {
            Guard.AgainstNullArgument(nameof(interviewRepository), interviewRepository);
            Guard.AgainstNullArgument(nameof(unitOfWork), unitOfWork);

            _interviewRepository = interviewRepository;
            _unitOfWork          = unitOfWork;
        }
Beispiel #12
0
 //
 // Summary:
 //     /// Method responsible for initializing the controller. ///
 //
 // Parameters:
 //   logger:
 //     The logger param.
 //
 //   mapper:
 //     The mapper param.
 //
 //   personRepository:
 //     The personRepository param.
 //
 //   addressRepository:
 //     The addressRepository param.
 //
 //   interviewRepository:
 //     The interviewRepository param.
 //
 //   personService:
 //     The personService param.
 //
 public PersonsController(ILogger <PersonsController> logger, IMapper mapper, IPersonRepository personRepository, IAddressRepository addressRepository, IInterviewRepository interviewRepository, IPersonService personService)
 {
     _logger              = logger;
     _mapper              = mapper;
     _personRepository    = personRepository;
     _addressRepository   = addressRepository;
     _interviewRepository = interviewRepository;
     _personService       = personService;
 }
Beispiel #13
0
        /// <summary>
        /// Constructor that sets required repositories and unit of work for this service
        /// </summary>
        /// <param name="candidateRepository">Parameter for setting CandidateRepository</param>
        /// <param name="positionRepository">Parameter for setting PositionRepository</param>
        /// <param name="interviewRepository">Parameter for setting InterviewRepository</param>
        /// <param name="unitOfWork">Parameter for setting UnitOfWork</param>
        public CandidateService(ICandidateRepository candidateRepository, IPositionRepository positionRepository, IInterviewRepository interviewRepository, IUnitOfWork unitOfWork)
        {
            this.CandidateRepository = candidateRepository;

            this.PositionRepository = positionRepository;

            this.InterviewRepository = interviewRepository;

            this.UnitOfWork = unitOfWork;
        }
Beispiel #14
0
        public InterviewerGraphType(IInterviewRepository interviewRepository)
        {
            Field(x => x.FirstName);
            Field(x => x.Id);
            Field(x => x.LastName);

            Field <ListGraphType <InterviewGraphType> >
                (Constants.GraphQl.InterviewsField,
                resolve: context => interviewRepository.Find(x => x.Interviewer.Id == context.Source.Id));
        }
Beispiel #15
0
 public InterviewService(
     IInterviewRepository iInterviewRepository,
     IPostRepository iPostRepository,
     IResumeRepository iResumeRepository
     )
 {
     _iInterviewRepository = iInterviewRepository;
     _iPostRepository      = iPostRepository;
     _iResumeRepository    = iResumeRepository;
 }
Beispiel #16
0
        /// <summary>
        /// Constructor that sets required repositories and unit of work for this service
        /// </summary>
        /// <param name="interviewRepository">Parameter for setting InterviewRepository</param>
        /// <param name="unitOfWork">Parameter for setting CandidateRepository</param>
        /// <param name="candidateRepository">Parameter for setting AgentRepository</param>
        /// <param name="agentRepository">Parameter for setting UnitOfWork</param>
        public InterviewService(IInterviewRepository interviewRepository, IUnitOfWork unitOfWork, ICandidateRepository candidateRepository, IAgentRepository agentRepository)
        {
            this.InterviewRepository = interviewRepository;

            this.CandidateRepository = candidateRepository;

            this.AgentRepository = agentRepository;

            this.UnitOfWork = unitOfWork;
        }
Beispiel #17
0
 public GetInterviewStatusValidator(IInterviewRepository interviewRepository)
 {
     RuleFor(g => g.InterviewId).NotNull().WithMessage(Messages.NotNull)
     .DependentRules(() =>
     {
         RuleFor(g => g.InterviewId)
         .MustAsync((id, _) => interviewRepository.Exists(id.Value))
         .WithMessage(g => $"Интервью с Id '{g.InterviewId}' не существует.");
     });
 }
Beispiel #18
0
 public InterviewManager(
     IMapper mapper,
     IInterviewRepository interviewRepository,
     IInterviewTemplateRepository interviewTemplateRepository,
     ICandidateRepository candidateRepository)
 {
     _Mapper = mapper;
     _InterviewRepository         = interviewRepository;
     _InterviewTemplateRepository = interviewTemplateRepository;
     _CandidateRepository         = candidateRepository;
 }
Beispiel #19
0
 public CardService(ICardRepository cardRepository, IUserProfileRepository userProfileRepository, IUnitOfWork unitOfWork, ILogger logger, IActivityHelperService activityHelperService, ISpecialNoteRepository specialNoteRepository, IFeedbackRepository feedbackRepository, IInterviewRepository interviewRepository, ITestRepository testRepository)
 {
     _cardRepository = cardRepository;
     _userProfileRepository = userProfileRepository;
     _unitOfWork = unitOfWork;
     _logger = logger;
     _activityHelperService = activityHelperService;
     _specialNoteRepository = specialNoteRepository;
     _feedbackRepository = feedbackRepository;
     _interviewRepository = interviewRepository;
     _testRepository = testRepository;
 }
Beispiel #20
0
 public Arranger(
     IInterviewRepository interviewRepository,
     IQuestionRepository questionRepository,
     IInterviewTemplateRepository interviewTemplateRepository,
     ICandidateRepository candidateRepository)
 {
     _InterviewRepository         = interviewRepository;
     _QuestionRepository          = questionRepository;
     _InterviewTemplateRepository = interviewTemplateRepository;
     _CandidateRepository         = candidateRepository;
     _Fixture = new Fixture();
 }
        public void Setup()
        {
            Database.SetInitializer(new DropCreateDatabaseAlways<ContextDb>());
            _repository = new InterviewRepository();
            _interview = ObjectMother.GetInterview();

            using (var context = new ContextDb())
            {
                context.Interviews.Add(_interview);
                context.SaveChanges();
            }
        }
        public HrReworkQuery(ICandidateRepository candidateRepository,
                             IInterviewerRepository interviewerRepository,
                             IInterviewRepository interviewRepository)
        {
            Field <ListGraphType <CandidateGraphType> >(
                Constants.GraphQl.CandidatesField,
                resolve: context => candidateRepository.Find());

            Field <ListGraphType <InterviewGraphType> >
                (Constants.GraphQl.InterviewsField,
                resolve: context => interviewRepository.Find());

            Field <ListGraphType <InterviewerGraphType> >
                (Constants.GraphQl.InterviewersField,
                resolve: context => interviewerRepository.Find());

            Field <CandidateGraphType>(
                Constants.GraphQl.CandidateField,
                arguments: new QueryArguments(new QueryArgument <IdGraphType>
            {
                Name = "id"
            }),
                resolve: context =>
            {
                var id = context.GetArgument <int>("id");
                return(candidateRepository.FirstOrDefault(x => x.Id == id));
            });

            Field <InterviewerGraphType>(
                Constants.GraphQl.InterviewerField,
                arguments: new QueryArguments(new QueryArgument <IdGraphType>
            {
                Name = "id"
            }),
                resolve: context =>
            {
                var id = context.GetArgument <int>("id");
                return(interviewerRepository.FirstOrDefault(x => x.Id == id));
            });

            Field <InterviewGraphType>(
                Constants.GraphQl.InterviewField,
                arguments: new QueryArguments(new QueryArgument <IdGraphType>
            {
                Name = "id"
            }),
                resolve: context =>
            {
                var id = context.GetArgument <int>("id");
                return(interviewRepository.FirstOrDefault(x => x.Id == id));
            });
        }
Beispiel #23
0
        public StartInterviewHandler(
            IInterviewRepository interviewRepository,
            IVacancyRepository vacancyRepository,
            IUnitOfWork unitOfWork)
        {
            Guard.AgainstNullArgument(nameof(interviewRepository), interviewRepository);
            Guard.AgainstNullArgument(nameof(vacancyRepository), vacancyRepository);
            Guard.AgainstNullArgument(nameof(unitOfWork), unitOfWork);

            _interviewRepository = interviewRepository;
            _vacancyRepository   = vacancyRepository;
            _unitOfWork          = unitOfWork;
        }
Beispiel #24
0
        public CandidateGraphType(IInterviewRepository interviewRepository)
        {
            Field(x => x.FirstName);
            Field(x => x.Id);
            Field(x => x.LastName);
            Field(x => x.Email);
            Field(x => x.Phone);
            Field(x => x.Birthdate);

            Field <ListGraphType <InterviewGraphType> >
                (Constants.GraphQl.InterviewsField,
                resolve: context => interviewRepository.Find(x => x.Candidate.Id == context.Source.Id));
        }
Beispiel #25
0
        /// <summary>
        /// Constructor that sets required repositories and unit of work for this service
        /// </summary>
        /// <param name="agentRepository">Parameter for setting AgentRepository</param>
        /// <param name="positionRepository">Parameter for setting PositionRepository</param>
        /// <param name="notificationRepository">Parameter for setting NotificationRepository</param>
        /// <param name="departmentRepository">Parameter for setting DepartmentRepository</param>
        /// <param name="interviewRepository">Parameter for setting InterviewRepository</param>
        /// <param name="unitOfWork">Parameter for setting UnitOfWork</param>
        public AgentService(IAgentRepository agentRepository, IPositionRepository positionRepository, INotificationRepository notificationRepository, IDepartmentRepository departmentRepository, IInterviewRepository interviewRepository, IUnitOfWork unitOfWork)
        {
            this.AgentRepository = agentRepository;

            this.PositionRepository = positionRepository;

            this.NotificationRepository = notificationRepository;

            this.DepartmentRepository = departmentRepository;

            this.InterviewRepository = interviewRepository;

            this.UnitOfWork = unitOfWork;
        }
        public StartQuestionValidator(IInterviewRepository interviewRepository)
        {
            RuleFor(m => m.InterviewId)
            .NotNull()
            .DependentRules(() =>
            {
                RuleFor(m => m.InterviewId)
                .MustAsync((id, token) => interviewRepository.Exists(id.Value))
                .WithMessage(i => $"Интервью с Id '{i.InterviewId}' не сущетсвует.");

                RuleFor(m => m.InterviewId)
                .MustAsync(async(id, token) => (await interviewRepository.Get(id.Value)).Status == InterviewStatusEntity.Started)
                .WithMessage(i => $"Интервью с Id '{i.InterviewId}' должно быть начато.");

                RuleFor(m => m.InterviewId)
                .MustAsync((id, token) => interviewRepository.HasOpenQuestion(id.Value))
                .WithMessage("Интервью не содержит открытых вопросов.");
            });
        }
Beispiel #27
0
        public StartInterviewValidator(IInterviewRepository interviewRepository)
        {
            Guard.AgainstNullArgument(nameof(interviewRepository), interviewRepository);

            _interviewRepository = interviewRepository;

            RuleFor(m => m.InterviewId).NotNull()
            .WithMessage(Messages.NotNull)
            .DependentRules(() =>
            {
                RuleFor(m => m.InterviewId)
                .MustAsync((id, token) => interviewRepository.Exists(id.Value))
                .WithMessage("Такого интервью не существует.");

                RuleFor(m => m.InterviewId)
                .MustAsync((id, token) => CanStartInterview(id.Value))
                .WithMessage("Интервью нельзя начать.");
            });
        }
        public GetInterviewValidator(IInterviewRepository interviewRepository)
        {
            Guard.AgainstNullArgument(nameof(interviewRepository), interviewRepository);

            RuleFor(i => i.InterviewId)
            .NotNull()
            .WithMessage(Messages.NotNull)
            .DependentRules(() =>
            {
                RuleFor(i => i.InterviewId)
                .MustAsync((id, token) => interviewRepository.Exists(id.Value))
                .WithMessage("Интервью с Id '{PropertyValue}' не найдено.")
                .DependentRules(() =>
                {
                    RuleFor(i => i.InterviewId)
                    .MustAsync(async(id, token) => (await interviewRepository.Get(id.Value)).Status == InterviewStatusEntity.End)
                    .WithMessage("Нельзя просматривать незаконченное интервью.");
                });
            });
        }
        public AnswerValidator(IInterviewRepository interviewRepository)
        {
            RuleFor(m => m.InterviewId).NotNull()
            .DependentRules(() =>
            {
                RuleFor(m => m.InterviewId)
                .MustAsync((id, token) => interviewRepository.Exists(id.Value))
                .WithMessage("Интервью с Id 'PropertyValue' не существет.");

                RuleFor(m => m.InterviewId)
                .MustAsync((id, token) => interviewRepository.HasOpenQuestion(id.Value))
                .WithMessage("Интервью не содержит открытых вопросов.");
            });

            RuleFor(m => m.Value)
            .NotEmpty()
            .When(m => m.Values == null)
            .WithMessage("Должно быть заполнено либо поле Value, либо Values.");

            RuleFor(m => m.Values)
            .NotNull()
            .When(m => string.IsNullOrEmpty(m.Value))
            .WithMessage("Должно быть заполнено либо поле Value, либо Values.");
        }
Beispiel #30
0
 public InterviewService(IUnitOfWork unitOfWork, IDBHelper idbHelper, IInterviewRepository <Interview> interviewRepository, IMapper mapper) : base(unitOfWork, idbHelper, mapper)
 {
     _interviewRepository = interviewRepository;
 }
 public InterviewService(IInterviewRepository interviewRepository)
 {
     _interviewRepository = interviewRepository;
 }
Beispiel #32
0
 public InterviewService(IInterviewRepository interviewRepository, IMapper mapper)
 {
     _interviewRepository = interviewRepository;
     _mapper = mapper;
 }
Beispiel #33
0
 public InterviewService(IInterviewRepository repository) : base(repository)
 {
     this.repository = repository;
 }
Beispiel #34
0
 public OfferController(IOfferRepository OfferRepo, IInterviewRepository InterviewRepo)
 {
     OfferRepository     = OfferRepo;
     InterviewRepository = InterviewRepo;
     ViewBag.Name        = System.Web.HttpContext.Current.Session["Name"];
 }