Exemple #1
0
        private void tex_isbn_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((int)e.KeyChar == (int)Keys.Enter)
            {
                try
                {
                    ingreso    = 1;
                    lib.v_isbn = tex_isbn.Text;

                    if ((lib.ConsultarLibroAI(lib)).v_isbn.Length != 0)
                    {
                        tex_isbn.Text    = lib.v_isbn;
                        tex_titulo.Text  = lib.v_titulo;
                        tex_edicion.Text = lib.v_edicion;
                        tex_autor.Text   = lib.v_autor;
                        tex_año.Text     = lib.v_año;

                        tex_isbn.Enabled    = false;
                        tex_año.Enabled     = true;
                        tex_autor.Enabled   = true;
                        tex_edicion.Enabled = true;
                        tex_titulo.Enabled  = true;

                        if (lib.v_estado == 'I')
                        {
                            che_activar_libro.Enabled = true;
                            che_activar_libro.Checked = false;
                        }

                        this.mostrarLista();
                        com_idioma.Enabled     = true;
                        com_tipo_libro.Enabled = true;
                        com_editorial.Enabled  = true;
                    }
                }
                catch (SqlException ex)
                {
                    for (int i = 0; i < ex.Errors.Count; i++)
                    {
                        errorMessages.Append("Index #" + i + "\n" +
                                             "Message: " + ex.Errors[i].Message + "\n" +
                                             "LineNumber: " + ex.Errors[i].LineNumber + "\n" +
                                             "Source: " + ex.Errors[i].Source + "\n" +
                                             "Procedure: " + ex.Errors[i].Procedure + "\n");
                    }
                    Console.WriteLine(errorMessages.ToString());
                    this.inicializarDatos();
                    MessageBox.Show(ex.Errors[0].Message.ToString(),
                                    "Modificar Libro",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                    ingreso = 0;
                }
            }
        }