private async Task NotificaConfirmacionAlta(int idRequisicion) { var requisicion = await this.repository.Single(new RequisicionSpecification(idRequisicion)) .ConfigureAwait(false); var candidato = await this.candidatoService.GetCandidatoIdoneoAsync(idRequisicion).ConfigureAwait(false); candidato = this.candidatoService.Single(new CandidatoSpecification(candidato.Id)); var notificar = new NotificacionViewModel { ToMail = new List <string> { candidato.CandidatoUser.Email }, TipoEvento = ETipoEvento.NotificarConfirmacionAlta, Item = new { requisicion, candidato }, Body = string.Empty }; var service = this.notificarService; if (service != null) { await service.NotificarAsync(notificar).ConfigureAwait(false); } }
private async Task SendNotificacion(int idRequisicion, Candidato candidato, User userToSend) { var notificar = new NotificacionViewModel { ToMail = new List <string> { userToSend.Mail }, TipoEvento = ETipoEvento.NotificarSeleccionCandidato, Item = new { idRequisicion, user = userToSend, candidato, fecha = DateTime.Now }, Body = string.Empty }; var service = this.notificarService; if (service != null) { await service.NotificarAsync(notificar).ConfigureAwait(false); } }
public JsonResult Guardar(NotificacionViewModel model) { Notificacion notificacion = new Notificacion(); var rm = new ResponseModel(); if (ModelState.IsValid) { var tokenUser = (from c in db.CTE_CUENTA_USUARIO where c.CuentaUsuarioId == model.CuentaUsuarioId && c.BLOQUEADO == false select c.FCM_TOKEN ).FirstOrDefault(); if (tokenUser != null) { rm = notificacion.enviarFirebase(model.TITULO, model.CUERPO_NOTIFICACION, tokenUser); if (rm.response) { model.Guardar(model); // rm.function= "closeModalCreate()"; rm.href = Url.Content("~/Admin/Notificaciones/Index"); } } else { rm.SetResponse(false, "No se encontro el Usuario"); } } return(Json(rm)); }
private async Task NotificarPropuestaCargada(int idRequisicion) { var requisicion = await this.repository.Single(new RequisicionSpecification(idRequisicion)) .ConfigureAwait(false); var candidato = await this.candidatoService.GetCandidatoIdoneoAsync(requisicion.Id).ConfigureAwait(false); var listUsuario = new List <User>(); var _user = await this.userService.GetUserByUserNameAsync(requisicion.UserAsignado); listUsuario.Add(_user); var notificar = new NotificacionViewModel { ToMail = listUsuario.Select(u => u.Mail).ToList(), TipoEvento = ETipoEvento.NotificarCargaPropuesta, Item = new { candidato, requisicion, user = listUsuario }, Body = string.Empty }; var service = this.notificarService; if (service != null) { await service.NotificarAsync(notificar).ConfigureAwait(false); } }
private async Task NotificarOfertaEconomica(Candidato candidato, List <Attachment> attachments) { // Obtener los archivos a adjuntar. // Adjuntar los archivos. if (string.IsNullOrEmpty(candidato?.CandidatoUser?.Email)) { throw new Exception("Candidato debe de contar con correo electronico"); } var notificar = new NotificacionViewModel { ToMail = new List <string> { candidato.CandidatoUser.Email }, TipoEvento = ETipoEvento.EnviarOferta, Item = new { candidato }, Body = string.Empty, Attachments = attachments }; var service = this.notificarService; if (service != null) { await service.NotificarAsync(notificar).ConfigureAwait(false); } }
private async Task NotificarAsignacion(int idRequisicion, string colaboradorUserName) { var colaborador = await this.userService.GetUserByUserNameAsync(colaboradorUserName).ConfigureAwait(false); var notificar = new NotificacionViewModel { ToMail = new List <string> { colaborador.Mail }, TipoEvento = ETipoEvento.NotificarAsignacion, Item = new { idRequisicion, user = colaborador, fecha = DateTime.Now }, Body = string.Empty }; var service = this.notificarService; if (service != null) { await service.NotificarAsync(notificar).ConfigureAwait(false); } }
public JsonResult guardarMasivo(NotificacionViewModel model) { var rm = new ResponseModel(); CTE_NOTIFICACION_GRUPO cTE_NOTIFICACION_GRUPO = new CTE_NOTIFICACION_GRUPO(); try { if (ModelState.IsValid) { var grupo = (from c in db.CTE_NOTIFICACION_GRUPO where c.ID == model.GRUPO select c.NOMBRE ).FirstOrDefault(); var data = cTE_NOTIFICACION_GRUPO.ListarEstadisticas(grupo); if ((data != null) && (data.Count != 0)) { foreach (var obj in data) { var tokenUser = (from c in db.CTE_CUENTA_USUARIO where c.CuentaUsuarioId == obj.IDCLIENTE && c.BLOQUEADO == false select c.FCM_TOKEN ).FirstOrDefault(); if (tokenUser != null) { rm = notificacion.enviarFirebase(model.TITULO, model.CUERPO_NOTIFICACION, tokenUser); if (rm.response) { model.CuentaUsuarioId = obj.IDCLIENTE; model.Guardar(model); rm.function = "cleanForm()"; } } } rm.SetResponse(true, "Notificaciones Enviadas!"); } else { rm.SetResponse(false, "No existen registros para ser enviados"); } } else { rm.SetResponse(false, "El formulario esta incorrecto"); } } catch (Exception ex) { rm.SetResponse(false, ex.Message); } return(Json(rm)); }
// GET: Registrado/Create public ActionResult Create() { NotificacionViewModel noti = new NotificacionViewModel(); NotificacionGenericaCEN notificacionGenerica = new NotificacionGenericaCEN(); IList <NotificacionGenericaEN> listaNotificacionGenerica = notificacionGenerica.ReadAll(0, -1); ViewData["listaNotificacionGenerica"] = listaNotificacionGenerica; return(View(noti)); }
// GET: Registrado/Edit/5 public ActionResult Edit(int id) { NotificacionViewModel noti = null; SessionInitialize(); NotificacionEN notiEN = new NotificacionCAD(session).ReadOIDDefault(id); noti = new AssemblerNotificacion().ConvertENToModelUI(notiEN); SessionClose(); return(View(noti)); }
public ActionResult Delete(NotificacionViewModel noti) { try { // TODO: Add delete logic here new NotificacionCEN().Destroy(noti.Id); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(NotificacionViewModel noti) { try { // TODO: Add update logic here NotificacionCEN cen = new NotificacionCEN(); cen.Modify(noti.Id, noti.Contenido, noti.Fecha, noti.Enviada); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(NotificacionViewModel noti) { try { // TODO: Add insert logic here NotificacionCEN cen = new NotificacionCEN(); cen.New_(noti.Contenido, noti.NotificacionGenerica, noti.Fecha, noti.Enviada); return(RedirectToAction("Index")); } catch { return(View()); } }
public async Task NotificarExpedienteToRH(int idCandidato) { var expedienteCandidato = await this.candidatoExpedienteRepository.Single(new CandidatoExpedienteSpecification(idCandidato)); var email = expedienteCandidato.CandidatoDetalle.Candidato.CandidatoUser.Email; expedienteCandidato.FechaNotificacion = DateTime.Now; expedienteCandidato.CorregirExpediente = false; await this.candidatoExpedienteRepository.UpdateAsync(expedienteCandidato); var administradoresExpediente = this.configuracionGlobal.Configuration <string>( "UsersAdministradorExpediente") .Split(';'); var colaboradores = administradoresExpediente.Select( a => { return(this.userService.GetUserByUserNameAsync(a) .Result); }) .ToList(); var notificar = new NotificacionViewModel { ToMail = colaboradores.Select(x => x.Mail.ToString()) .ToList(), TipoEvento = ETipoEvento.NotificarRHCargaExpediente, Item = new { expedienteCandidato.CandidatoDetalle.Candidato, user = colaboradores, fecha = DateTime.Now }, Body = string.Empty }; var service = this.notificarService; if (service != null) { await service.NotificarAsync(notificar) .ConfigureAwait(false); } }
private async Task <bool> NotificarAsync( int idRequisicion, ValidacionesRequisicionViewModel validated, ValidacionesRequisicionViewModel toValidate, ETipoEvento tipoNotificacion) { User user = null; string toEmail = null; if (toValidate != null) { user = await this.userService.GetUserByUserNameAsync(toValidate.UserName).ConfigureAwait(false); } else { var coordinadorRS = this.configuracionGlobal.Configuration <string>("UserCoordinadorRS"); user = await this.userService.GetUserByUserNameAsync(coordinadorRS).ConfigureAwait(false); if (tipoNotificacion == ETipoEvento.SolicitarAutorizacion) { return(true); } } toEmail = user.Mail; var notificacion = new NotificacionViewModel { ToMail = new List <string> { toEmail }, TipoEvento = tipoNotificacion, Item = new { user, idRequisicion, tipoNotificacion, fecha = DateTime.Now, comentario = validated?.Description } }; return(await this.notificarService.NotificarAsync(notificacion).ConfigureAwait(false)); }
private async Task NotificarSeguimientoSolicitudAsync( int idRequisicion, string colaboradorToNotify, ETipoEvento tipoEvento) { var colaboradores = new List <User>(); var userNameColaboradores = colaboradorToNotify?.Split(';'); if (userNameColaboradores != null) { foreach (var userNameColaborador in userNameColaboradores) { var colaborador = await this.userService.GetUserByUserNameAsync(userNameColaborador) .ConfigureAwait(false); colaboradores.Add(colaborador); } } if (colaboradores.Any()) { var notificar = new NotificacionViewModel { ToMail = colaboradores.Select(x => x.Mail.ToString()) .ToList(), TipoEvento = tipoEvento, Item = new { idRequisicion, user = colaboradores, fecha = DateTime.Now }, Body = string.Empty }; var service = this.notificarService; if (service != null) { await service.NotificarAsync(notificar) .ConfigureAwait(false); } } }
private async Task NotificarAsync( Candidato candidato, ETipoEvento tipoEvento, RequisicionDetalle requisicion = null) { if (candidato.CandidatoUser == null) { candidato = await this.candidatoService.GetCandidatoByIdAsync(candidato.Id).ConfigureAwait(false); } if (candidato.CandidatoUser == null) { return; } var notificar = new NotificacionViewModel { ToMail = new List <string> { candidato.CandidatoUser.Email }, TipoEvento = tipoEvento, Item = candidato, Body = string.Empty }; if (requisicion == null) { notificar.Item = candidato; } else { notificar.Item = new { candidato, requisicion }; } var service = this.notificarService; if (service != null) { await service.NotificarAsync(notificar).ConfigureAwait(false); } }
public async Task <bool> NotificarAsync(int idCandidato, ETipoEvento tipoEvento) { var candidato = await this.GetCandidatoByIdAsync(idCandidato) .ConfigureAwait(false); if (candidato == null) { return(false); } var notificacion = new NotificacionViewModel { ToMail = new List <string> { candidato.CandidatoUser.Email }, TipoEvento = tipoEvento, Item = candidato }; return(await this.notificarService.NotificarAsync(notificacion) .ConfigureAwait(false)); }
private async Task NotificarTipoBusqueda(int idRequisicion) { var userNameRS = this.configuracionGlobal.Configuration <string>("CoordinadorCulturaTalento"); var userRS = await this.userService.GetUserByUserNameAsync(userNameRS).ConfigureAwait(false); var notificar = new NotificacionViewModel { ToMail = new List <string> { userRS.Mail }, TipoEvento = ETipoEvento.PublicacionInterna, Item = new { idRequisicion, user = userRS }, Body = string.Empty }; var service = this.notificarService; if (service != null) { await service.NotificarAsync(notificar).ConfigureAwait(false); } }
private async Task NotificarPropuestaAceptadaAsync(RequisicionDetalle requisicion) { var candidato = await this.candidatoService.GetCandidatoIdoneoAsync(requisicion.RequisicionId) .ConfigureAwait(false); var listUsuario = new List <User>(); var userNameAdministradorExpediente = this.configuracionGlobal.Configuration <string>("UsersAdministradorExpediente"); foreach (var item in userNameAdministradorExpediente.Split(";")) { var user = await this.userService.GetUserByUserNameAsync(item); listUsuario.Add(user); } var notificar = new NotificacionViewModel { ToMail = listUsuario.Select(u => u.Mail).ToList(), TipoEvento = ETipoEvento.NotificarPropuestaAceptada, Item = new { candidato, requisicion = requisicion.Requisicion, user = listUsuario }, Body = string.Empty }; var service = this.notificarService; if (service != null) { await service.NotificarAsync(notificar).ConfigureAwait(false); } }
// GET: Registrado/Create public ActionResult Create() { NotificacionViewModel noti = new NotificacionViewModel(); return(View(noti)); }
private async Task NotificarAlta(int idRequisicion, Candidato candidato) { var canditoToSend = this.candidatoService.Single(new CandidatoSpecification(candidato.Id)); var requisicion = await this.repository.Single(new RequisicionSpecification(idRequisicion)) .ConfigureAwait(false); var configuraciones = await this.configuracionRepository.ListAllAsync().ConfigureAwait(false); var itemToFind = new List <string> { "UserBussinesPartnerRH", "UserEspecialistaContabilidad", "UserAltaExpense", "UserAltaBeneficiosFlexibles", "UserAsesorRS", "UserAsignacionLugarEstacionamiento", "UserEntregaTarjetaAccesoOficina", "UserEntregaTarjetaAccesoEdificio", "UserEntregaTarjetaBancaria", "UserTI" }; foreach (var keyConfiguracion in itemToFind) { var configuracion = configuraciones.FirstOrDefault(c => c.Key == keyConfiguracion); var usuarios = configuracion.Values.Split(';').ToList(); var listUsuario = new List <User>(); foreach (var usuario in usuarios) { var _user = await this.userService.GetUserByUserNameAsync(usuario); listUsuario.Add(_user); } listUsuario = listUsuario.Where(u => u != null).ToList(); if (!listUsuario.Any()) { continue; } var notificar = new NotificacionViewModel { ToMail = listUsuario.Select(u => u.Mail).ToList(), TipoEvento = ETipoEvento.NotificarAltaColaborador, Item = new { candidato = canditoToSend, requisicion, user = listUsuario, actividades = configuracion.Values2 .Split(';').ToList() }, Body = string.Empty }; var service = this.notificarService; if (service != null) { await service.NotificarAsync(notificar).ConfigureAwait(false); } } }
public async Task <List <Ternas> > SetDateByRequisicionAndEntrevistaAsync( int idRequisicion, int idEntrevista, EntrevistaViewModel entrevista) { var entrevistaToEdit = await this.entrevistaRepository.Single( new EntrevistaSpecification(idRequisicion, idEntrevista)).ConfigureAwait(false); var notificarFechaInicioEntrevista = false; if (entrevistaToEdit.FechaInicioEntrevista == null) { notificarFechaInicioEntrevista = entrevista.FechaInicioEntrevista != null; } if (entrevista != null) { entrevistaToEdit.FechaInicioEntrevista = entrevista.FechaInicioEntrevista; entrevistaToEdit.FechaTerminoEntrevista = entrevista.Recomendable != null ? (DateTime?)DateTime.Now : null; entrevistaToEdit.Comentarios = entrevista.Comentarios; entrevistaToEdit.Fortalezas = entrevista.Fortalezas; entrevistaToEdit.Debilidades = entrevista.Debilidades; entrevistaToEdit.Recomendable = entrevista.Recomendable; if (entrevista.TipoEntrevistaId == EEntrevista.Invitado) { entrevistaToEdit.Entrevistador = entrevista.EntrevistadorUserName; } foreach (var competencia in entrevistaToEdit.Competencias) { var viewCompetencia = entrevista.Competencias.FirstOrDefault(c => c.Id == competencia.Id); if (viewCompetencia != null) { competencia.Resultado = viewCompetencia.Resultado; } } } await this.entrevistaRepository.UpdateAsync(entrevistaToEdit).ConfigureAwait(false); if (notificarFechaInicioEntrevista) { var requisicion = this.requisicionService.Single(new RequisicionSpecification(idRequisicion)); var usernameRS = this.configuration.Configuration <string>("UserCoordinadorRS"); var user = await this.userService.GetUserByUserNameAsync(entrevista.EntrevistadorUserName); var notificar = new NotificacionViewModel { ToMail = new List <string> { user.Mail }, TipoEvento = ETipoEvento.NotificarEntrevistaEntrevistador, Item = new { entrevistador = user, entrevista = entrevistaToEdit, requisicion } }; await this.notificarService.NotificarAsync(notificar).ConfigureAwait(false); user = await this.userService.GetUserByUserNameAsync(requisicion.UserRequeridor); if (user.UserName.ToUpper() != entrevistaToEdit.Entrevistador.ToUpper()) { notificar = new NotificacionViewModel { ToMail = new List <string> { user.Mail }, TipoEvento = ETipoEvento.NotificacionTernaEntrevista, Item = new { entrevistador = user, entrevista = entrevistaToEdit, requisicion } }; await this.notificarService.NotificarAsync(notificar).ConfigureAwait(false); } if (usernameRS.ToUpper() != entrevistaToEdit.Entrevistador.ToUpper()) { var userRS = await this.userService.GetUserByUserNameAsync(usernameRS).ConfigureAwait(false); var notificarRS = new NotificacionViewModel { ToMail = new List <string> { userRS.Mail }, TipoEvento = ETipoEvento.NotificacionRySEntrevista, Item = new { entrevistador = userRS, entrevista = entrevistaToEdit, requisicion } }; await this.notificarService.NotificarAsync(notificarRS).ConfigureAwait(false); } if (entrevistaToEdit?.Candidato?.CandidatoUser?.Email != null) { var notificarCandidato = new NotificacionViewModel { ToMail = new List <string> { entrevistaToEdit.Candidato.CandidatoUser.Email }, TipoEvento = ETipoEvento.NotificacionCandidatoEntrevista, Item = new { entrevistador = user, entrevista = entrevistaToEdit, requisicion } }; await this.notificarService.NotificarAsync(notificarCandidato).ConfigureAwait(false); } } return(await this.GetEntrevistasByRequisicionAsync(idRequisicion).ConfigureAwait(false)); }