public RecruiterServiceIntegrationTest()
        {
            _recruiterRepository = new RecruiterRepository(_database);
            _companyRepository   = new CompanyRepository(_database);
            _jobOfferRepository  = new JobOfferRepository(_database);
            _skillRepository     = new SkillRepository(_database);

            _service = new RecruiterService(_companyRepository, _recruiterRepository, _jobOfferRepository);
        }
        public RecruiterServiceUnitTest()
        {
            _mongoDataBaseMock = new Mock <IMongoDatabase>(MockBehavior.Loose);

            _companyRepositoryMock   = new Mock <CompanyRepository>(MockBehavior.Strict, _mongoDataBaseMock.Object);
            _recruiterRepositoryMock = new Mock <RecruiterRepository>(MockBehavior.Strict, _mongoDataBaseMock.Object);
            _jobOfferRepositoryMock  = new Mock <JobOfferRepository>(MockBehavior.Strict, _mongoDataBaseMock.Object);

            _service = new RecruiterService(_companyRepositoryMock.Object, _recruiterRepositoryMock.Object, _jobOfferRepositoryMock.Object);
        }
Exemplo n.º 3
0
        public RecruiterServiceIntegrationTest()
        {
            _recruiterRepository = new RecruiterRepository(_database);
            _companyRepository   = new CompanyRepository(_database);
            _jobOfferRepository  = new JobOfferRepository(_database);
            _skillRepository     = new SkillRepository(_database);
            _personRepository    = new PersonRepository(_database);
            _accountRepository   = new AccountRepository(_database);

            _recruiterService = new RecruiterService(_companyRepository, _recruiterRepository, _jobOfferRepository, _personRepository, _accountRepository);
            _personService    = new PersonService(_personRepository, _jobOfferRepository, _accountRepository);
        }
        public HttpResponseMessage DeleteReminder(int id = 0)
        {
            if (id <= 0)
            {
                ErrorLogService    svc   = new ErrorLogService();
                ErrorLogAddRequest error = new ErrorLogAddRequest();
                error.ErrorFunction = "Aic.Web.Controllers.Api.DeleteReminder";
                error.ErrorMessage  = id + " is not valid!";
                error.UserId        = UserService.UserSelect().PersonId;
                svc.ErrorLogInsert(error);
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
            SuccessResponse response = new SuccessResponse();

            RecruiterService.DeleteReminder(id);

            return(Request.CreateResponse(response));
        }
        public HttpResponseMessage PutReminder(int id, ReminderPutRequest request)
        {
            if (ModelState.IsValid)
            {
                ErrorLogService    svc   = new ErrorLogService();
                ErrorLogAddRequest error = new ErrorLogAddRequest();
                error.ErrorFunction = "Aic.Web.Controllers.Api.PutReminder";
                error.ErrorMessage  = ModelState.ToString();
                error.UserId        = UserService.UserSelect().PersonId;
                svc.ErrorLogInsert(error);
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
            SuccessResponse response = new SuccessResponse();

            RecruiterService.UpdateReminder(request);

            return(Request.CreateResponse(response));
        }
        public HttpResponseMessage PostReminder(ReminderPostRequest request)
        {
            if (!ModelState.IsValid)
            {
                ErrorLogService    svc   = new ErrorLogService();
                ErrorLogAddRequest error = new ErrorLogAddRequest();
                error.ErrorFunction = "Aic.Web.Controllers.Api.PostReminder";
                error.ErrorMessage  = ModelState.ToString();
                error.UserId        = UserService.UserSelect().PersonId;
                svc.ErrorLogInsert(error);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState));
            }
            ItemResponse <int> response = new ItemResponse <int>();

            request.CreatedBy = HttpContext.Current.User.Identity.GetUserId();

            response.Item = RecruiterService.PostReminder(request);

            return(Request.CreateResponse(response));
        }
        public HttpResponseMessage GetReminder()
        {
            try
            {
                ItemsResponse <Reminder> response = new ItemsResponse <Reminder>();

                response.Items = RecruiterService.GetReminder();

                return(Request.CreateResponse(response));
            }
            catch (Exception ex)
            {
                ErrorLogService    svc   = new ErrorLogService();
                ErrorLogAddRequest error = new ErrorLogAddRequest();
                error.ErrorFunction = "Aic.Web.Controllers.Api.GetReminder";
                error.ErrorMessage  = ex.Message;
                error.UserId        = UserService.UserSelect().PersonId;
                svc.ErrorLogInsert(error);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
        public HttpResponseMessage PostRecruiter(RecruiterPostRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState));
            }

            try
            {
                SuccessResponse response = new SuccessResponse();

                RecruiterService.PostRecruiter(request);

                RecruiterService.UpgradeToRecruiter();

                ReminderPostRequest reminder = new ReminderPostRequest();
                reminder.CreatedBy              = HttpContext.Current.User.Identity.GetUserId();
                reminder.ReminderDateTime       = DateTime.UtcNow;
                reminder.ReminderDateTimeString = reminder.ReminderDateTime.ToString();
                reminder.ReminderDescription    = "Thank you for signing up as a Recruiter, your account is now capable of posting Jobs along with managing Jobs in your Recruiter Dashboard";
                reminder.ReminderType           = 2;

                RecruiterService.PostReminder(reminder);

                UserService.Logout();

                return(Request.CreateResponse(response));
            }
            catch (Exception ex)
            {
                ErrorLogService    svc     = new ErrorLogService();
                ErrorLogAddRequest payload = new ErrorLogAddRequest();
                payload.ErrorFunction = "Aic.Web.Controllers.Api.PostRecruiter";
                payload.ErrorMessage  = ex.Message;
                payload.UserId        = UserService.UserSelect().PersonId;
                svc.ErrorLogInsert(payload);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
 public RecruiterController(RecruiterService recruiterService)
 {
     _recruiterService = recruiterService;
 }
Exemplo n.º 10
0
 public RecruiterController(IRecruiterRepository RecruiterRepository)
 {
     _RecruiterService = new RecruiterService(RecruiterRepository);
 }
Exemplo n.º 11
0
        private static void Main(string[] args)
        {
            var mongoClient = new MongoClient();

            mongoClient.DropDatabase("JobOfferDatabase");
            var database = mongoClient.GetDatabase("JobOfferDatabase");

            var cSharp = new Skill()
            {
                Name = "C#"
            };
            var javascript = new Skill()
            {
                Name = "Javascript"
            };
            var react = new Skill()
            {
                Name = "React"
            };
            var docker = new Skill()
            {
                Name = "Docker"
            };
            var java = new Skill()
            {
                Name = "Java"
            };

            var skillRepository = new SkillRepository(database);

            Task.Run(async() => await skillRepository.UpsertAsync(cSharp)).Wait();
            Task.Run(async() => await skillRepository.UpsertAsync(javascript)).Wait();
            Task.Run(async() => await skillRepository.UpsertAsync(react)).Wait();
            Task.Run(async() => await skillRepository.UpsertAsync(docker)).Wait();
            Task.Run(async() => await skillRepository.UpsertAsync(java)).Wait();

            var companyRepository   = new CompanyRepository(database);
            var recruiterRepository = new RecruiterRepository(database);
            var jobOfferRepository  = new JobOfferRepository(database);
            var personRepository    = new PersonRepository(database);
            var accountRepository   = new AccountRepository(database);

            var recruiterService = new RecruiterService(companyRepository, recruiterRepository, jobOfferRepository, personRepository, accountRepository);

            var recruiter = new Recruiter();

            recruiter.AddClient(new Company("Acme", "Software"));

            recruiter.IdentityCard = "28.999.999";
            recruiter.FirstName    = "Patricia";
            recruiter.LastName     = "Maidana";
            recruiter.SetStudy(new Study("UBA", "Lic.RRHH", StudyStatus.Completed));
            recruiter.SetPreviousJob(new Job("Coto", "HR Analyst", DateTime.Now.AddYears(-6), true));

            recruiter.SetAbility(new Ability(javascript, 9));

            var company1 = new Company("Acme", "software");

            companyRepository.UpsertAsync(company1).Wait();

            recruiterService.CreateRecruiterAsync(recruiter).Wait();

            var jobOffer = Task.Run(() =>
            {
                RecruiterService recruiterService1 = recruiterService;
                return(recruiterService1.GetNewJobOffer(recruiter.Id));
            }).Result;

            jobOffer.Date      = DateTime.Now.Date;
            jobOffer.Title     = "Analista programador";
            jobOffer.CompanyId = company1.Id;
            jobOffer.Zone      = "Palermo";

            jobOffer.Description = "Para importante empresa ubicada en San Telmo, estamos en búsqueda de desarrollador fullstack con " +
                                   "al menos 3 años de experiencia utilizando React y NodeJs.Quien se incorpore estará participando dentro " +
                                   "de un proyecto de inteligencia artifical";

            jobOffer.AddSkillRequired(new SkillRequired(javascript, 5, true));
            jobOffer.AddSkillRequired(new SkillRequired(react, 3));

            jobOffer.Language            = "Ingles";
            jobOffer.LanguageLevel       = LanguageLevel.Advance;
            jobOffer.IsLanguageMandatory = true;

            jobOffer.ContractInformation = new ContractCondition()
            {
                StartingFrom   = "Inmediata",
                KindOfContract = "Relación de dependencia",
                WorkingDays    = "Lunes a viernes 9 a 18"
            };

            recruiterService.SaveJobOfferAsync(jobOffer).Wait();

            //

            var company2 = new Company("KaizenRH", "software");

            companyRepository.UpsertAsync(company2).Wait();

            var jobOffer2 = Task.Run(() => recruiterService.GetNewJobOffer(recruiter.Id)).Result;

            jobOffer2.Date      = DateTime.Now.Date;
            jobOffer2.Title     = "JAVA Full Stack Developer";
            jobOffer2.CompanyId = company2.Id;
            jobOffer2.Zone      = "Las Cañitas";

            jobOffer2.Description = "En KaizenRH buscamos Python Developer Junior para trabajar en interesantes proyectos dentro de Startup en expansión LATAM dedicada a la automatización de procesos IT y negocios.";

            jobOffer2.AddSkillRequired(new SkillRequired(javascript, 5, true));
            jobOffer2.AddSkillRequired(new SkillRequired(react, 3));
            jobOffer2.AddSkillRequired(new SkillRequired(java, 6, true));

            jobOffer2.Language      = "Ingles";
            jobOffer2.LanguageLevel = LanguageLevel.Intermediate;

            jobOffer2.ContractInformation = new ContractCondition()
            {
                StartingFrom   = "Inmediata",
                KindOfContract = "Relación de dependencia",
                WorkingDays    = "Lunes a viernes 9 a 18"
            };

            recruiterService.SaveJobOfferAsync(jobOffer2).Wait();

            //

            var company3 = new Company("ADN Recursos Humanos", "Seleccion de personal");

            companyRepository.UpsertAsync(company3).Wait();

            var jobOffer3 = Task.Run(() => recruiterService.GetNewJobOffer(recruiter.Id)).Result;

            jobOffer3.Date      = DateTime.Now.Date;
            jobOffer3.Title     = "Sr. C# Backend Developer/Engineer";
            jobOffer3.CompanyId = company3.Id;
            jobOffer3.Zone      = "Microcentro";

            jobOffer3.Description = "ADN - Recursos Humanos estamos en la búsqueda de un Sr. Python Backend Developer/Engineer, para Importante Empresa de Tecnología";

            jobOffer3.AddSkillRequired(new SkillRequired(cSharp, 5));
            jobOffer3.AddSkillRequired(new SkillRequired(javascript, 2, true));

            jobOffer3.ContractInformation = new ContractCondition()
            {
                StartingFrom   = "Inmediata",
                KindOfContract = "Relación de dependencia",
                WorkingDays    = "Lunes a viernes 9 a 18"
            };

            recruiterService.SaveJobOfferAsync(jobOffer3).Wait();


            recruiterService.PublishJobOffer(jobOffer2).Wait();
            recruiterService.PublishJobOffer(jobOffer3).Wait();
            recruiterService.FinishJobOffer(jobOffer3).Wait();

            var pRepo = new RecruiterRepository(database);
            var aRepo = new AccountRepository(database);

            var person = pRepo.GetByIdentityCardAsync("28.999.999").Result;

            var account = new Account()
            {
                Id = Guid.NewGuid().ToString(), PersonId = person.Id, Email = "*****@*****.**", Password = "******", IsRecruiter = true
            };

            aRepo.UpsertAsync(account).Wait();

            Console.WriteLine("Agregado correctamente!");
            Console.ReadKey();
        }