示例#1
0
        public static void insertarEstablecimiento(MySqlConnection conexion, Establecimiento est)
        {
            String query = "INSERT INTO establecimiento(IDENTIDAD, IDREGION, NOMBREESTABLECIMIENTO, TIPOESTABLECIMIENTO, DIRECCIONESTABLECIMIENTO, TELEFONOESTABLECIMIENTO) VALUES ('" + est.idEntidad + "','" + est.idRegion + "','" + est.nombreEstablecimiento + "','" + est.tipoEstablecimiento + "','" + est.direccionEstablecimiento + "','" + est.telefonoEstablecimiento + "')";

            try
            {
                MySqlCommand comando = new MySqlCommand(query, conexion);
                Int32        lector  = (Int32)comando.ExecuteNonQuery();
            }
            catch (MySqlException ex)
            { throw ex; }
        }
示例#2
0
        public static void actualizarEstablecimiento(MySqlConnection conexion, Establecimiento est)
        {
            String query = "UPDATE establecimiento set IDENTIDAD = '" + est.idEntidad + "', IDREGION = '" + est.idRegion + "', NOMBREESTABLECIMIENTO = '" + est.nombreEstablecimiento + "', TIPOESTABLECIMIENTO = '" + est.tipoEstablecimiento + "', DIRECCIONESTABLECIMIENTO = '" + est.direccionEstablecimiento + "', TELEFONOESTABLECIMIENTO = '" + est.telefonoEstablecimiento + "' where IdEstablecimiento = '" + est.idEstablecimiento + "'";

            try
            {
                MySqlCommand comando = new MySqlCommand(query, conexion);
                Int32        lector  = (Int32)comando.ExecuteNonQuery();
            }
            catch (MySqlException ex)
            { throw ex; }
        }
        public static List <Establecimiento> cargarestablecimientosrefamot(MySqlConnection conexion)

        {
            String query = "Select IDESTABLECIMIENTO, NOMBREESTABLECIMIENTO from establecimiento where TIPOESTABLECIMIENTO='De Referencia' or TIPOESTABLECIMIENTO='Ambos' or TIPOESTABLECIMIENTO='Otros'";
            List <Establecimiento> le      = new List <Establecimiento>();
            MySqlCommand           comando = new MySqlCommand(query, conexion);
            MySqlDataReader        rd      = comando.ExecuteReader();

            while (rd.Read())
            {
                Establecimiento es = new Establecimiento();
                es.idEstablecimiento     = rd.GetInt32(0);
                es.nombreEstablecimiento = rd.GetString(1);
                le.Add(es);
            }
            return(le);
        }
示例#4
0
        private void button1_Click(object sender, EventArgs e)
        {
            int IDREGION;
            int IDENTIDAD;

            if (comboBox1.Text == "Zona Central")
            {
                IDREGION = 1;
            }

            else if (comboBox1.Text == "Zona Paracentral")
            {
                IDREGION = 2;
            }

            else if (comboBox1.Text == "Zona Occidental")
            {
                IDREGION = 3;
            }

            else if (comboBox1.Text == "Zona Oriental")
            {
                IDREGION = 4;
            }
            else if (comboBox1.Text == "Zona Metropolitana")
            {
                IDREGION = 5;
            }

            else if (comboBox1.Text == "Zona M. Unidades")
            {
                IDREGION = 6;
            }
            else if (comboBox1.Text == "Zona M.Hospitales")
            {
                IDREGION = 7;
            }

            else
            {
                IDREGION = 8;
            }


            if (comboBox2.Text == "ISSS")
            {
                IDENTIDAD = 1;
            }

            else
            {
                IDENTIDAD = 2;
            }


            //ordenar bien el siguiente constructor para que los parámetros entren como corresponden
            Clases.Establecimiento pac = new Clases.Establecimiento(IDENTIDAD, IDREGION, textBox3.Text, comboBox3.Text, textBox4.Text, textBox5.Text);
            try
            {
                if (con.conectar())
                {
                    Clases.Establecimiento.insertarEstablecimiento(con.conexion, pac);
                    MessageBox.Show("Establecimiento registrado exitosamente");
                }
            }
            catch (MySqlException ex)
            {
                MessageBox.Show("error" + ex);
            }


            comboBox1.Text = " ";
            comboBox2.Text = " ";
            textBox3.Text  = " ";
            textBox4.Text  = " ";
            textBox5.Text  = " ";


            con.desconectar();
        }