public static RespuestaTransaccion ActualizarTipoNotificacion(TipoNotificacion tipoNotificacion)
        {
            try
            {
                // Por si queda el Attach de la entidad y no deja actualizar
                var local = db.TipoNotificacion.FirstOrDefault(f => f.IdNotificacion == tipoNotificacion.IdNotificacion);
                if (local != null)
                {
                    db.Entry(local).State = EntityState.Detached;
                }

                tipoNotificacion.NombreNotificacion = tipoNotificacion.NombreNotificacion.ToUpper();
                db.Entry(tipoNotificacion).State    = EntityState.Modified;
                db.SaveChanges();

                return(new RespuestaTransaccion {
                    Estado = true, Respuesta = Mensajes.MensajeTransaccionExitosa
                });
            }
            catch (Exception ex)
            {
                return(new RespuestaTransaccion {
                    Estado = false, Respuesta = Mensajes.MensajeTransaccionFallida + " ;" + ex.Message.ToString()
                });
            }
        }
Esempio n. 2
0
        private string ObtenerTituloWithTipoNotificacion(TipoNotificacion tipo)
        {
            switch (tipo)
            {
            case TipoNotificacion.General: return("Nuevas novedades..");

            case TipoNotificacion.SolicitudNueva: return("Nueva solicitud Yaigo.");

            case TipoNotificacion.SolicitudAceptadoPorConductor: return("Solicitud aceptada por conductor.");

            case TipoNotificacion.SolicitudAceptadoPorComercio: return("Solicitud aceptada por comercio.");

            case TipoNotificacion.SolicitudCanceladaPorComercio: return("Solicitud cancelada por conductor.");

            case TipoNotificacion.OrdenLista: return("Orden lista.");

            case TipoNotificacion.OrdenEnCamino: return("La orden esta en camino.");

            case TipoNotificacion.OrdenEnDestino: return("La orden ha llegado al destino.");

            case TipoNotificacion.OrdenEntragada: return("La orden ha sido entregada al conductor.");

            case TipoNotificacion.OrdenEntragadacliente: return("La orden ha sido entregada al cliente.");

            case TipoNotificacion.PedidoCalificacion: return("Calificación del servicio.");

            case TipoNotificacion.SolicitudRechazadaPorComercio: return("Solicitud Rechazada por Comercio");

            default: return("YAIGO");
            }
        }
Esempio n. 3
0
        public ActionResult Create(TipoNotificacion tipoNotificacion)
        {
            try
            {
                string nombreTipoNotificacion = (tipoNotificacion.NombreNotificacion ?? string.Empty).ToLower().Trim();

                var tarifariosIguales = TipoNotificacionDAL.ListarTipoNotificaciones().Where(s => (s.NombreNotificacion ?? string.Empty).ToLower().Trim() == nombreTipoNotificacion).ToList();

                if (tarifariosIguales.Count > 0)
                {
                    return(Json(new { Resultado = new RespuestaTransaccion {
                                          Estado = false, Respuesta = Mensajes.MensajeValidacionNombreTarifario
                                      } }, JsonRequestBehavior.AllowGet));
                }

                RespuestaTransaccion resultado = TipoNotificacionDAL.CrearTipoNotificacion(tipoNotificacion);

                return(Json(new { Resultado = resultado }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { Resultado = new RespuestaTransaccion {
                                      Estado = false, Respuesta = ex.Message
                                  } }, JsonRequestBehavior.AllowGet));
            }
        }
 public static TipoNotificacion ConsultarNotificacion(int id)
 {
     try
     {
         TipoNotificacion tipoNotificacion = db.ConsultarTipoNotificacion(id).FirstOrDefault() ?? new TipoNotificacion();
         return(tipoNotificacion);
     }
     catch (Exception ex)
     {
         return(new TipoNotificacion());
     }
 }
Esempio n. 5
0
 public Notificacion(int funcionarioID, TipoNotificacion tipoNotificacion, string cabecera, string mensaje,
                     bool procesado, bool leido)
 {
     ID                = Guid.NewGuid();
     FuncionarioID     = funcionarioID;
     TipoNotificacion  = tipoNotificacion;
     Cabecera          = cabecera;
     Mensaje           = mensaje;
     Procesado         = procesado;
     Leido             = leido;
     FechaCreacion     = DateTime.Now;
     FechaModificacion = DateTime.Now;
 }
Esempio n. 6
0
        public List<Notificacion> AgregarNotificacion(TipoNotificacion tipo, List<string> mensajes, string titulo = null)
        {
            if (ListaNotificaciones == null) ListaNotificaciones = new List<Notificacion>();
            if (Mensajes == null) Mensajes = new List<string>();

            Tipo = tipo;
            Titulo = titulo;

            Mensajes.AddRange(mensajes);

            ListaNotificaciones.Add(new Notificacion { Mensajes = Mensajes, Tipo = Tipo, Titulo = Titulo });

            return ListaNotificaciones;
        }
Esempio n. 7
0
 public static Notificacion Load(Guid id, int funcionarioID, TipoNotificacion tipoNotificacion, string cabecera, string mensaje,
                                 bool procesado, bool leido, DateTime fechaCreacion, DateTime fechaModificacion)
 {
     return(new Notificacion
     {
         ID = id,
         FuncionarioID = funcionarioID,
         TipoNotificacion = tipoNotificacion,
         Cabecera = cabecera,
         Mensaje = mensaje,
         Procesado = procesado,
         Leido = leido,
         FechaCreacion = fechaCreacion,
         FechaModificacion = fechaModificacion,
     });
 }
        public Notificacion(string mensaje, TipoNotificacion tipo, int id, string form)
        {
            InitializeComponent();
            lblMensaje.Text = mensaje;
            notificacionId  = id;
            formAEjecutar   = form;
            if (tipo == TipoNotificacion.Error)
            {
                BackColor = Color.FromArgb(178, 34, 34);
                notifyIcon1.BalloonTipIcon = ToolTipIcon.Error;
            }
            else if (tipo == TipoNotificacion.Success)
            {
                BackColor = Color.FromArgb(50, 205, 50);
                notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
            }
            else if (tipo == TipoNotificacion.Excel || tipo == TipoNotificacion.DGII)
            {
                BackColor = Color.FromArgb(0, 100, 0);
                notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
            }
            else if (tipo == TipoNotificacion.Warning)
            {
                BackColor = Color.FromArgb(255, 215, 0);
                notifyIcon1.BalloonTipIcon = ToolTipIcon.Warning;
            }
            else
            {
                BackColor = Color.FromArgb(30, 144, 255);
                notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
            }

            if (mensaje.Length <= 37)
            {
                Size = new Size(Size.Width, 133);
            }
            else if (mensaje.Length <= 65)
            {
                Size = new Size(Size.Width, 153);
            }

            notifyIcon1.BalloonTipText = mensaje;
            notifyIcon1.Visible        = true;
            notifyIcon1.ShowBalloonTip(100);
            pnBottom.Visible = (tipo != TipoNotificacion.Help);
        }
        public static RespuestaTransaccion CrearTipoNotificacion(TipoNotificacion tipoNotificacion)
        {
            try
            {
                tipoNotificacion.NombreNotificacion = tipoNotificacion.NombreNotificacion.ToUpper();
                tipoNotificacion.EstadoNotificacion = true;
                db.TipoNotificacion.Add(tipoNotificacion);
                db.SaveChanges();

                return(new RespuestaTransaccion {
                    Estado = true, Respuesta = Mensajes.MensajeTransaccionExitosa
                });
            }
            catch (Exception ex)
            {
                return(new RespuestaTransaccion {
                    Estado = false, Respuesta = Mensajes.MensajeTransaccionFallida + " ;" + ex.Message.ToString()
                });
            }
        }
Esempio n. 10
0
//public void CreateNotificationPushs(MultigymEntities1 esquema, TipoNotificacion tipo, long contenidoId, string contenido, List<long> usuariosIds = null, string titulo = "")
        //{
        //    // Generar las notificaciones push
        //    Notificacion notificacion = new Notificacion();
        //    notificacion.FechaHora = Now1;
        //    notificacion.ContenidoId = contenidoId;
        //    notificacion.Texto = contenido;
        //    notificacion.Tipo = (int)tipo;

        //    var notificaciones = new List<NotificacionPush.Entidades.Notificacion>();
        //    usuariosIds = usuariosIds.Distinct().ToList();

        //    var dispositivos = (from x in esquema.MG_Persona
        //                        where usuariosIds.Contains(x.Id)
        //                        && x.Activo == true
        //                        && x.dispositivoId != null
        //                        && x.DispositivoMovil.Estado == 1
        //                        select new
        //                        {
        //                            PushId = x.DispositivoMovil.PushId,
        //                            TipoOS = x.DispositivoMovil.TipoOS,
        //                            TipoApp = x.DispositivoMovil.TipoAplicacion
        //                        }).ToList();
        //    foreach (var x in dispositivos)
        //    {
        //        NotificacionPush.Entidades.Notificacion notipush = new NotificacionPush.Entidades.Notificacion(contenidoId, x.TipoOS, x.PushId, 0, x.TipoApp);
        //        notificaciones.Add(notipush);
        //    }

        //    NotificacionPsh.EnviarNotificacion(string.IsNullOrEmpty(titulo) ? ObtenerTituloWithTipoNotificacion(tipo) : titulo, contenido, "", (int)tipo + "", notificaciones);
        //}
        public void CreateNotificationPushsprueba(string imei, int tipo_app, string pushid, TipoNotificacion tipo, string contenido, string titulo = "")
        {
            // Generar las notificaciones push
            Notificacion notificacion = new Notificacion();

            notificacion.FechaHora   = Now1;
            notificacion.ContenidoId = 0;
            notificacion.Texto       = contenido;
            notificacion.Tipo        = (int)tipo;

            var notificaciones = new List <NotificacionPush.Entidades.Notificacion>();

            NotificacionPush.Entidades.Notificacion notipush = new NotificacionPush.Entidades.Notificacion(0, "Android", pushid, 0, tipo_app);
            notificaciones.Add(notipush);


            NotificacionPsh.EnviarNotificacion(string.IsNullOrEmpty(titulo) ? ObtenerTituloWithTipoNotificacion(tipo) : titulo, contenido, "", (int)tipo + "", notificaciones);
        }
Esempio n. 11
0
 public Notificacion(TipoNotificacion tipo, MensajeSms mensaje)
 {
     Tipo         = tipo;
     TextoMensaje = JsonConvert.SerializeObject(mensaje);
 }
Esempio n. 12
0
 public Notificacion(TipoNotificacion tipo, string mensaje)
 {
     Tipo         = tipo;
     TextoMensaje = mensaje;
 }
Esempio n. 13
0
        public void SendNotificationEmailTask(TipoNotificacion tipoNotificacion, TipoComentario tipoComentario, TipoPQRS tipoPQRS, int RecordId, int Order, int DataId, int CommentId, string UsuarioNombre, string AppLink)
        {
            var formato = new Formato();

            try
            {
                formato = db.Recruitments.Include(d => d.UsuarioCreacion).Include(d => d.Analista).Where(d => d.RecruitmentId == DataId)
                          .Select(d => new Formato {
                    TipoPQRS       = tipoPQRS,
                    Id             = d.RecruitmentId,
                    AnalistaId     = (d.Analista == null) ? "" : d.Analista.UsuarioNombre,
                    AnalistaCorreo = (d.Analista == null) ? "" : d.Analista.UsuarioCorreo,
                    NroTracking    = (d.NroTracking == null) ? "" : d.NroTracking
                }).FirstOrDefault();

                List <Mails> mails = new List <Mails>();

                string subject = "AIS - ";
                subject += $"[{formato.NroTracking}]: {formato.Asunto}  ({tipoNotificacion.ToString()})";
                string msg    = $"The user <b>{UsuarioNombre}</b> ";
                string action = "Details";


                bool flagDestinatarios = false;
                //Primer paso ( se crear el ticket de PQRS)
                if (tipoNotificacion == TipoNotificacion.CreateFormat)
                {
                    msg += $"has created a new Recruitment({formato.TipoPQRS.ToString()})";
                    msg += $"<br /><br /><b>PQRS Information</b><br /><br />";
                    msg += $"<b>Testecorreo</b>: {formato.AnalistaCorreo}<br />";
                    msg += $"<b>Testeanalista</b>: {formato.AnalistaId}<br />";
                    msg += $"<b>Traking</b>: {formato.NroTracking}<br />";
                    msg += $"<b>Recruitment</b>: {formato.Id}<br />";
                    flagDestinatarios = true;
                }
                else if (tipoNotificacion == TipoNotificacion.Assign)
                {
                    /* msg += $"has assigned a new CS analyst ({formato.AnalistaId})";
                     * msg += $"<br /><br /><b>PQRS Information</b><br /><br />";
                     * msg += $"<b>Date</b>: {formato.FechaCreacion}<br />";
                     * msg += $"<b>Priority</b>: {formato.Prioridad.ToString()}<br />";
                     * msg += $"<b>Note</b>: {formato.Observacion}<br />";
                     * var step = db.PQRSRecords.Where(r => r.Id == RecordId && r.Order == Order).FirstOrDefault();
                     * msg += $"<b>Reason</b>: {step.MotivoPQRSNombre}<br />";
                     * var comment = db.PQRSRecordComentarios.Where(c => c.Id == CommentId).FirstOrDefault();
                     * msg += $"<b>Date Comment</b>: {comment.FechaCreacion}<br />";
                     * msg += $"<b>Comment</b>: {comment.Comentario}<br />";
                     * flagDestinatarios = step.EnviaCorreoDestinatarios ?? false;*/

                    msg += $"has created a new Recruitment({formato.TipoPQRS.ToString()})";
                    msg += $"<br /><br /><b>PQRS Information</b><br /><br />";
                    msg += $"<b>Testecorreo</b>: {formato.AnalistaCorreo}<br />";
                    msg += $"<b>Testeanalista</b>: {formato.AnalistaId}<br />";
                    msg += $"<b>Traking</b>: {formato.NroTracking}<br />";
                    msg += $"<b>Recruitment</b>: {formato.Id}<br />";
                }
                else if (tipoNotificacion == TipoNotificacion.Comment)
                {
                    /* msg += $"has added a new comment";
                     *
                     * msg += $"<br /><br /><b>PQRS Information</b><br /><br />";
                     * msg += $"<b>Date</b>: {formato.FechaCreacion}<br />";
                     * msg += $"<b>Priority</b>: {formato.Prioridad.ToString()}<br />";
                     * msg += $"<b>Note</b>: {formato.Observacion}<br />";
                     *
                     * var comment = db.PQRSRecordComentarios.Where(c => c.Id == CommentId).FirstOrDefault();
                     * msg += $"<b>Date Comment</b>: {comment.FechaCreacion}<br />";
                     * msg += $"<b>Comment</b>: {comment.Comentario}<br />";*/

                    msg += $"has created a new Recruitment({formato.TipoPQRS.ToString()})";
                    msg += $"<br /><br /><b>PQRS Information</b><br /><br />";
                    msg += $"<b>Testecorreo</b>: {formato.AnalistaCorreo}<br />";
                    msg += $"<b>Testeanalista</b>: {formato.AnalistaId}<br />";
                    msg += $"<b>Traking</b>: {formato.NroTracking}<br />";
                    msg += $"<b>Recruitment</b>: {formato.Id}<br />";
                }
                else if (tipoNotificacion == TipoNotificacion.CurrentStep)
                {
                    msg += $"has created a new Recruitment({formato.TipoPQRS.ToString()})";
                    msg += $"<br /><br /><b>PQRS Information</b><br /><br />";
                    msg += $"<b>Testecorreo</b>: {formato.AnalistaCorreo}<br />";
                    msg += $"<b>Testeanalista</b>: {formato.AnalistaId}<br />";
                    msg += $"<b>Traking</b>: {formato.NroTracking}<br />";
                    msg += $"<b>Recruitment</b>: {formato.Id}<br />";

                    /*
                     * var step = db.PQRSRecords.Where(r => r.Id == RecordId && r.Order == Order).FirstOrDefault();
                     * if (tipoComentario == TipoComentario.Approval)
                     * {
                     *  msg += $"has approved <b>Step:</b> {step.FlujoPQRSNombre} <b>Reason PQRS:</b> {step.MotivoPQRSNombre}";
                     * }
                     * else if (tipoComentario == TipoComentario.Rejection)
                     * {
                     *  msg += $"has rejected <b>Step:</b> {step.FlujoPQRSNombre} <b>Reason PQRS:</b> {step.MotivoPQRSNombre}";
                     * }
                     *
                     *
                     * msg += $"<br /><br /><b>PQRS Information</b><br /><br />";
                     * msg += $"<b>Date</b>: {formato.FechaCreacion}<br />";
                     * msg += $"<b>Priority</b>: {formato.Prioridad.ToString()}<br />";
                     * msg += $"<b>Note</b>: {formato.Observacion}<br />";
                     * msg += $"<b>Reason</b>: {step.MotivoPQRSNombre}<br />";
                     * var comment = db.PQRSRecordComentarios.Where(c => c.Id == CommentId).FirstOrDefault();
                     * msg += $"<b>Date Comment</b>: {comment.FechaCreacion}<br />";
                     * msg += $"<b>Comment</b>: {comment.Comentario}<br />";
                     * var userStep = db.PQRSRecordUsuarios
                     *                      .Include(ru => ru.Usuario)
                     *                      .Where(ru => ru.PQRSRecordId == RecordId && ru.PQRSRecordOrder == Order).ToList();
                     * foreach (var u in userStep)
                     * {
                     *  mails.Add(new Mails { to = u.Usuario.UsuarioCorreo, toName = u.Usuario.UsuarioNombre });
                     * }
                     * flagDestinatarios = step.EnviaCorreoDestinatarios ?? false;
                     */
                }
                else if (tipoNotificacion == TipoNotificacion.NextStep)
                {
                    msg += $"has created a new Recruitment({formato.TipoPQRS.ToString()})";
                    msg += $"<br /><br /><b>PQRS Information</b><br /><br />";
                    msg += $"<b>Testecorreo</b>: {formato.AnalistaCorreo}<br />";
                    msg += $"<b>Testeanalista</b>: {formato.AnalistaId}<br />";
                    msg += $"<b>Traking</b>: {formato.NroTracking}<br />";
                    msg += $"<b>Recruitment</b>: {formato.Id}<br />";

                    /*
                     * var step = db.PQRSRecords.Where(r => r.Id == RecordId && r.Order == Order).FirstOrDefaultAsync();
                     * msg = $"You have pending an action to do in system, please log in here to continue";
                     * msg += $"<br /><br /><b>PQRS Information</b><br /><br />";
                     * msg += $"<b>Date</b>: {formato.FechaCreacion}<br />";
                     * msg += $"<b>Priority</b>: {formato.Prioridad.ToString()}<br />";
                     * msg += $"<b>Note</b>: {formato.Observacion}<br />";
                     *
                     * var userStep = db.PQRSRecordUsuarios
                     *                      .Include(ru => ru.Usuario)
                     *                      .Where(ru => ru.PQRSRecordId == RecordId && ru.PQRSRecordOrder == Order).ToList();
                     * mails.Clear();
                     * foreach (var u in userStep)
                     * {
                     *  mails.Add(new Mails { to = u.Usuario.UsuarioCorreo, toName = u.Usuario.UsuarioNombre });
                     * }
                     * flagDestinatarios = false;
                     */
                }
                else if (tipoNotificacion == TipoNotificacion.Close)
                {
                    /*
                     * var step = db.PQRSRecords.Where(r => r.Id == RecordId && r.Order == Order).FirstOrDefault();
                     * msg = $"has closed  <b>Reason PQRS:</b> {step.MotivoPQRSNombre}";
                     * var comment = db.PQRSRecordComentarios.Where(c => c.Id == CommentId).FirstOrDefault();
                     * msg += $"<br /><br /><b>PQRS Information</b><br /><br />";
                     * msg += $"<b>Date</b>: {formato.FechaCreacion}<br />";
                     * msg += $"<b>Priority</b>: {formato.Prioridad.ToString()}<br />";
                     * msg += $"<b>Note</b>: {formato.Observacion}<br />";
                     * msg += $"<b>Date Comment</b>: {comment.FechaCreacion}<br />";
                     * msg += $"<b>Comment</b>: {comment.Comentario}<br />";
                     * flagDestinatarios = step.EnviaCorreoDestinatarios ?? false;
                     */
                    msg += $"has created a new Recruitment({formato.TipoPQRS.ToString()})";
                    msg += $"<br /><br /><b>PQRS Information</b><br /><br />";
                    msg += $"<b>Testecorreo</b>: {formato.AnalistaCorreo}<br />";
                    msg += $"<b>Testeanalista</b>: {formato.AnalistaId}<br />";
                    msg += $"<b>Traking</b>: {formato.NroTracking}<br />";
                    msg += $"<b>Recruitment</b>: {formato.Id}<br />";
                }
                else if (tipoNotificacion == TipoNotificacion.Complete)
                {
                    /*
                     * var step = db.PQRSRecords.Where(r => r.Id == RecordId && r.Order == Order).FirstOrDefault();
                     * msg += $"has completed  ";
                     *
                     * msg += $"<br /><br /><b>PQRS Information</b><br /><br />";
                     * msg += $"<b>Date</b>: {formato.FechaCreacion}<br />";
                     * msg += $"<b>Priority</b>: {formato.Prioridad.ToString()}<br />";
                     * msg += $"<b>Note</b>: {formato.Observacion}<br />";
                     *
                     * flagDestinatarios = step.EnviaCorreoDestinatarios ?? false;
                     */
                    msg += $"has created a new Recruitment({formato.TipoPQRS.ToString()})";
                    msg += $"<br /><br /><b>PQRS Information</b><br /><br />";
                    msg += $"<b>Testecorreo</b>: {formato.AnalistaCorreo}<br />";
                    msg += $"<b>Testeanalista</b>: {formato.AnalistaId}<br />";
                    msg += $"<b>Traking</b>: {formato.NroTracking}<br />";
                    msg += $"<b>Recruitment</b>: {formato.Id}<br />";
                }

                //Destinatario del formato
                if (flagDestinatarios)
                {
                    var destinatarios = formato.Destinatarios.Split(',');
                    foreach (var d in destinatarios)
                    {
                        if (d != null && d != "")
                        {
                            mails.Add(new Mails {
                                to = d, toName = d
                            });
                        }
                    }
                }

                //if (tipoNotificacion != TipoNotificacion.CreateFormat)
                msg += $"<br /><br /><a style='color:#22BCE5' href={{url}}/PQRS/{action}?TipoPQRS={tipoPQRS}&DataId={DataId}&RecordId={RecordId}>Click here to view the PQRS.</a>";

                foreach (var m in mails)
                {
                    Task.Run(() => Fn.SendHtmlEmail("*****@*****.**", "Cayo Diebe", subject, msg, AppLink));
                    //Task.Run(() => Fn.SendHtmlEmail(m.to, m.toName, subject, msg, AppLink));
                }
            }
            catch
            {
                return;
            }

            // await Task.Run(() => Fn.SendHtmlEmail(to, toName, subject, msg));
        }