示例#1
0
        public static Paciente Contar(int i)
        {
            BDConexion con   = new BDConexion();
            Paciente   nuevo = new Paciente();

            MySqlCommand _comando = new MySqlCommand(String.Format(
                                                         "SELECT count(*) from  paciente where propenso='{0}' and bajo=1 ", i), BDConexion.ObtenerConexion());
            MySqlDataReader reader = _comando.ExecuteReader();

            while (reader.Read())
            {
                nuevo.bajo = reader.GetInt32(0);
            }
            ;
            reader.Close();
            _comando = new MySqlCommand(String.Format(
                                            "SELECT count(*) from  paciente where propenso='{0}' and normal =1 ", i), BDConexion.ObtenerConexion());
            reader = _comando.ExecuteReader();
            while (reader.Read())
            {
                nuevo.normal = reader.GetInt32(0);
            }
            ;
            reader.Close();
            _comando = new MySqlCommand(String.Format(
                                            "SELECT count(*) from  paciente where propenso='{0}' and sobrepeso =1 ", i), BDConexion.ObtenerConexion());
            reader = _comando.ExecuteReader();
            while (reader.Read())
            {
                nuevo.sobrepeso = reader.GetInt32(0);
            }
            ;
            reader.Close();
            _comando = new MySqlCommand(String.Format(
                                            "SELECT count(*) from  paciente where propenso='{0}' and obesidad =1 ", i), BDConexion.ObtenerConexion());
            reader = _comando.ExecuteReader();
            while (reader.Read())
            {
                nuevo.obesidad = reader.GetInt32(0);
            }
            ;
            reader.Close();
            _comando = new MySqlCommand(String.Format(
                                            "SELECT count(*) from  paciente where propenso='{0}' and fisicabaja =1 ", i), BDConexion.ObtenerConexion());
            reader = _comando.ExecuteReader();
            while (reader.Read())
            {
                nuevo.fisicabaja = reader.GetInt32(0);
            }
            ;
            reader.Close();
            _comando = new MySqlCommand(String.Format(
                                            "SELECT count(*) from  paciente where propenso='{0}' and fisicamedia =1 ", i), BDConexion.ObtenerConexion());
            reader = _comando.ExecuteReader();
            while (reader.Read())
            {
                nuevo.fisicamedia = reader.GetInt32(0);
            }
            ;
            reader.Close();
            _comando = new MySqlCommand(String.Format(
                                            "SELECT count(*) from  paciente where propenso='{0}' and fisicaalta =1 ", i), BDConexion.ObtenerConexion());
            reader = _comando.ExecuteReader();
            while (reader.Read())
            {
                nuevo.fisicaalta = reader.GetInt32(0);
            }
            ;
            reader.Close();
            _comando = new MySqlCommand(String.Format(
                                            "SELECT count(*) from  paciente where propenso='{0}' and mamadia =1 ", i), BDConexion.ObtenerConexion());
            reader = _comando.ExecuteReader();
            while (reader.Read())
            {
                nuevo.mamadia = reader.GetInt32(0);
            }
            ;
            reader.Close();
            _comando = new MySqlCommand(String.Format(
                                            "SELECT count(*) from  paciente where propenso='{0}' and papadia =1 ", i), BDConexion.ObtenerConexion());
            reader = _comando.ExecuteReader();
            while (reader.Read())
            {
                nuevo.papadia = reader.GetInt32(0);
            }
            ;
            reader.Close();
            _comando = new MySqlCommand(String.Format(
                                            "SELECT count(*) from  paciente where propenso='{0}' and abuelapater =1 ", i), BDConexion.ObtenerConexion());
            reader = _comando.ExecuteReader();
            while (reader.Read())
            {
                nuevo.abuelapater = reader.GetInt32(0);
            }
            ;
            reader.Close();
            _comando = new MySqlCommand(String.Format(
                                            "SELECT count(*) from  paciente where propenso='{0}' and abuelamater =1 ", i), BDConexion.ObtenerConexion());
            reader = _comando.ExecuteReader();
            while (reader.Read())
            {
                nuevo.abuelamater = reader.GetInt32(0);
            }
            ;
            reader.Close();
            _comando = new MySqlCommand(String.Format(
                                            "SELECT count(*) from  paciente where propenso='{0}' and abuelopater =1 ", i), BDConexion.ObtenerConexion());
            reader = _comando.ExecuteReader();
            while (reader.Read())
            {
                nuevo.abuelopater = reader.GetInt32(0);
            }
            ;
            reader.Close();
            _comando = new MySqlCommand(String.Format(
                                            "SELECT count(*) from  paciente where propenso='{0}' and abuelomater =1 ", i), BDConexion.ObtenerConexion());
            reader = _comando.ExecuteReader();
            while (reader.Read())
            {
                nuevo.abuelomater = reader.GetInt32(0);
            }
            ;
            reader.Close();

            _comando = new MySqlCommand(String.Format(
                                            "SELECT count(*) from  paciente where propenso='{0}' and sexo =1 ", i), BDConexion.ObtenerConexion());
            reader = _comando.ExecuteReader();
            while (reader.Read())
            {
                nuevo.sexo = reader.GetInt32(0);
            }
            ;
            reader.Close();
            _comando = new MySqlCommand(String.Format(
                                            "SELECT count(*) from  paciente where propenso='{0}' and glucemia =1 ", i), BDConexion.ObtenerConexion());
            reader = _comando.ExecuteReader();
            while (reader.Read())
            {
                nuevo.glucemia = reader.GetInt32(0);
            }
            ;

            reader.Close();

            return(nuevo);
        }
示例#2
0
        public static List <Paciente> obtener()
        {
            List <Paciente> lista   = new List <Paciente>();
            MySqlCommand    comando = new MySqlCommand(string.Format("Select * from red"), BDConexion.ObtenerConexion());
            MySqlDataReader reader  = comando.ExecuteReader();

            while (reader.Read())
            {
                Paciente nuevo = new Paciente();
                nuevo.id          = reader.GetInt32(0);
                nuevo.bajo        = reader.GetInt32(1);
                nuevo.normal      = reader.GetInt32(2);
                nuevo.sobrepeso   = reader.GetInt32(3);
                nuevo.obesidad    = reader.GetInt32(4);
                nuevo.fisicabaja  = reader.GetInt32(5);
                nuevo.fisicamedia = reader.GetInt32(6);
                nuevo.fisicaalta  = reader.GetInt32(7);
                nuevo.mamadia     = reader.GetInt32(8);
                nuevo.papadia     = reader.GetInt32(9);
                nuevo.abuelapater = reader.GetInt32(10);
                nuevo.abuelamater = reader.GetInt32(11);
                nuevo.abuelopater = reader.GetInt32(12);
                nuevo.abuelomater = reader.GetInt32(13);
                nuevo.sexo        = reader.GetInt32(14);
                nuevo.glucemia    = reader.GetInt32(15);
                nuevo.propens     = reader.GetInt32(16);
                lista.Add(nuevo);
            }
            return(lista);
        }
示例#3
0
 private void button3_Click(object sender, EventArgs e)
 {
     BDConexion.ObtenerConexion();
     MessageBox.Show("Conexión exitosa");
 }