private void usuarioToolStripMenuItem_Click(object sender, EventArgs e) { //AgregarUsuario int dni; VentanaSecundaria vc = new VentanaSecundaria(); vc.labNomAp.Text = "Nombre y Apellido: "; vc.labDni.Text = "DNI: "; vc.labMail.Text = "E-Mail: "; usuarios = biblio.RetornarListaDeUsuarios(); while (vc.ShowDialog() == DialogResult.Retry) { if (vc.tbxDni.Text != "" && vc.tbxNomAp.Text != "" && vc.tbxMail.Text != "") { try { dni = Convert.ToInt32(vc.tbxDni.Text); Usuario unUsuario = new Usuario(vc.tbxNomAp.Text, vc.tbxMail.Text, dni); autoCompleteDni.Add(vc.tbxDni.Text); biblio.AgregarUsuario(unUsuario);//vc.tbxNomAp.Text, vc.tbxMail.Text, dni); usuarios = biblio.RetornarListaDeUsuarios(); MessageBox.Show("El usuario fue cargado exitosamente"); //this.ActualizarListarUsuarios(); vc.tbxNomAp.Clear(); vc.tbxDni.Clear(); vc.tbxMail.Clear(); } catch (FormatException ez) { MessageBox.Show("Error!" + " " + ez.Message); } catch (Exception ez) { MessageBox.Show("Error!" + " " + ez.Message); } } else { MessageBox.Show("Falta llenar un campo"); } } vc.Dispose(); }
private void toolStripMenuItem2_Click(object sender, EventArgs e) { VentanaSecundaria vc = new VentanaSecundaria(); vc.labNomAp.Text = "Titulo del libro: "; vc.labDni.Text = "Codigo ISBN: "; vc.labMail.Text = "Autor del libro: "; //vc.tbxDni.MaxLength = 17; vc.tbxNomAp.Text = nomAp; vc.tbxDni.Text = numDoc; vc.tbxMail.Text = mail; if (isbnSeleccionado != "") { if (vc.ShowDialog() == DialogResult.Retry) { Libro milibro; milibro = biblio.EditarLibro(isbnSeleccionado); milibro = new Libro(vc.tbxDni.Text, vc.tbxNomAp.Text, vc.tbxMail.Text); if (!milibro.Estado) { biblio.AgregarLibro(milibro); libros = biblio.RetornarListaDeLibros(); //this.ActulizarListarLibros(); } else { MessageBox.Show("ISBN invalido verifiquelo e ingreselo nuevamente"); } } } else { MessageBox.Show("No se puede editar, si no hay ningun libro seleccionado"); } //vc.tbxDni.MaxLength = 32767; vc.Dispose(); }
private void libroToolStripMenuItem_Click(object sender, EventArgs e) { VentanaSecundaria vc = new VentanaSecundaria(); vc.labNomAp.Text = "Titulo del libro: "; vc.labDni.Text = "Codigo ISBN: "; vc.labMail.Text = "Autor del libro: "; libros = biblio.RetornarListaDeLibros(); while (vc.ShowDialog() == DialogResult.Retry) { if (vc.tbxDni.Text != "" && vc.tbxNomAp.Text != "" && vc.tbxMail.Text != "") { Libro unLibro = new Libro(vc.tbxDni.Text, vc.tbxNomAp.Text, vc.tbxMail.Text); if (!unLibro.Estado) { biblio.AgregarLibro(unLibro);//vc.tbxNomAp.Text, vc.tbxMail.Text, dni); libros = biblio.RetornarListaDeLibros(); MessageBox.Show("El Libro fue cargado exitosamente"); //this.ActulizarListarLibros(); vc.tbxNomAp.Clear(); vc.tbxDni.Clear(); vc.tbxMail.Clear(); } else { MessageBox.Show("Codigo ISBN Invalido por favor verifique que dicho codigo sea correcto e ingreselo de nuevo"); } } else { MessageBox.Show("Falta llenar un campo"); } } }
private void usuarioToolStripMenuItem1_Click(object sender, EventArgs e) { //Editar Usuario VentanaSecundaria vc = new VentanaSecundaria(); vc.tbxNomAp.Text = nomAp; vc.tbxDni.Text = numDoc; vc.tbxMail.Text = mail; if (dniSeleccionado != 0) { if (vc.ShowDialog() == DialogResult.Retry) { Usuario miUsuario; miUsuario = biblio.EditarUsuario(dniSeleccionado); if (vc.tbxDni.Text != miUsuario.Dni().ToString()) { autoCompleteDni.Remove(miUsuario.Dni().ToString()); autoCompleteDni.Add(vc.tbxDni.Text); } miUsuario = new Usuario(vc.tbxNomAp.Text, vc.tbxMail.Text, Convert.ToInt32(vc.tbxDni.Text)); biblio.AgregarUsuario(miUsuario); usuarios = biblio.RetornarListaDeUsuarios(); //this.ActualizarListarUsuarios(); } } else { MessageBox.Show("No se puede editar, si no hay ningun usuario seleccionado"); } vc.Dispose(); }
private void ejemplarToolStripMenuItem1_Click(object sender, EventArgs e) { VentanaSecundaria vc = new VentanaSecundaria(); vc.labNomAp.Text = "Titulo del libro: "; vc.labDni.Text = "Codigo ISBN: "; vc.labMail.Text = "Autor del libro: "; //vc.tbxDni.MaxLength = 17; vc.tbxNomAp.Text = nomAp; vc.tbxDni.Text = numDoc; vc.tbxMail.Text = mail; vc.tbxDni.Enabled = false; vc.tbxNomAp.Enabled = false; vc.tbxMail.Enabled = false; vc.tbxCodPat.Enabled = false; vc.labUbicacion.Visible = true; vc.labCodPat.Visible = true; vc.tbxUbicacion.Visible = true; vc.tbxCodPat.Visible = true; vc.cbEstadoEjemplar.Visible = true; vc.cbDarDeBaja.Visible = true; vc.Width = 570; vc.cbEstadoEjemplar.Checked = dis; vc.tbxCodPat.Text = numPatSeleccionado.ToString("0000"); ejemplares = biblio.RetornarListaDeEjemplar(); if (numPatSeleccionado > -1) { if (vc.ShowDialog() == DialogResult.Retry) { Ejemplar miEj; miEj = biblio.BuscarEjemplar(numPatSeleccionado); if (vc.tbxUbicacion.Text != "" && vc.tbxCodPat.Text != "") { Libro milibro; milibro = biblio.BuscarLibro(miEj.ISBNEj); biblio.EliminarEjemplar(numPatSeleccionado); miEj = new Ejemplar(vc.tbxUbicacion.Text, Convert.ToInt32(vc.tbxCodPat.Text), milibro); biblio.AgregarEjemplar(miEj); if (vc.cbEstadoEjemplar.Checked) { miEj.Disponible(); } else { miEj.NoDisponible(); } if (vc.cbDarDeBaja.Checked) { miEj.DarDeBaja = true; miEj.NoDisponible(); } else { miEj.DarDeBaja = false; } ejemplares = biblio.RetornarListaDeEjemplar(); MessageBox.Show("Ejemplar cargado con exito!"); //this.ActulizarListarEjemplares(); } else { MessageBox.Show("Falta completar algun campo!"); } } } else { MessageBox.Show("No se puede editar, si no hay ningun ejemplar seleccionado"); } vc.tbxNomAp.Clear(); vc.tbxDni.Clear(); vc.tbxMail.Clear(); vc.tbxDni.Enabled = true; vc.tbxNomAp.Enabled = true; vc.tbxMail.Enabled = true; vc.tbxCodPat.Enabled = false; vc.labUbicacion.Visible = false; vc.labCodPat.Visible = false; vc.tbxUbicacion.Visible = false; vc.tbxCodPat.Visible = false; vc.cbEstadoEjemplar.Visible = false; vc.cbDarDeBaja.Visible = false; vc.Width = 315; vc.Dispose(); }
private void ejemplarToolStripMenuItem_Click(object sender, EventArgs e) { /*Cambiar el boleano de la clase y del form * que siempre este disponible al * principio! Y que despues lo puedas * cambiar a NO disponible*/ VentanaSecundaria vc = new VentanaSecundaria(); if (isbnSeleccionado != "") { vc.labNomAp.Text = "Titulo del libro: "; vc.labDni.Text = "Codigo ISBN: "; vc.labMail.Text = "Autor del libro: "; //vc.tbxDni.MaxLength = 17; vc.tbxNomAp.Text = nomAp; vc.tbxDni.Text = numDoc; vc.tbxMail.Text = mail; vc.tbxDni.Enabled = false; vc.tbxNomAp.Enabled = false; vc.tbxMail.Enabled = false; vc.tbxCodPat.Enabled = false; vc.labUbicacion.Visible = true; vc.labCodPat.Visible = true; vc.tbxUbicacion.Visible = true; vc.tbxCodPat.Visible = true; vc.cbEstadoEjemplar.Visible = true; vc.Width = 570; //Cambiar las propiedades de los componentes ejemplares = biblio.RetornarListaDeEjemplar(); while (vc.ShowDialog() == DialogResult.Retry) { if (vc.tbxUbicacion.Text != "") { Libro milibro; //Hacer un metodo buscar libro milibro = biblio.BuscarLibro(isbnSeleccionado); Ejemplar ej = new Ejemplar(vc.tbxUbicacion.Text, milibro); vc.tbxCodPat.Text = ej.NumPatrimonial.ToString("0000"); autoCompleteCodPat.Add(ej.NumPatrimonial.ToString("0000")); biblio.AgregarEjemplar(ej);//vc.tbxNomAp.Text, vc.tbxMail.Text, dni); if (!vc.cbEstadoEjemplar.Checked) { ej.NoDisponible(); } else { ej.Disponible(); } ejemplares = biblio.RetornarListaDeEjemplar(); MessageBox.Show("El ejemplar fue cargado con exito"); //this.ActulizarListarEjemplares(); } else { MessageBox.Show("Falta llenar un campo"); } } } else { vc.Close(); vc.Dispose(); MessageBox.Show("Asegurese de seleccionar un Libro para poder agregar un ejemplar"); } vc.tbxNomAp.Clear(); vc.tbxDni.Clear(); vc.tbxMail.Clear(); vc.tbxDni.Enabled = true; vc.tbxNomAp.Enabled = true; vc.tbxMail.Enabled = true; vc.tbxCodPat.Enabled = false; vc.labUbicacion.Visible = false; vc.labCodPat.Visible = false; vc.tbxUbicacion.Visible = false; vc.tbxCodPat.Visible = false; vc.cbEstadoEjemplar.Visible = false; vc.Width = 315; vc.Dispose(); }