private void tls_btn_Eliminar_Click(object sender, EventArgs e) { cls_Destinos_BLL objBLL = new cls_Destinos_BLL(); string sMsjError = string.Empty; if (dgv_Destinos.Rows.Count > 0) { if (MessageBox.Show("Realmente desea eliminar?", "Advertencia", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { objBLL.Eliminar_Destinos(ref sMsjError, dgv_Destinos.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(); } tls_txt_Filtro.Text = string.Empty; } } else { MessageBox.Show("No hay registros para eliminar"); } }
private void CargarDatos() { cls_Destinos_BLL ObjDestinos_BLL = new cls_Destinos_BLL(); string sMsjError = string.Empty; DataTable dtEstados = new DataTable(); if (tls_txt_Filtro.Text == string.Empty) { dtEstados = ObjDestinos_BLL.ListarDestinos(ref sMsjError); } else { dtEstados = ObjDestinos_BLL.FiltrarDestinos(ref sMsjError, tls_txt_Filtro.Text.Trim()); } if (sMsjError == string.Empty) { dgv_Destinos.DataSource = null; dgv_Destinos.DataSource = dtEstados; } else { dgv_Destinos.DataSource = null; MessageBox.Show("Se Presentó un error : [ " + sMsjError + " ].", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGuardar_Click(object sender, EventArgs e) { if ((cmboxAerolinea.SelectedValue.ToString() != "0") && (cmboxPaisLlegada.SelectedValue.ToString() != "0") && (cmboxPaisSalida.SelectedValue.ToString() != "0") && (cmboxEstado.SelectedValue.ToString() != "0") && (txt_IdDestino.Text != string.Empty) && (txt_NombreDestino.Text != string.Empty)) { cls_Destinos_BLL ObjDestinos_BLL = new cls_Destinos_BLL(); string sMsjError = string.Empty; Obj_Destinos_DAL.sIdDestino = txt_IdDestino.Text; Obj_Destinos_DAL.bIdAerolinea = Convert.ToByte(cmboxAerolinea.SelectedValue); Obj_Destinos_DAL.sNomDestino = txt_NombreDestino.Text; Obj_Destinos_DAL.bPaisSalida = Convert.ToByte(cmboxPaisSalida.SelectedValue); Obj_Destinos_DAL.bPaisLlegada = Convert.ToByte(cmboxPaisLlegada.SelectedValue); Obj_Destinos_DAL.cIdEstado = Convert.ToChar(cmboxEstado.SelectedValue); if (Obj_Destinos_DAL.cBandera == 'I') { ObjDestinos_BLL.Insertar_Destinos(ref sMsjError, ref Obj_Destinos_DAL); txt_IdDestino.Enabled = false; toolStripLabel1.Text = "Modificar"; } else { ObjDestinos_BLL.Modificar_Destinos(ref sMsjError, ref Obj_Destinos_DAL); } if (sMsjError == string.Empty) { MessageBox.Show("Se han ingresado los datos correctamente", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txt_IdDestino.Text = Obj_Destinos_DAL.sIdDestino.ToString(); Obj_Destinos_DAL.cBandera = 'U'; } } else { MessageBox.Show("Se encuentran cajas de texto vacías u opciones sin elegir, favor revisar", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void cargarDatos() { if (Obj_Mant_DAL != null) { #region CargarDatos IdDestino cls_Destinos_BLL ObjBLLDestinos = new cls_Destinos_BLL(); string sMsjErrorDEestido = string.Empty; DataTable DTEDestino = new DataTable(); DTEDestino = ObjBLLDestinos.ListarDestinos(ref sMsjErrorDEestido); DTEDestino.Rows.Add("0", 1, "-- SELECCIONE UN DESTINO --", 2, 3, 'a'); cmb_IdDestino.DataSource = DTEDestino; cmb_IdDestino.DisplayMember = DTEDestino.Columns[2].ToString(); cmb_IdDestino.ValueMember = DTEDestino.Columns[0].ToString(); cmb_IdDestino.SelectedValue = "0"; #endregion #region CargarDatos IdAerolinea cls_Aerolineas_BLL ObjBLLAerolinea = new cls_Aerolineas_BLL(); string sMsjErrorAerolinea = string.Empty; DataTable DTEAerolinea = new DataTable(); DTEAerolinea = ObjBLLAerolinea.ListarAerolineas(ref sMsjErrorAerolinea); DTEAerolinea.Rows.Add("0", "-- SELECCIONE UNA AEROLINEA --", 'a'); cmb_IdAerolinea.DataSource = DTEAerolinea; cmb_IdAerolinea.DisplayMember = DTEAerolinea.Columns[1].ToString(); cmb_IdAerolinea.ValueMember = DTEAerolinea.Columns[0].ToString(); cmb_IdAerolinea.SelectedValue = "0"; #endregion #region CargarDatos IdAvion cls_Aviones_BLL ObjBLLAvion = new cls_Aviones_BLL(); string sMsjErrorAvion = string.Empty; DataTable DTEAvion = new DataTable(); DTEAvion = ObjBLLAvion.ListarAvion(ref sMsjErrorAvion); DTEAvion.Rows.Add("0", "-- SELECCIONE UN AVION --", "0", 0, "0", 'a'); cmb_IdAvion.DataSource = DTEAvion; cmb_IdAvion.DisplayMember = DTEAvion.Columns[1].ToString(); cmb_IdAvion.ValueMember = DTEAvion.Columns[0].ToString(); cmb_IdAvion.SelectedValue = "0"; #endregion #region CargarDatos IdEstados cls_Estados_BLL ObjBLLEstados = new cls_Estados_BLL(); string sMsjError = string.Empty; DataTable DTE = new DataTable(); DTE = ObjBLLEstados.Listar_Estados(ref sMsjError); DTE.Rows.Add("0", "-- SELECCIONE UN ESTADO --"); cmb_IdEstado.DataSource = DTE; cmb_IdEstado.DisplayMember = DTE.Columns[1].ToString(); cmb_IdEstado.ValueMember = DTE.Columns[0].ToString(); cmb_IdEstado.SelectedValue = "0"; #endregion if (Obj_Mant_DAL.cbanderaAccion == 'I') { txt_IdVuelo.Enabled = true; txt_IdVuelo.SelectAll(); txt_IdVuelo.Focus(); } else { txt_IdVuelo.Enabled = false; txt_IdVuelo.Text = Obj_Mant_DAL.sIdVuelo.ToString().Trim(); } } else { MessageBox.Show("Se presentó un error, contacte a soporte", "Error datos", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }