Beispiel #1
0
        private OtherInfoRowModel CalculateOtherInfoFlags(OtherInfoRowModel model)
        {
            var responseExistenteRecruiting = _candidatoService.CheckCandidatoEnRecruiting(model.Nombre, model.Email, model.Telefono, model.NIF);

            if (responseExistenteRecruiting.IsValid)
            {
                if (!responseExistenteRecruiting.ExistenteEnRecruiting)
                {
                    model.Visualizable = true;
                }
                else
                {
                    model.ExistenteRecruiting = responseExistenteRecruiting.ExistenteEnRecruiting;
                    var responseEnProcesoRecruiting = _candidaturaService.CheckEnProceso((int)responseExistenteRecruiting.CandidatoId);
                    if (responseEnProcesoRecruiting.IsValid)
                    {
                        if (responseEnProcesoRecruiting.EnProceso)
                        {
                            model.EnProceso    = responseEnProcesoRecruiting.EnProceso;
                            model.Contratado   = responseEnProcesoRecruiting.Contratado;
                            model.Visualizable = false;
                        }
                        else
                        {
                            var responseDescarteSeisMeses = _candidaturaService.CheckDescarteMenosSeisMeses((int)responseExistenteRecruiting.CandidatoId);
                            if (responseDescarteSeisMeses.IsValid)
                            {
                                if (!responseDescarteSeisMeses.DescarteMenosSeisMeses)
                                {
                                    model.Visualizable = true;
                                }
                                else
                                {
                                    model.DescarteRenunciaMenosSeisMeses = responseDescarteSeisMeses.DescarteMenosSeisMeses;
                                    var responseNoMotivadoCambioEmpresaResponse = _candidaturaService.CheckNoMotivadoCambioEmpresa((int)responseExistenteRecruiting.CandidatoId);
                                    if (responseNoMotivadoCambioEmpresaResponse.IsValid)
                                    {
                                        if (responseNoMotivadoCambioEmpresaResponse.NoMotivadoCambioEmpresa)
                                        {
                                            model.NoMotivadoCambioEmpresa = responseNoMotivadoCambioEmpresaResponse.NoMotivadoCambioEmpresa;
                                            model.Visualizable            = true;
                                        }
                                        else
                                        {
                                            model.Visualizable = false;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(model);
        }
        private CrearCandidaturaOtherInfoResponse CheckAndCreateCandidatura(ContactarCandidatoModel model, int candidatoId)
        {
            var response          = new CrearCandidaturaOtherInfoResponse();
            var responseEnProceso = _candidaturaService.CheckEnProceso(candidatoId);

            DatosCandidaturaOtherInfoViewModel datosCandidaturaOtherInfo = new DatosCandidaturaOtherInfoViewModel()
            {
                CandidatoId              = candidatoId,
                CategoriaId              = model.CategoriaId,
                TecnologiaId             = model.TecnologiaId,
                ModuloId                 = model.ModuloId,
                OrigenCvId               = (int)OrigenCvEnum.BusquedaActiva,
                FuenteReclutamientoId    = (int)FuenteReclutamientoEnum.Infojobs,
                UsuarioCreacionOtherInfo = model.UsuarioCreacionOtherInfo
            };

            if (responseEnProceso.IsValid)
            {
                if (responseEnProceso.EnProceso)
                {
                    response.IsValid      = false;
                    response.ErrorMessage = "Ya existe una candidatura en proceso";
                }
                else
                {
                    var responseCreateCandidatura = _candidaturaService.CrearCandidaturaOtherInfo(datosCandidaturaOtherInfo);
                    if (responseCreateCandidatura.IsValid)
                    {
                        response.IsValid = true;
                    }
                    else
                    {
                        response.IsValid      = false;
                        response.ErrorMessage = responseCreateCandidatura.ErrorMessage;
                    }
                }
            }
            else
            {
                response.IsValid      = false;
                response.ErrorMessage = responseEnProceso.ErrorMessage;
            }

            return(response);
        }