private void btn_Eliminar_Click(object sender, EventArgs e) { cls_Aerolineas_BLL objBLL = new cls_Aerolineas_BLL(); string sMsjError = string.Empty; if (dgv_Aerolineas.Rows.Count > 0) { if (MessageBox.Show("Realmente desea eliminar?", "Advertencia", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { objBLL.Eliminar_Aerolineas(ref sMsjError, dgv_Aerolineas.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_Aerolineas_BLL objAerolineas_BLL = new cls_Aerolineas_BLL(); string sMsjError = string.Empty; DataTable DT = new DataTable(); if (txtFiltro.Text == string.Empty) { DT = objAerolineas_BLL.ListarAerolineas(ref sMsjError); } else { DT = objAerolineas_BLL.FiltrarAerolineas(ref sMsjError, txtFiltro.Text.Trim()); } if (sMsjError == string.Empty) { dgv_Aerolineas.DataSource = null; dgv_Aerolineas.DataSource = DT; } else { dgv_Aerolineas.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 btn_Guardar_Click(object sender, EventArgs e) { if (cmb_IdEstado.SelectedValue.ToString() != "0" && txt_NombreAerolinea.Text != string.Empty) { if (txt_NombreAerolinea.Text.Length >= 2) { cls_Aerolineas_BLL objBLL_Aerolineas = new cls_Aerolineas_BLL(); string sMsjError = string.Empty; objDAL_Aerolinea.cIdEstado = Convert.ToChar(cmb_IdEstado.SelectedValue.ToString()); objDAL_Aerolinea.sNombreAerolinea = txt_NombreAerolinea.Text; if (objDAL_Aerolinea.cBandera == 'I') { objBLL_Aerolineas.Insertar_Aerolineas(ref sMsjError, ref objDAL_Aerolinea); if (sMsjError == string.Empty) { MessageBox.Show("Se han ingresado los datos correctamente", "INFO"); txt_IdAerolinea.Text = objDAL_Aerolinea.iIdAerolinea.ToString(); objDAL_Aerolinea.cBandera = 'U'; toolStripLabel1.Text = "Modificar"; } else { MessageBox.Show("Se presentó un error al tratar de guardar el registro" + "[ " + sMsjError + " ]"); } } else { objBLL_Aerolineas.Modificar_Aerolineas(ref sMsjError, ref objDAL_Aerolinea); if (sMsjError == string.Empty) { MessageBox.Show("Se han ingresado los datos correctamente", "INFO"); objDAL_Aerolinea.cBandera = 'U'; } else { MessageBox.Show("Se presentó un error al tratar de modificar el registro" + "[ " + sMsjError + " ]"); } } } else { MessageBox.Show("Los datos que intententa ingresar no son válidos para un nombre de una aerolinea", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } else { MessageBox.Show("Todos los campos son obligatorios", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void CargarDatos() { if (Obj_Destinos_DAL != null) { string sMsjError = string.Empty; #region Aerolineas cls_Aerolineas_BLL ObjAerolinea = new cls_Aerolineas_BLL(); DataTable DTA = new DataTable(); DTA = ObjAerolinea.ListarAerolineas(ref sMsjError); cmboxAerolinea.DataSource = DTA; DTA.Rows.Add("0", "Seleccione una aerolinea"); cmboxAerolinea.DisplayMember = DTA.Columns[1].ToString(); cmboxAerolinea.ValueMember = DTA.Columns[0].ToString(); cmboxAerolinea.SelectedValue = "0"; #endregion #region Paises cls_Paises_BLL ObjPaises = new cls_Paises_BLL(); DataTable DTP = new DataTable(); DataTable DTP1 = new DataTable(); DTP = ObjPaises.ListarPaises(ref sMsjError); DTP1 = ObjPaises.ListarPaises(ref sMsjError); cmboxPaisLlegada.DataSource = DTP; cmboxPaisSalida.DataSource = DTP1; DTP.Rows.Add("0", "Seleccione un país"); DTP1.Rows.Add("0", "Seleccione un país"); cmboxPaisSalida.DisplayMember = DTP1.Columns[1].ToString(); cmboxPaisLlegada.DisplayMember = DTP.Columns[1].ToString(); cmboxPaisSalida.ValueMember = DTP1.Columns[0].ToString(); cmboxPaisLlegada.ValueMember = DTP.Columns[0].ToString(); cmboxPaisLlegada.SelectedValue = "0"; cmboxPaisSalida.SelectedValue = "0"; #endregion #region Estados cls_Estados_BLL ObjEstados = new cls_Estados_BLL(); DataTable DT = new DataTable(); DT = ObjEstados.Listar_Estados(ref sMsjError); cmboxEstado.DataSource = DT; DT.Rows.Add("0", "Seleccione un estado"); cmboxEstado.DisplayMember = DT.Columns[1].ToString(); cmboxEstado.ValueMember = DT.Columns[0].ToString(); cmboxEstado.SelectedValue = "0"; #endregion if (Obj_Destinos_DAL.cBandera == 'I') { txt_IdDestino.Clear(); txt_NombreDestino.Clear(); } else { toolStripLabel1.Text = "Modificar"; txt_IdDestino.Text = Obj_Destinos_DAL.sIdDestino; txt_IdDestino.Enabled = false; cmboxAerolinea.SelectedValue = Obj_Destinos_DAL.bIdAerolinea.ToString(); txt_NombreDestino.Text = Obj_Destinos_DAL.sNomDestino; cmboxPaisSalida.SelectedValue = Obj_Destinos_DAL.bPaisSalida.ToString(); cmboxPaisLlegada.SelectedValue = Obj_Destinos_DAL.bPaisLlegada.ToString(); cmboxEstado.SelectedValue = Obj_Destinos_DAL.cIdEstado.ToString(); } } else { MessageBox.Show("Se presentó un error, contacte al administrador", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
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(); } }
private void CargarDatos() { cls_BaseDatos_DAL objDAL_BaseDatos = new cls_BaseDatos_DAL(); if (objDal_Aviones != null) { #region Combo Estados 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 una opcion--"); cmb_IdEstado.DataSource = DTE; cmb_IdEstado.DisplayMember = DTE.Columns[1].ToString(); cmb_IdEstado.ValueMember = DTE.Columns[0].ToString(); cmb_IdEstado.SelectedValue = "0"; #endregion #region Combo Aero cls_Aerolineas_BLL ObjAero = new cls_Aerolineas_BLL(); DataTable DTA = new DataTable(); DTA = ObjAero.ListarAerolineas(ref sMsjError); DTA.Rows.Add("0", "--Seleccione una opcion--"); cmb_IdAerolinea.DataSource = DTA; cmb_IdAerolinea.DisplayMember = DTA.Columns[1].ToString(); cmb_IdAerolinea.ValueMember = DTA.Columns[0].ToString(); cmb_IdAerolinea.SelectedValue = "0"; #endregion #region Combo TipoA cls_TiposA_BLL ObjTiposA = new cls_TiposA_BLL(); DataTable DTTA = new DataTable(); DTTA = ObjTiposA.ListarTiposA(ref sMsjError); DTTA.Rows.Add("0", "--Seleccione una opcion--"); cmb_IdTipoAvion.DataSource = DTTA; cmb_IdTipoAvion.DisplayMember = DTTA.Columns[1].ToString(); cmb_IdTipoAvion.ValueMember = DTTA.Columns[0].ToString(); cmb_IdTipoAvion.SelectedValue = "0"; #endregion if (objDal_Aviones.cBandera == 'I') { txt_IdAvion.Clear(); txt_DescAvion.Clear(); txt_NomAvion.Clear(); txt_IdAvion.Enabled = true; } else { toolStripLabel1.Text = "Modificar"; txt_DescAvion.Text = objDal_Aviones.sDescAvion; txt_IdAvion.Text = objDal_Aviones.sIdAvion; txt_NomAvion.Text = objDal_Aviones.sNomAvion; cmb_IdAerolinea.SelectedValue = objDal_Aviones.iIdAerolinea.ToString(); cmb_IdEstado.SelectedValue = objDal_Aviones.cIdEstado.ToString(); cmb_IdTipoAvion.SelectedValue = objDal_Aviones.sIdTipoAvion.ToString(); txt_IdAvion.Enabled = false; } } else { MessageBox.Show("Se presento un capa 8 del programador"); Close(); } }
public void CargarDatos() { if (Obj_Empleados_DAL != null) { string M_Error = string.Empty; #region Estados cls_Estados_BLL ObjEstados = new cls_Estados_BLL(); DataTable DT_Estados = new DataTable(); DT_Estados = ObjEstados.Listar_Estados(ref M_Error); cb_Estado.DataSource = DT_Estados; DT_Estados.Rows.Add("0", "-- Seleccione un valor --"); cb_Estado.DisplayMember = DT_Estados.Columns[1].ToString(); cb_Estado.ValueMember = DT_Estados.Columns[0].ToString(); cb_Estado.SelectedValue = "0"; #endregion #region ID Tipo Empleado cls_TiposEmpleados_BLL ObjTipoEmpleados = new cls_TiposEmpleados_BLL(); DataTable DT_TipoEmpleados = new DataTable(); DT_TipoEmpleados = ObjTipoEmpleados.ListarTiposEmpleados(ref M_Error); DT_TipoEmpleados.Rows.Add("0", "-- Seleccione un valor --"); cb_TipoEmpleado.DataSource = DT_TipoEmpleados; cb_TipoEmpleado.DisplayMember = DT_TipoEmpleados.Columns[1].ToString(); cb_TipoEmpleado.ValueMember = DT_TipoEmpleados.Columns[0].ToString(); cb_TipoEmpleado.SelectedValue = "0"; #endregion #region ID Aerolinea cls_Aerolineas_BLL ObjAerolinea = new cls_Aerolineas_BLL(); DataTable DT_Aerolinea = new DataTable(); DT_Aerolinea = ObjAerolinea.ListarAerolineas(ref M_Error); DT_Aerolinea.Rows.Add("0", "-- Seleccione un valor --"); cb_IdAerolinea.DataSource = DT_Aerolinea; cb_IdAerolinea.DisplayMember = DT_Aerolinea.Columns[1].ToString(); cb_IdAerolinea.ValueMember = DT_Aerolinea.Columns[0].ToString(); cb_IdAerolinea.SelectedValue = "0"; #endregion if (Obj_Empleados_DAL.cBandera == 'I') { txt_Direccion.Clear(); txt_Nombre.Clear(); txt_Apellidos.Clear(); txt_Edad.Clear(); txt_IdEmpleado.Clear(); txt_Salario.Clear(); txt_Cedula.Clear(); txt_Celular.Clear(); txt_TelCasa.Clear(); txt_TelRef.Clear(); } else { toolStripLabel1.Text = "Modificar"; txt_Direccion.Text = Obj_Empleados_DAL.sDireccion; txt_Nombre.Text = Obj_Empleados_DAL.sNombre; txt_Apellidos.Text = Obj_Empleados_DAL.sApellidos; txt_Edad.Text = Obj_Empleados_DAL.bEdad.ToString().Trim(); txt_IdEmpleado.Text = Obj_Empleados_DAL.sIdEmpleado.ToString().Trim(); txt_Salario.Text = Obj_Empleados_DAL.dSalario.ToString().Trim(); txt_Cedula.Text = Obj_Empleados_DAL.iCedula.ToString().Trim(); txt_Celular.Text = Obj_Empleados_DAL.iCelular.ToString().Trim(); txt_TelCasa.Text = Obj_Empleados_DAL.iTelCasa.ToString().Trim(); txt_TelRef.Text = Obj_Empleados_DAL.iTelRef.ToString().Trim(); cb_Estado.SelectedValue = Obj_Empleados_DAL.cIdEstado.ToString().Trim(); cb_IdAerolinea.SelectedValue = Obj_Empleados_DAL.iIdAerolinea.ToString().Trim(); cb_TipoEmpleado.SelectedValue = Obj_Empleados_DAL.iIdTipoEmpleado.ToString().Trim(); } } else { MessageBox.Show("Se presentó un error \nContacte al administrador", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }