Exemplo n.º 1
0
        private void CargarDatos()
        {
            cls_TiposEmpleados_BLL Obj_Tipos_Empleados__BLL = new cls_TiposEmpleados_BLL();
            string    sMsjError = string.Empty;
            DataTable dtEstados = new DataTable();

            if (txtFiltro.Text == string.Empty)
            {
                dtEstados = Obj_Tipos_Empleados__BLL.ListarTiposEmpleados(ref sMsjError);
            }
            else
            {
                dtEstados = Obj_Tipos_Empleados__BLL.FiltrarTiposEmpleados(ref sMsjError, txtFiltro.Text.Trim());
            }

            if (sMsjError == string.Empty)
            {
                dgv_view.DataSource = null;
                dgv_view.DataSource = dtEstados;
            }
            else
            {
                dgv_view.DataSource = null;
                MessageBox.Show("Se Presentó un error : [ " + sMsjError + " ].", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        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();
            }
        }