Пример #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     //libros nuevo = new libros();
     buscado = textBox1.Text;
     Conexion bd = new Conexion();
     List<string> lista = bd.consulta("SELECT * FROM libros WHERE titulo LIKE'%" + buscado + "%';");
 }
Пример #2
0
 private void modificar_Click(object sender, EventArgs e)
 {
     Conexion bd = new Conexion();
     bd.consulta("UPDATE  autores SET nombre='" + textBox1.Text + "', apellido='" + textBox2.Text + "' where id_autores = '" + idElegido + "';");
     this.Hide();
     Autores_abm mer = new Autores_abm();
     mer.ShowDialog();
 }
Пример #3
0
 private void button2_Click(object sender, EventArgs e)
 {
     Conexion bd = new Conexion();
     bd.consulta("DELETE FROM libros where id_libro = '" + idLibroAEliminar + "';");
     this.Hide();
     Autores_abm mer = new Autores_abm();
     mer.ShowDialog();
 }
Пример #4
0
 private void button3_Click(object sender, EventArgs e)
 {
     Conexion bd = new Conexion();
     bd.consulta("DELETE FROM usuario WHERE email = '" + email + "';");
     MessageBox.Show("Usuario eliminado correctamente.","Eliminar Usuario");
     this.Hide();
     Autores_abm mer = new Autores_abm();
     mer.ShowDialog();
 }
Пример #5
0
 private void button2_Click(object sender, EventArgs e)
 {
     Conexion bd = new Conexion();
     bd.consulta("UPDATE  usuario SET nomYape='" + textBox2.Text + "', pass='******', direccion='" + textBox4.Text + "', fechaNac='" + textBox5.Text + "', telefono='" + textBox6.Text + "' where email = '" + elegido.getEmail() + "';");
     MessageBox.Show("Usuario modificado correctamente.","Modificacion Usuario");
     this.Hide();
     Autores_abm mer = new Autores_abm();
     mer.ShowDialog();
 }
Пример #6
0
 private void button1_Click(object sender, EventArgs e)
 {
     Conexion bd = new Conexion();
     bd.consulta("INSERT INTO usuario VALUES('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + 0 + "');");
     bd.cerrarConexion();
     MessageBox.Show("Usuario Creado Correctamente.","Creacion Usuario");
     this.Hide();
     Autores_abm mer = new Autores_abm();
     mer.ShowDialog();
 }
Пример #7
0
        private void aceptar_Click(object sender, EventArgs e)
        {
            Conexion BD = new Conexion();
            string nom=nombre.Text;
            string apell = apellido.Text;

            BD.consulta("INSERT INTO autores VALUES (null,'"+nom+"','"+apell+"');");
            this.Hide();
            Autores_abm mer = new Autores_abm();
            mer.ShowDialog();
        }
Пример #8
0
        private void aceptar_Click(object sender, EventArgs e)
        {
            Conexion bd = new Conexion();
            bd.consulta("INSERT INTO libros VALUES(NULL,'"+titulo.Text+"','"+categoria.Text+"','"+cant_hojas.Text+"','"+null+"','"+editorial.Text+"','"+precio.Text+"','"+año.Text+"','"+indice.Text+"','"+stock.Text+"');");
            List<string> lista = bd.consulta("SELECT id_libro FROM libros WHERE titulo='" + titulo.Text + "';");

            string id = lista[0];
            bd.consulta("INSERT INTO libroautor SET libros_id_libro='" + id + "',autores_id_autores='" + autor.getId() + "';");
            bd.cerrarConexion();
            this.Hide();
            Autores_abm mer = new Autores_abm();
            mer.ShowDialog();
        }
Пример #9
0
 private void button1_Click(object sender, EventArgs e)
 {
     libros nuevo = new libros();
     buscado = textBox2.Text;
     Conexion bd = new Conexion();
     List<string> lista = bd.consulta("SELECT * FROM libros WHERE titulo LIKE '%" + buscado + "%';");
     for (int i = 0; i < lista.Count; i = i + 10)
     {
         string id = lista[i];
         string nombre = lista[i + 1];
         nuevo.agregar(id, nombre);
         LISTA.Add(nuevo);
     }
     this.buscar();
 }
Пример #10
0
 private void Buscar_Click(object sender, EventArgs e)
 {
     Autor nuevo=new Autor();
     buscado=textBox3.Text;
     Conexion bd = new Conexion();
     List<string> lista = bd.consulta("SELECT * FROM autores WHERE apellido LIKE '%" + buscado + "%' OR nombre LIKE '%" + buscado + "%';");
        for (int i = 0; i < lista.Count; i = i + 3) {
         string id = lista[i];
         string nombre = lista[i+1];
         string apellido = lista[i+2];
         nuevo.agregar(int.Parse(id), nombre, apellido);
         LISTA.Add(nuevo);
     }
        this.buscar();
 }
Пример #11
0
 private void button1_Click(object sender, EventArgs e)
 {
     usuario nuevo = new usuario();
     buscado = textBox1.Text;
     Conexion bd = new Conexion();
     List<string> lista = bd.consulta("SELECT * FROM usuario WHERE nomYape LIKE'%" + buscado + "%';");
     for (int i = 0; i < lista.Count; i = i + 10)
     {
         string email = lista[i];
         string nombreYapellido = lista[i + 1];
         nuevo.agregar(email, nombreYapellido);
         LISTA.Add(nuevo);
     }
     this.buscar();
 }
Пример #12
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string combo = comboBox1.Text;
            string[] splitted=combo.Split(':');
            Conexion bd = new Conexion();
            List<string> lista = bd.consulta("SELECT * FROM libros WHERE id_libro='" + Convert.ToInt32(splitted[0]) + "';");

            id = lista[0];
            titulo.Text= lista[1];
            categoria.Text= lista[2];
            cant_hojas.Text = lista[3];
            editorial.Text = lista[5];
            precio.Text = lista[6];
            año.Text = lista[7];
            indice.Text = lista[8];
            stock.Text = lista[9];

            lista = bd.consulta("SELECT * FROM libroautor WHERE libros_id_libro='" + id + "';");

            lista= bd.consulta("SELECT * FROM autores WHERE id_autores='"+lista[1]+"';");
            try
            {
                comboBox2.Text = lista[0] + " " + lista[1] + " " + lista[2];
                autorElegido = new Autor();
                autorElegido.setId(int.Parse(lista[0]));
                autorElegido.setNombre(lista[1]);
                autorElegido.setApellido(lista[2]);
            }
            catch (Exception ex)
            {
            }
            lista = bd.consulta("SELECT * FROM autores;");
            for (int i = 0; i < lista.Count; i = i + 3)
            {
                Autor autor = new Autor();
                autor.setId(int.Parse(lista[i]));
                autor.setNombre(lista[i + 1]);

                autor.setApellido(lista[i + 2]);
                LISTAAutor.Add(autor);
            }
            foreach (Autor objeto in LISTAAutor)
            {
                comboBox2.Items.Add(objeto.getId() + " " + objeto.getNombre() + " " + objeto.getApellido());
            }
        }
Пример #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            usuario nuevo=new usuario();
            buscado=textBox3.Text;
            Conexion bd = new Conexion();
            List<string> lista = bd.consulta("SELECT * FROM usuario WHERE nomYape LIKE'%"+buscado+"%';");
               for (int i = 0; i < lista.Count; i = i + 8) {
                string email = lista[i];
                string nombreYapellido = lista[i+1];
                string pass = lista[i+2];
                string direccion = lista[i + 3];
                string fechaNacimiento = lista[i + 4];
                int telefono = int.Parse(lista[i + 5]);

                nuevo.agregar(email, nombreYapellido, pass, direccion, fechaNacimiento, telefono);
                LISTA.Add(nuevo);
            }
               this.buscar();
        }
Пример #14
0
        public agregar_Libro()
        {
            InitializeComponent();
            Conexion bd = new Conexion();
            List<string> lista = bd.consulta("SELECT * FROM autores;");
            for (int i = 0; i < lista.Count; i = i + 3)
            {
                Autor autor = new Autor();
                autor.setId(int.Parse(lista[i]));
                autor.setNombre(lista[i + 1]);

                autor.setApellido(lista[i + 2]);
                LISTA.Add(autor);
            }
            foreach (Autor objeto in LISTA)
            {
                comboBox1.Items.Add(objeto.getId() + " " + objeto.getNombre()+" "+ objeto.getApellido());
            }
        }
Пример #15
0
        private void button1_Click(object sender, EventArgs e)
        {
            libros nuevo = new libros();
            buscado = buscador.Text;
            Conexion bd = new Conexion();
            List<string> lista = bd.consulta("SELECT * FROM libros WHERE titulo LIKE'%" + buscado + "%';");
            for (int i = 0; i < lista.Count; i = i + 10)
            {
                string id = lista[i];
                string nombre = lista[i + 1];

                string categoria = lista[i + 2];
                string cant_hojas = lista[i + 3];
                string editorial = lista[i + 5];
                string precio = lista[i + 6];
                string año = lista[i + 7];
                string indice = lista[i + 8];
                string stock = lista[i + 9];

                nuevo.agregar(id, nombre, categoria, cant_hojas, editorial, precio, año, indice, stock);
                LISTA.Add(nuevo);
            }
            this.buscar();
        }
Пример #16
0
        private void mostrarLibros()
        {
            Conexion bd = new Conexion();
            List<string> lista = bd.consulta("SELECT * FROM libros");
            libros libro = new libros();
            List<string> columnas = new List<string> { "id", "Nombre", "Categoria", "Cant Hojas", "Editorial", "Precio", "Año", "Stock" };

            foreach (String columna in columnas)
            {
                DataGridViewColumn nueva = new DataGridViewTextBoxColumn();
                nueva.Name = columna;
                nueva.DataPropertyName = columna;
                nueva.HeaderText = columna;
                dataGridView1.Columns.Add(nueva);
            }

            for (int i = 0; i < lista.Count; i = i + 10)
            {
                string id = lista[i];
                string nombre = lista[i + 1];

                string categoria = lista[i + 2];
                string cant_hojas = lista[i + 3];
                string editorial = lista[i + 5];
                string precio = lista[i + 6];
                string año = lista[i + 7];
                string indice = lista[i + 8];
                string stock = lista[i + 9];

                libro.agregar(id, nombre, categoria, cant_hojas, editorial, precio, año, indice, stock);

                dataGridView1.Rows.Add(libro.getId(), libro.getNombre(), libro.getCategoria(), libro.getCantHojas(), libro.getEditorial(), libro.getPrecio(), libro.getAño(), libro.getStock());
            }
            // Resize the master DataGridView columns to fit the newly loaded data.
            dataGridView1.AutoResizeColumns();
            dataGridView1.AutoSize = false;
            // Configure the details DataGridView so that its columns automatically
            // adjust their widths when the data changes.
            dataGridView1.AutoSizeColumnsMode =
                DataGridViewAutoSizeColumnsMode.AllCells;
        }
Пример #17
0
        private void mostrarAutores()
        {
            Conexion bd = new Conexion();
            List<string> lista = bd.consulta("SELECT * FROM autores");
            Autor autor = new Autor();
            List<string> columnas = new List<string> { "id", "Nombre", "Apellido" };

            foreach (String columna in columnas)
            {
                DataGridViewColumn nueva = new DataGridViewTextBoxColumn();
                nueva.Name = columna;
                nueva.DataPropertyName = columna;
                nueva.HeaderText = columna;
                dataGridView2.Columns.Add(nueva);
            }

            for (int i = 0; i < lista.Count; i = i + 3)
            {
                string id = lista[i];
                string nombre = lista[i + 1];
                string apellido = lista[i + 2];

                autor.setId(int.Parse(id));
                autor.setNombre(nombre);
                autor.setApellido(apellido);

                dataGridView2.Rows.Add(autor.getId(), autor.getNombre(), autor.getApellido());
            }
            // Resize the master DataGridView columns to fit the newly loaded data.
            dataGridView2.AutoResizeColumns();
            dataGridView2.AutoSize = true;
            // Configure the details DataGridView so that its columns automatically
            // adjust their widths when the data changes.
            dataGridView2.AutoSizeColumnsMode =
                DataGridViewAutoSizeColumnsMode.AllCells;
        }
Пример #18
0
 private void modificar_Click(object sender, EventArgs e)
 {
     Conexion bd = new Conexion();
     bd.consulta("UPDATE  libros SET titulo='" + titulo.Text + "', categoria='" + categoria.Text + "',cant_hojas='"+cant_hojas.Text+"',editorial='"+editorial.Text+"',precio='"+float.Parse(precio.Text)+"',año='"+año.Text+"',indice='"+indice.Text+"',stock='"+stock.Text+"' where id_libro = '" +id +"';");
     bd.consulta("UPDATE  libroautor SET autores_id_autores='" + autorElegido.getId() + "' where libros_id_libro = '" + id + "';");
     this.Hide();
     Autores_abm mer = new Autores_abm();
     mer.ShowDialog();
 }
Пример #19
0
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            string combo = comboBox2.Text;
            string[] splitted = combo.Split(' ');
            Conexion bd = new Conexion();
            List<string> lista = bd.consulta("SELECT * FROM autores WHERE id_autores='" + Convert.ToInt32(splitted[0]) + "';");

            Autor autor = new Autor();
            autor.setId(int.Parse(lista[0]));
            autor.setNombre(lista[1]);
            autor.setApellido(lista[2]);

            autorElegido=autor;
        }
Пример #20
0
 private void eliminar_btn_Click_1(object sender, EventArgs e)
 {
     string[] splitted = comboBox2.Text.Split(':');
     Conexion bd = new Conexion();
     bd.consulta("DELETE FROM autores where id_autores = '" + splitted[0] + "';;");
     this.Hide();
     Autores_abm mer = new Autores_abm();
     mer.ShowDialog();
 }