예제 #1
0
        public List <SignoVital> getListaSignoVital()
        {
            string rutacompleta = @"E:\SignosVitales.txt";

            string[] renglones = File.ReadAllLines(rutacompleta);

            try
            {
                foreach (var linea in renglones)
                {
                    SignoVital signo = new SignoVital();
                    string[]   datos = linea.Split(';');
                    signo.IdSignoVital      = datos[0];
                    signo.IdHistoriaClinica = datos[1];
                    signo.Temperatura       = datos[2];
                    signo.PrecionArterial   = datos[3];
                    signo.Fr    = datos[4];
                    signo.Fc    = datos[5];
                    signo.Peso  = datos[6];
                    signo.Talla = datos[7];

                    this.listaSignoVital.Add(signo);
                }
                return(this.listaSignoVital);
            }

            catch (Exception e)
            {
                return(this.listaSignoVital);
            }
        }
예제 #2
0
        public ActionResult RegistrarSignosVitales(SignoVital signo)
        {
            int numeroSigno = listaEnfermeria.numberOfSigno() + 1;

            signo.IdSignoVital = numeroSigno.ToString();
            this.listaEnfermeria.addSignoVital(signo);
            return(RedirectToAction("Listar", "Enfermeria"));
        }
예제 #3
0
        public void addSignoVital(SignoVital signo)
        {
            string rutaCompleta = @"E:\SignosVitales.txt";

            using (StreamWriter file = new StreamWriter(rutaCompleta, true))
            {
                string texto = $"{signo.IdSignoVital};" +
                               $"{signo.IdHistoriaClinica};" +
                               $"{signo.Temperatura};" +
                               $"{signo.PrecionArterial};" +
                               $"{signo.Fr};" +
                               $"{signo.Fc};" +
                               $"{signo.Peso};" +
                               $"{signo.Talla}";
                file.WriteLine(texto);
                file.Close();
            }
        }
        public ActionResult Registrar([FromBody] SignoVital signoVital)
        {
            if (!signoVital.validarDatos())
            {
                return(BadRequest());
            }

            SignoVitalImp signoVitalImp = new SignoVitalImp(new SignoVitalPersistencia());

            bool seGuardo = signoVitalImp.Registar(signoVital);

            if (seGuardo)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }
        public bool RegistrarBD(ASignoVital SignoVital)
        {
            bool seRegistro     = true;
            var  optionsBuilder = new DbContextOptionsBuilder <ApplicationContext>();

            optionsBuilder.UseSqlServer(Startup.urlConexion);
            using (var context = new ApplicationContext(optionsBuilder.Options))
            {
                try
                {
                    SignoVital SignoVitalBD = new SignoVital(SignoVital);
                    context.Add(SignoVitalBD);
                    context.SaveChanges();
                }
                catch (DbUpdateException)
                {
                    seRegistro = false;
                }
            }
            return(seRegistro);
        }