コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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));
        }
コード例 #5
0
 Task <bool> ICandidatoService.NotificarAsync(int idCandidato, ETipoEvento tipoEvento)
 {
     throw new NotImplementedException();
 }
コード例 #6
0
ファイル: Main.cs プロジェクト: kevindrums92/softfuel
 public MonitoreoEventArgs(string s, ETipoEvento t, int idXbee, string cara,string dispositivo = "") 
 {
     Texto = s; TipoEvento = t; IdXbee = idXbee; Cara = cara;
     this.Dispositivo = dispositivo;
 }
コード例 #7
0
 public NotificacionCorreosSpecification(ETipoEvento tipoEvento)
     : base(a => a.Evento == tipoEvento)
 {
 }