private void EliminarGupoBoton_Click(object sender, EventArgs e) { int id = Convert.ToInt32(IdTextBox.Text); GruposBll.Eliminar(id); MessageBox.Show("Eliminado !"); EstudiantesComboBox.DataSource = EstudiantesBll.GetLista(); Limpiar(); }
private void BuscarEstudiante_Click(object sender, EventArgs e) { var student = EstudiantesBll.Buscar(Convert.ToInt32(IdEsttextBox.Text)); if (student != null) { NombreEstudianteTextBox.Text = student.Nombres; } }
private void AgregarEstBoton_Click(object sender, EventArgs e) { EstudiantesBll.Guardar(new Entidades.Estudiantes() { EstudianteId = Convert.ToInt32(IdEsttextBox.Text), Nombres = NombreEstudianteTextBox.Text }); EstudiantesComboBox.DataSource = EstudiantesBll.GetLista(); }
private void ConsultarBoton_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(searchTextBox.Text)) { lista = EstudiantesBll.GetLista(Utilidades.stringToInt(searchTextBox.Text)); } else { lista = EstudiantesBll.GetLista(); } ListadoDataGridView.DataSource = lista; }
private void Eliminarbutton_Click_1(object sender, EventArgs e) { MyerrorProvider.Clear(); int id; id = Convert.ToInt32(IdnumericUpDown1.Value); Limpiar(); if (EstudiantesBll.Eliminar(id)) { MessageBox.Show("Eliminado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MyerrorProvider.SetError(IdnumericUpDown1, "No se puede eliminar una persona no existente"); } }
private void Buscarbutton_Click_1(object sender, EventArgs e) { int id; Estudiantes estudiante = new Estudiantes(); id = Convert.ToInt32(IdnumericUpDown1.Value); Limpiar(); estudiante = EstudiantesBll.Buscar(id); if (estudiante != null) { MessageBox.Show("Persona Encontrada"); LlenaCampo(estudiante); } else { MessageBox.Show("Persona no Encontrada"); } }
private void Guardarbutton_Click_1(object sender, EventArgs e) { Estudiantes estudiante; bool paso = false; if (!Validar()) { return; } estudiante = LlenaClase(); if (IdnumericUpDown1.Value == 0) { paso = EstudiantesBll.Guardar(estudiante); } else { if (!ExisteEnBaseDeDatos()) { MessageBox.Show("LO SIENTO, no es posible modificar el estudiante, no existe", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = EstudiantesBll.Modificar(estudiante); } if (paso) { Limpiar(); MessageBox.Show("Guardado con exito", "Existe,", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se pudo guardar al Estudiante!!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private bool ExisteEnBaseDeDatos() { Estudiantes estudiante = EstudiantesBll.Buscar((int)IdnumericUpDown1.Value); return(estudiante != null); }
private void Ventana_Load(object sender, EventArgs e) { EstudiantesComboBox.DataSource = EstudiantesBll.GetLista(); EstudiantesComboBox.DisplayMember = "Nombres"; EstudiantesComboBox.ValueMember = "EstudianteId"; }