public async Task EnviarPropuestaAsync(int idRequisicion, List <Attachment> attachments) { var specification = new RequisicionDetalleSpecification(idRequisicion); var requisicion = await this.requisionCandidatoRepository.Single(specification).ConfigureAwait(false); if (requisicion != null) { var propuesta = requisicion.Propuestas.OrderByDescending(p => p.Created) .ThenByDescending(p => p.FechaEnvioPropuesta).ThenByDescending(p => p.FechaContestacion) .FirstOrDefault(p => !p.FechaEnvioPropuesta.HasValue && !p.FechaContestacion.HasValue); if (propuesta == null) { propuesta = new RequisicionPropuesta { FechaEnvioPropuesta = DateTime.Now }; requisicion.Propuestas.Add(propuesta); } else { propuesta.FechaEnvioPropuesta = DateTime.Now; } await this.requisionCandidatoRepository.UpdateAsync(requisicion).ConfigureAwait(false); var candidato = await this.candidatoService.GetCandidatoIdoneoAsync(idRequisicion) .ConfigureAwait(false); candidato = this.candidatoService.Single(new CandidatoSpecification(candidato.Id)); await this.NotificarOfertaEconomica(candidato, attachments).ConfigureAwait(false); } }
public async Task ContestarPropuestaAsync(int idRequisicion, bool aceptaPropuesta, string comentario) { var specification = new RequisicionDetalleSpecification(idRequisicion); var requisicion = await this.requisionCandidatoRepository.Single(specification).ConfigureAwait(false); if (requisicion != null) { var propuesta = requisicion.Propuestas.OrderByDescending(p => p.FechaEnvioPropuesta) .ThenByDescending(p => p.FechaContestacion).FirstOrDefault( p => p.FechaEnvioPropuesta.HasValue && !p.FechaContestacion.HasValue); if (propuesta != null) { propuesta.PropuestaAceptada = aceptaPropuesta; propuesta.Comentarios = comentario; propuesta.FechaContestacion = DateTime.Now; } if (!aceptaPropuesta) { requisicion.Propuestas.Add(new RequisicionPropuesta()); } await this.requisionCandidatoRepository.UpdateAsync(requisicion).ConfigureAwait(false); await this.SetRequisicionContestacionCandidato(requisicion, aceptaPropuesta).ConfigureAwait(false); } }
public async Task NotificarAltaAsync(int idRequisicion) { var specification = new RequisicionDetalleSpecification(idRequisicion); var requisicionDetalle = await this.requisionCandidatoRepository.Single(specification) .ConfigureAwait(false); if (requisicionDetalle != null) { requisicionDetalle.FechaNotificacionAlta = DateTime.Now; var candidato = await this.candidatoService.GetCandidatoIdoneoAsync(requisicionDetalle.RequisicionId) .ConfigureAwait(false); await this.requisionCandidatoRepository.UpdateAsync(requisicionDetalle).ConfigureAwait(false); await this.NotificarAlta(requisicionDetalle.RequisicionId, candidato).ConfigureAwait(false); } }
public async Task EstablecerFechaIngresoAsync(int idRequisicion, DateTime fechaIngreso) { var specification = new RequisicionDetalleSpecification(idRequisicion); var requisicion = await this.requisionCandidatoRepository.Single(specification).ConfigureAwait(false); if (requisicion != null) { requisicion.FechaIngreso = fechaIngreso; await this.requisionCandidatoRepository.UpdateAsync(requisicion).ConfigureAwait(false); var candidato = await this.candidatoService.GetCandidatoIdoneoAsync(idRequisicion) .ConfigureAwait(false); await this.NotificarAsync(candidato, ETipoEvento.NotificarCandidatoFechaIngreso, requisicion) .ConfigureAwait(false); } }
public async Task ConfirmarAlta(int idRequisicion, List <Attachment> attachments) { var specification = new RequisicionDetalleSpecification(idRequisicion); var requisicionDetalle = await this.requisionCandidatoRepository.Single(specification) .ConfigureAwait(false); if (requisicionDetalle != null) { requisicionDetalle.FechaConfirmacionAlta = DateTime.Now; // await this.NotificaConfirmacionAlta(requisicionDetalle.RequisicionId) // .ConfigureAwait(false); await this.NotificaCandidatoAlta(requisicionDetalle.RequisicionId, attachments).ConfigureAwait(false); var candidato = await this.candidatoService.GetCandidatoIdoneoAsync(idRequisicion) .ConfigureAwait(false); candidato.CandidatoDetalle.StatusSeleccion = EEstadoCandidato.Colaborador; candidato.CandidatoDetalle.RequisicionId = idRequisicion; await this.requisionCandidatoRepository.UpdateAsync(requisicionDetalle).ConfigureAwait(false); } }
public async Task <List <Ternas> > GetTernasByRequisicionAsync(int idRequisicion) { var specification = new RequisicionDetalleSpecification(idRequisicion); var result = await this.requisionCandidatoRepository.ListAsync(specification).ConfigureAwait(false); var ternas = new List <Ternas>(); foreach (var detalle in result) { if (detalle?.Ternas == null) { continue; } foreach (var terna in detalle.Ternas) { terna.RequisicionDetalle.Requisicion.PuestoSolicitado = detalle.Requisicion.PuestoSolicitado; } ternas.AddRange(detalle.Ternas); } return(ternas); }