Example #1
0
        private void Eliminarbutton_Click_1(object sender, EventArgs e)
        {
            SupererrorProvider.Clear();
            int id;

            int.TryParse(IDnumericUpDown.Text, out id);

            if (LibroBLL.Eliminar(id))
            {
                MessageBox.Show("Eliminado");
            }
            else
            {
                SupererrorProvider.SetError(IDnumericUpDown, "No se puede eliminar un libro que no existe");
            }
        }
Example #2
0
        private void Buscarbutton_Click_1(object sender, EventArgs e)
        {
            SupererrorProvider.Clear();
            int   id;
            Libro libro = new Libro();

            int.TryParse(IDnumericUpDown.Text, out id);

            libro = LibroBLL.Buscar(id);

            if (libro != null)
            {
                MessageBox.Show("Libro Encontrado");
                LlenaCampo(libro);
            }
            else
            {
                MessageBox.Show("Persona no encontrada");
            }
        }
Example #3
0
        private bool GuardarValidar()
        {
            bool paso = true;

            if (DescripciontextBox.Text == string.Empty || SiglasTextBox.Text == string.Empty)
            {
                if (DescripciontextBox.Text == string.Empty)
                {
                    SupererrorProvider.SetError(DescripciontextBox, "No puede dejar este campo vacio");
                    DescripciontextBox.Focus();
                }
                if (SiglasTextBox.Text == string.Empty)
                {
                    SupererrorProvider.SetError(SiglasTextBox, "No puede dejar este campo vacio");
                    SiglasTextBox.Focus();
                }

                paso = false;
            }

            return(paso);
        }
Example #4
0
        private void Guardarbutton_Click_1(object sender, EventArgs e)
        {
            SupererrorProvider.Clear();
            int id;

            int.TryParse(IDnumericUpDown.Text, out id);
            Libro Libro = LibroBLL.Buscar(id);
            Libro libro = Llenaclase();

            if (libro == null)
            {
                if (GuardarValidar())
                {
                    if (LibroBLL.Guardar(libro))
                    {
                        MessageBox.Show("Libro guardado");
                    }
                    else
                    {
                        MessageBox.Show("Libro no guardado");
                    }
                }
            }
            else
            {
                if (GuardarValidar())
                {
                    if (LibroBLL.Modificar(libro))
                    {
                        MessageBox.Show("Persona modificada");
                    }
                    else
                    {
                        MessageBox.Show("Persona no modificada");
                    }
                }
            }
        }