private void EliminarButton_Click(object sender, EventArgs e) { MyErrorProvider.Clear(); int id; int.TryParse(PasanteIdNumericUpDown.Text, out id); if (PasanteIdNumericUpDown.Value == 0) { MessageBox.Show("Debes agregar un id valido para poder eliminarlo.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!PasantesBLL.Existe(id)) { MessageBox.Show("Pasante Inexistente!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (MessageBox.Show("Deseas eliminar este pasante?", "Validar", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (PasantesBLL.Eliminar(id)) { MessageBox.Show("Transaccion Exitosa", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); Limpiar(); } else { MyErrorProvider.SetError(PasanteIdNumericUpDown, "Agrega un id Valido. Este no Existe"); } } } }
private void BuscarButton_Click(object sender, EventArgs e) { var listado = new List <Pasantes>(); if (!string.IsNullOrEmpty(InformacionTextBox.Text)) { switch (FiltroComboBox.SelectedIndex) { case 0: listado = PasantesBLL.GetList(r => r.PasanteId == Utilitarios.ToInt(InformacionTextBox.Text)); break; case 1: listado = PasantesBLL.GetList(r => r.Nombre.Contains(InformacionTextBox.Text)); break; case 2: listado = PasantesBLL.GetList(r => r.Matricula == Utilitarios.ToInt(InformacionTextBox.Text)); break; case 3: listado = PasantesBLL.GetList(r => r.Institucion.Contains(InformacionTextBox.Text)); break; case 4: listado = PasantesBLL.GetList(r => r.HorasARealizar == Utilitarios.ToInt(InformacionTextBox.Text)); break; } } else { listado = PasantesBLL.GetList(c => true); } if (FiltroCheckBox.Checked == true) { listado = PasantesBLL.GetList(e => e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date); } if (ActivoRadioButton.Checked == true) { listado = PasantesBLL.GetList(e => e.Activo == true); } if (InactivoRadioButton.Checked == true) { listado = PasantesBLL.GetList(e => e.Activo == false); } PasantesDataGridView.DataSource = null; PasantesDataGridView.DataSource = listado; }
private void BuscarButton_Click(object sender, EventArgs e) { MyErrorProvider.Clear(); Pasantes pasante; int id; int.TryParse(PasanteIdNumericUpDown.Text, out id); Limpiar(); pasante = PasantesBLL.Buscar(id); if (pasante != null) { LlenaCampo(pasante); } else { MessageBox.Show("Pasante no encontrado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void GuardarButton_Click(object sender, EventArgs e) { MyErrorProvider.Clear(); Pasantes pasante; MyErrorProvider.Clear(); if (!Validar()) { return; } pasante = LlenaClase(); bool paso = PasantesBLL.Guardar(pasante); if (paso) { Limpiar(); MessageBox.Show("Transaccion Exitosa!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Transaccion Fallida!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }