Exemple #1
0
        private void LlenarCamposSegunBaseDeDatosSegunID()
        {
            this.Cursor = Cursors.WaitCursor;

            EmpleadoEN oRegistrosEN = new EmpleadoEN();
            EmpleadoLN oRegistrosLN = new EmpleadoLN();

            oRegistrosEN.IdEmpleado = ValorLlavePrimariaEntidad;

            if (oRegistrosLN.ListadoPorIdentificador(oRegistrosEN, Program.oDatosDeConexioEN))
            {
                if (oRegistrosLN.TraerDatos().Rows.Count > 0)
                {
                    DataRow Fila = oRegistrosLN.TraerDatos().Rows[0];
                    txtNombre.Text            = Fila["Nombre"].ToString();
                    txtApellidos.Text         = Fila["Apellidos"].ToString();
                    txtCedula.Text            = Fila["Cedula"].ToString();
                    txtDireccion.Text         = Fila["Direccion"].ToString();
                    txtTelefono.Text          = Fila["Telefono"].ToString();
                    txtCelular.Text           = Fila["Celular"].ToString();
                    txtCorreoElectronico.Text = Fila["Correo"].ToString();
                    txtNoINSS.Text            = Fila["NoINSS"].ToString();

                    cmbAreaLaboral.SelectedValue = Convert.ToInt32(Fila["IdAreaLaboral"].ToString());
                    cmbCargo.SelectedValue       = Convert.ToInt32(Fila["IdCargo"].ToString());
                    cmbMunicipio.SelectedValue   = Convert.ToInt32(Fila["IdCiudad"].ToString());
                    oRegistrosEN = null;
                    oRegistrosLN = null;
                }
                else
                {
                    string Mensaje;
                    Mensaje = string.Format("El registro solicitado de {0} no ha sido encontrado."
                                            + "\n\r-----Causas---- "
                                            + "\n\r1. Este registro pudo haber sido eliminado por otro usuario."
                                            + "\n\r2. El listado no está actualizado.", Nombre_Entidad);

                    MessageBox.Show(Mensaje, "Listado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    oRegistrosEN = null;
                    oRegistrosLN = null;

                    this.Close();
                }
            }
            else
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show(oRegistrosLN.Error, "Listado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                oRegistrosEN = null;
                oRegistrosLN = null;
            }

            this.Cursor = Cursors.Default;
        }
Exemple #2
0
        private void LlenarEmpleado()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                EmpleadoEN oRegistroEN = new EmpleadoEN();
                EmpleadoLN oRegistroLN = new EmpleadoLN();
                oRegistroEN.Where   = "";
                oRegistroEN.OrderBy = "";

                if (oRegistroLN.ListadoParaCombos(oRegistroEN, Program.oDatosDeConexioEN))
                {
                    cmbEmpleado.DataSource    = oRegistroLN.TraerDatos();
                    cmbEmpleado.DisplayMember = "Nombre";
                    cmbEmpleado.ValueMember   = "IdEmpleado";
                    cmbEmpleado.SelectedIndex = -1;
                }

                else
                {
                    throw new ArgumentException(oRegistroLN.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Información del tipo de cuentas", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Exemple #3
0
        private void LlenarListado()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                EmpleadoEN oRegistroEN = new EmpleadoEN();
                EmpleadoLN oRegistroLN = new EmpleadoLN();

                oRegistroEN.Where = WhereDinamico();

                if (oRegistroLN.Listado(oRegistroEN, Program.oDatosDeConexioEN))
                {
                    dgvLista.Columns.Clear();
                    System.Diagnostics.Debug.Print(oRegistroLN.TraerDatos().Rows.Count.ToString());

                    if (Activar_Filtros == true)
                    {
                        dgvLista.DataSource = AgregarColumnaSeleccionar(oRegistroLN.TraerDatos());
                    }
                    else
                    {
                        dgvLista.DataSource = oRegistroLN.TraerDatos();
                    }

                    FormatearDGV();
                    this.dgvLista.ClearSelection();

                    tsbNoRegistros.Text = "No Registros: " + oRegistroLN.TotalRegistros().ToString();
                }
                else
                {
                    throw new ArgumentException(oRegistroLN.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lelnar listado del registro en la lista", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }