示例#1
0
        private void Home_Load(object sender, EventArgs e)
        {
            this.allControls = Program.GetAllControls(this);

            allControls.Add(lblLang);
            allControls.Add(lblMisObjetivos);
            allControls.Add(lblObjetivosSector);
            allControls.Add(gbManage);

            foreach (TabPage tp in tabs.TabPages)
            {
                this.allControls.Add(tp);
            }

            cargarIdiomas();

            IdiomaManager.cambiar(Sesion.obtenerSesion().idioma, Sesion.obtenerSesion().idioma.id, this);
            langLoaded = true;

            loadPermisos();

            lblNotification.Text = NotificacionManager.obtenerCantidad(usuarioLoggeado).ToString();

            updateObjetivosTab();

            updateTeamLeaders();
        }
示例#2
0
        private void btnReconocer_Click(object sender, EventArgs e)
        {
            if (txtReconocido.Text == null || txtReconocido.Text == "" || cmbEmblema.SelectedItem == null)
            {
                return;
            }

            if (reconocido == Sesion.obtenerSesion().usuario)
            {
                MetroFramework.MetroMessageBox.Show(this, Sesion.obtenerSesion().idioma.textos["cant_recognize_myself"], Sesion.obtenerSesion().idioma.textos["notification"]);
                return;
            }

            int     emblemaId = int.Parse((cmbEmblema.SelectedItem as ComboboxItem).Value.ToString());
            Emblema emblema   = EmblemaManager.obtener(int.Parse((cmbEmblema.SelectedItem as ComboboxItem).Value.ToString()))[0];

            ReconocimientoManager.crear(new Reconocimiento {
                reconocedor = Sesion.obtenerSesion().usuario,
                reconocido  = reconocido,
                descripcion = txtDescripcion.Text,
                emblema     = emblema
            });

            NotificacionManager.enviar(new Notificacion {
                usuario = reconocido, texto = "experience_sent"
            });

            MetroFramework.MetroMessageBox.Show(this, Sesion.obtenerSesion().idioma.textos["recognize_create_success"], Sesion.obtenerSesion().idioma.textos["notification"]);
            this.Close();
        }
    public void Shoot()
    {
        NotificacionManager.MostrarNotificacion("Has disparado", "Dejame volver al juego");
        GameObject balaDisparada = poolBalas[0];

        balaDisparada.SetActive(true);
        balaDisparada.transform.position = canon.position;
        poolBalas.Insert(poolBalas.Count, balaDisparada);
        poolBalas.RemoveAt(0);
    }
示例#4
0
 //debug
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Y))
     {
         NotificacionManager.MostrarNotificacion("Holi, soy una notificacion de prueba", "Ah, ya veo");
     }
     if (Input.GetKeyDown(KeyCode.A))
     {
         NotificacionManager.EsconderNotificacion();
     }
 }
示例#5
0
        private void imgNotification_Click(object sender, EventArgs e)
        {
            if (NotificacionManager.obtenerCantidad(usuarioLoggeado).ToString() == "0")
            {
                return;
            }

            Notificaciones n = new Notificaciones();

            n.Show();
            lblNotification.Text = "0";
        }
示例#6
0
        private void Notificaciones_Load(object sender, EventArgs e)
        {
            notificaciones = NotificacionManager.obtener(Sesion.obtenerSesion().usuario);

            lbNotificaciones.DisplayMember = "Text";
            lbNotificaciones.ValueMember   = "Value";

            var items = new List <Object>();

            foreach (Notificacion notificacion in notificaciones)
            {
                items.Add(new ComboboxItem {
                    Text = Sesion.obtenerSesion().idioma.textos[notificacion.texto], Value = notificacion.id
                });
            }

            lbNotificaciones.DataSource = items;

            NotificacionManager.leerTodas(Sesion.obtenerSesion().usuario);
        }
 public ActionResult Crear([Bind(Include = "GestanteNroDocumento,Nombres,APaterno,AMaterno,FechaNacimiento,EstablecimientoId,EstablecimientoNotificacionId,FechaUltimaRegla," +
                                           "FechaProbableParto,PresionSistolicaBase,PresionDiastolicaBase,DiagnosticoIngreso,DiagnosticoIntermedio1,DiagnosticoIntermedio2,DiagnosticoEgreso," +
                                           "GestanteDireccion,GestanteEmail,GestanteTelefono,HorarioMensaje,DistritoId")] GestanteModel gestante)
 {
     foreach (var error in EjecutarValidaciones(gestante))
     {
         ModelState.AddModelError(string.Empty, error);
     }
     if (ModelState.IsValid)
     {
         gestante.UsuarioEditor = ObtenerUsuarioKeyLogeado();
         int newGestanteKey = gestanteManager.GrabarGestante(gestante, 0);
         NotificacionManager.GrabarNotificacion(gestante.GestanteTelefono, "Msg. Confirmacion",
                                                "Bienvenida. Usted ha sido registrada en el programa de monitoreo a distancia de gestantes con preeclampsia leve. Gracias");
         RegistrarAccion((byte)AccionSesion.Crear, (byte)ObjetoSesion.CrearGestante, newGestanteKey);
         return(RedirectToAction("Index"));
     }
     ConfigurarMenues();
     ConfigurarViewBag(gestante);
     return(View(gestante));
 }
        public ActionResult Crear(string tramaTelefono, string tramaDatos)
        {
            int    gestanteKey;
            string gestanteNroDocumento;
            string gestanteTelefono = tramaTelefono;

            string[]      arregloDatos;
            int           presionSistolica;
            int           presionDiastolica;
            int           proteinuria;
            int           movimientosFetales;
            string        signosAlarma;
            string        mensaje              = string.Empty;
            List <string> mensajesAlarma       = new List <string>();
            bool          esTelefonoRegistrado = false;

            if (!string.IsNullOrWhiteSpace(tramaTelefono))
            {
                if (tramaTelefono.Length < 9)
                {
                    mensaje = "Trama recibida con numero de telefono incorrecto: " + tramaTelefono;
                    NotificacionManager.GrabarNotificacionParaAdminUser("Msg. Error", mensaje);
                    return(Content(mensaje));
                }
                if (tramaTelefono.Length > 9)
                {
                    gestanteTelefono = tramaTelefono.Substring(tramaTelefono.Length - 9, 9);
                }

                gestanteKey = gestanteManager.ObtenerGestanteKeyByGestanteTelefono(gestanteTelefono);
                if (gestanteKey == -1)
                {
                    mensaje = "El numero de telefono no esta registrado en el programa.";
                    NotificacionManager.GrabarNotificacion(gestanteTelefono, "Msg. Error", mensaje);
                    return(Content(mensaje));
                }

                esTelefonoRegistrado = true;

                if (string.IsNullOrWhiteSpace(tramaDatos))
                {
                    mensaje = "Trama de datos invalida.";
                    NotificacionManager.GrabarNotificacion(gestanteTelefono, "Msg. Error", mensaje);
                    return(Content(mensaje));
                }

                if (tramaDatos.IndexOf(" ") > -1 && tramaDatos.IndexOf(" ") < tramaDatos.IndexOf(","))
                {
                    tramaDatos = tramaDatos.Substring(tramaDatos.IndexOf(" ") + 1).Trim();
                }

                arregloDatos = tramaDatos.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                if (arregloDatos.Length == 0)
                {
                    mensaje = "Trama de datos invalida.";
                    NotificacionManager.GrabarNotificacion(gestanteTelefono, "Msg. Error", mensaje);
                    return(Content(mensaje));
                }
            }
            else
            {
                if (string.IsNullOrWhiteSpace(tramaDatos))
                {
                    mensaje = "Trama de datos invalida.";
                    NotificacionManager.GrabarNotificacionParaAdminUser("Msg. Error", mensaje);
                    return(Content(mensaje));
                }

                if (tramaDatos.IndexOf(" ") > -1 && tramaDatos.IndexOf(" ") < tramaDatos.IndexOf(","))
                {
                    tramaDatos = tramaDatos.Substring(tramaDatos.IndexOf(" ") + 1).Trim();
                }

                arregloDatos = tramaDatos.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                if (arregloDatos.Length == 0)
                {
                    mensaje = "Trama de datos invalida: " + tramaDatos;
                    NotificacionManager.GrabarNotificacionParaAdminUser("Msg. Error", mensaje);
                    return(Content(mensaje));
                }

                gestanteNroDocumento = arregloDatos[0];
                if (string.IsNullOrWhiteSpace(gestanteNroDocumento))
                {
                    mensaje = "El numero de documento enviado es invalido: " + gestanteNroDocumento;
                    NotificacionManager.GrabarNotificacionParaAdminUser("Msg. Error", mensaje);
                    return(Content(mensaje));
                }

                gestanteKey = gestanteManager.ObtenerGestanteKeyByGestanteNroDocumento(gestanteNroDocumento);
                if (gestanteKey == -1)
                {
                    mensaje = "El numero de documento enviado no esta registrado en el programa: " + tramaTelefono;
                    NotificacionManager.GrabarNotificacionParaAdminUser("Msg. Error", mensaje);
                    return(Content(mensaje));
                }
            }

            try
            {
                var gestante = gestanteManager.MostrarGestante(gestanteKey);
                if (esTelefonoRegistrado)
                {
                    if (arregloDatos.Length < 5)
                    {
                        mensaje = "Los valores de monitoreo enviados en la trama de datos estan incompletos.";
                        NotificacionManager.GrabarNotificacion(gestante.GestanteTelefono, "Msg. Error", mensaje);
                        return(Content(mensaje));
                    }
                    Int32.TryParse(arregloDatos[0], out presionSistolica);
                    Int32.TryParse(arregloDatos[1], out presionDiastolica);
                    Int32.TryParse(arregloDatos[2], out proteinuria);
                    Int32.TryParse(arregloDatos[3], out movimientosFetales);
                    signosAlarma = arregloDatos[4];
                }
                else
                {
                    if (arregloDatos.Length < 6)
                    {
                        mensaje = "Los valores de monitoreo enviados en la trama de datos estan incompletos.";
                        NotificacionManager.GrabarNotificacion(gestante.GestanteTelefono, "Msg. Error", mensaje);
                        return(Content(mensaje));
                    }
                    Int32.TryParse(arregloDatos[1], out presionSistolica);
                    Int32.TryParse(arregloDatos[2], out presionDiastolica);
                    Int32.TryParse(arregloDatos[3], out proteinuria);
                    Int32.TryParse(arregloDatos[4], out movimientosFetales);
                    signosAlarma = arregloDatos[5];
                }

                bool enviarAlarma = false;

                // validacion presion sistolica
                if (presionSistolica < 10 || presionSistolica > 280)
                {
                    mensaje = "El valor para Presion Sistolica esta fuera del rango valido (10 - 280).";
                    NotificacionManager.GrabarNotificacion(gestante.GestanteTelefono, "Msg. Error", mensaje);
                    return(Content(mensaje));
                }

                // validacion presion diastolica
                if (presionDiastolica < 10 || presionDiastolica > 280)
                {
                    mensaje = "El valor para Presion Diastolica esta fuera del rango valido (10 - 280).";
                    NotificacionManager.GrabarNotificacion(gestante.GestanteTelefono, "Msg. Error", mensaje);
                    return(Content(mensaje));
                }

                // validacion proteinuria
                if (proteinuria < 0 || proteinuria > 10)
                {
                    mensaje = "El valor para Proteinuria esta fuera del rango valido (0 - 10).";
                    NotificacionManager.GrabarNotificacion(gestante.GestanteTelefono, "Msg. Error", mensaje);
                    return(Content(mensaje));
                }

                // validacion movimientos fetales
                if (movimientosFetales < 0 || movimientosFetales > 50)
                {
                    mensaje = "El valor para Movimientos Fetales esta fuera del rango valido (0 - 50).";
                    NotificacionManager.GrabarNotificacion(gestante.GestanteTelefono, "Msg. Error", mensaje);
                    return(Content(mensaje));
                }

                // validacion signos alarma
                if (signosAlarma.Length > 20 || signosAlarma.Contains("script") || signosAlarma.Contains("insert") ||
                    signosAlarma.Contains("update") || signosAlarma.Contains("delete") || signosAlarma.Contains("select"))
                {
                    mensaje = "El valor para signos de alarma excede a 20 caracteres o incluye caracteres no permitidos";
                    NotificacionManager.GrabarNotificacion(gestante.GestanteTelefono, "Msg. Error", mensaje);
                    return(Content(mensaje));
                }

                var gestanteMonitoreo = new GestanteMonitoreoModel()
                {
                    GestanteKey          = gestanteKey,
                    GestanteNroDocumento = gestante.GestanteNroDocumento,
                    PresionSistolica     = presionSistolica,
                    PresionDiastolica    = presionDiastolica,
                    Proteinuria          = proteinuria,
                    MovimientosFetales   = movimientosFetales,
                    SignosAlarma         = signosAlarma
                };

                var result = gestanteManager.GrabarGestanteMonitoreo(gestanteMonitoreo);

                // Si presion sistolica > presion sistolica base + 30 ==> Alarma
                if (presionSistolica > gestante.PresionSistolicaBase + 30)
                {
                    mensajesAlarma.Add("PS:" + presionSistolica + "mmHg(" +
                                       gestante.PresionSistolicaBase + "mmHg)");
                    enviarAlarma = true;
                }
                // Si presion diastolica > presion diastolica base + 15 ==> Alarma
                if (presionDiastolica > gestante.PresionDiastolicaBase + 15)
                {
                    mensajesAlarma.Add("PD:" + presionDiastolica + "mmHg(" +
                                       gestante.PresionDiastolicaBase + "mmHg)");
                    enviarAlarma = true;
                }
                // Si proteinuria >= 1 ==> Alarma
                if (proteinuria >= 1)
                {
                    mensajesAlarma.Add("PR:" + proteinuria);
                    enviarAlarma = true;
                }
                // Si movimientos fetales == 0 ==> Alarma
                if (movimientosFetales == 0)
                {
                    mensajesAlarma.Add("MF:" + movimientosFetales);
                    enviarAlarma = true;
                }

                if (enviarAlarma && mensajesAlarma.Count > 0)
                {
                    var    numerosDestino    = gestanteManager.ObtenerTelefonosParaAlerta(gestante);
                    string mensajesSecuencia = string.Empty;
                    foreach (var mensajeAlarma in mensajesAlarma)
                    {
                        mensajesSecuencia += mensajeAlarma + ", ";
                    }
                    mensajesSecuencia += "Gestante: " + gestante.GestanteNroDocumento +
                                         " Celular: " + gestante.GestanteTelefono + " Reporte: " + result.ToString();
                    NotificacionManager.GrabarNotificacion(numerosDestino, "Msg. Alarma", mensajesSecuencia);
                }
                NotificacionManager.GrabarNotificacion(gestante.GestanteTelefono, "Msg. Confirmacion",
                                                       "Su reporte de monitoreo se ha registrado correctamente. Numero de reporte: " + result.ToString());

                RegistrarAccion((byte)AccionSesion.Crear, (byte)ObjetoSesion.CrearGestanteMonitoreo, result);
                return(Content("OK"));
            }
            catch (Exception e)
            {
                mensaje = "Ha ocurrido un error en la creacion de reporte de monitoreo: " + e.Message;
                NotificacionManager.GrabarNotificacionParaAdminUser("Msg. Error", mensaje);
                return(Content(mensaje));
            }
        }
示例#9
0
 private void Awake()
 {
     sNotificacionManager = this;
 }