コード例 #1
0
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            int id = 0;

            using (var db = new DAL.Repositorio <Libros>())
            {
                if (id != libro.LibrosId)
                {
                    db.Mdificar(libro);
                    MessageBox.Show("Modificado");
                }
                else
                {
                    libro = LlenarCampos();
                    if (BLL.LibroBLL.Guardar(libro))
                    {
                        MessageBox.Show("Correcto");
                    }
                    else
                    {
                        MessageBox.Show("Error");
                    }
                }
            }
        }
コード例 #2
0
        public void Limpiar()
        {
            nombreTextBox.Clear();
            librosIdTextBox.Clear();
            edicionTextBox.Clear();
            autoresComboBox.Text = null;
            errorProvider1.Clear();

            dataGridView1.DataSource = null;
            libro = new Libros();
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            int id = Utilidades.TOINT(librosIdTextBox.Text);

            using (var db = new DAL.Repositorio <Libros>())
            {
                libro = db.Buscar(p => p.LibrosId == id);

                if (libro != null)
                {
                    nombreTextBox.Text            = libro.Nombre;
                    edicionTextBox.Text           = Convert.ToString(libro.Edicion);
                    autoresComboBox.SelectedValue = libro.Autores;
                    //LLenarDataGrid(libro);
                    MessageBox.Show("Correcto");
                }
                else
                {
                    MessageBox.Show("No existe");
                }
            }
        }