public SearchOfertaUsadaResponse SearchOfertaUsada(int ofertaId) { var response = new SearchOfertaUsadaResponse(); try { var candidaturaUsandoOferta = _candidaturaRepository.Find(x => x.IsActivo && x.CandidaturaOfertaId == ofertaId); if (candidaturaUsandoOferta == null) { response.Usada = false; } else { response.Usada = true; } response.IsValid = true; } catch (Exception ex) { response.IsValid = false; response.ErrorMessage = ex.Message; } return(response); }
public SearchCandidatoUsadoResponse SearchCandidatoUsado(int candidatoId) { var response = new SearchCandidatoUsadoResponse(); try { var candidaturaConCandidato = _candidaturaRepository.Find(x => x.IsActivo && x.CandidatoId == candidatoId); var becaConCandidato = _becarioRepository.Find(x => x.IsActivo && x.CandidatoId == candidatoId); if (candidaturaConCandidato == null && becaConCandidato == null) { response.Usado = false; } else { response.Usado = true; } response.IsValid = true; } catch (Exception ex) { response.IsValid = false; response.ErrorMessage = ex.Message; } return(response); }
public GetBecariosResponse GetBecarios(DataTableRequest request) { var response = new GetBecariosResponse(); try { //establecer los filtros var query = FilterString(request.CustomFilters); var filtered = query.ApplyColumnSettings(request, BecarioMapper.GetPropertiePath); response.BecarioRowViewModel = filtered.ConvertToBecarioRowViewModel(); if (response.BecarioRowViewModel != null) { foreach (var becarioRow in response.BecarioRowViewModel) { var candidaturaExistente = _candidaturaRepository.Find(x => x.CandidatoId == becarioRow.CandidatoId && x.IsActivo && x.EstadoCandidaturaId != (int)TipoEstadoCandidaturaEnum.Descartado && x.EstadoCandidaturaId != (int)TipoEstadoCandidaturaEnum.Recontactado && x.EstadoCandidaturaId != (int)TipoEstadoCandidaturaEnum.Renuncia && x.EstadoCandidaturaId != (int)TipoEstadoCandidaturaEnum.RechazaOferta); if (candidaturaExistente == null) { becarioRow.ExisteCandidatura = false; } else { becarioRow.ExisteCandidatura = true; } } } response.TotalElementos = query.Count(); response.IsValid = true; } catch (Exception ex) { response.IsValid = false; response.ErrorMessage = ex.Message; } return(response); }