private void btn_Eliminar_Click(object sender, EventArgs e) { cls_Vuelos_BLL objBLL = new cls_Vuelos_BLL(); string sMsjError = string.Empty; if (dgv_Vuelos.Rows.Count > 0) { if (MessageBox.Show("Realmente desea eliminar?", "Advertencia", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { objBLL.Eliminar_Vuelos(ref sMsjError, dgv_Vuelos.SelectedRows[0].Cells[0].Value.ToString()); if (sMsjError != string.Empty) { MessageBox.Show("Se presento un error a la hora de listar : [ " + sMsjError + " ]", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Registro eliminado correctamente", "Listo", MessageBoxButtons.OK, MessageBoxIcon.Information); CargarDatos(); } txtFiltro.Text = string.Empty; } } else { MessageBox.Show("No hay registros para eliminar"); } }
private void CargarDatos() { cls_Vuelos_BLL objAviones_BLL = new cls_Vuelos_BLL(); string sMsjError = string.Empty; DataTable DT = new DataTable(); if (txtFiltro.Text == string.Empty) { DT = objAviones_BLL.ListarVuelos(ref sMsjError); } else { DT = objAviones_BLL.FiltrarVuelos(ref sMsjError, txtFiltro.Text.Trim()); } if (sMsjError == string.Empty) { dgv_Vuelos.DataSource = null; dgv_Vuelos.DataSource = DT; } else { dgv_Vuelos.DataSource = null; MessageBox.Show("Se presento un error a la hora de listar los estados.\n\nDetalle Error : [" + sMsjError + "]", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGuardar_Click(object sender, EventArgs e) { if (validaciones()) { Obj_Mant_DAL.sIdVuelo = txt_IdVuelo.Text; Obj_Mant_DAL.sIdDestino = cmb_IdDestino.SelectedValue.ToString(); Obj_Mant_DAL.sIdAvion = cmb_IdAvion.SelectedValue.ToString(); Obj_Mant_DAL.iIdAerolinea = Convert.ToInt16(cmb_IdAerolinea.SelectedValue.ToString()); Obj_Mant_DAL.cIdEstado = Convert.ToChar(cmb_IdEstado.SelectedValue.ToString()); Obj_Mant_DAL.dtFechaHoraSalida = time_HoraSalida.Value; Obj_Mant_DAL.dtFechaHoraLLegada = time_HoraLlegada.Value; cls_Vuelos_BLL Obj_Mant_BLL = new cls_Vuelos_BLL(); string sMsjError = string.Empty; if (Obj_Mant_DAL.cbanderaAccion == 'I') { Obj_Mant_BLL.AgregarVuelos(ref sMsjError, ref Obj_Mant_DAL); if (sMsjError == string.Empty) { MessageBox.Show("Vuelo agregado correctamente", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); labelAccion.Text = "Modificar"; } else { MessageBox.Show(sMsjError.ToString()); labelAccion.Text = "Guardar"; } } else { Obj_Mant_BLL.ModificarVuelos(ref sMsjError, ref Obj_Mant_DAL); if (sMsjError == string.Empty) { MessageBox.Show("Vuelo Modificado correctamente", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(sMsjError.ToString()); } } } else { MessageBox.Show("No se pudo completar la acción", "Eror en la acción", MessageBoxButtons.OK, MessageBoxIcon.Information); } }