Example #1
0
        private void btoMostrar_Click(object sender, EventArgs e)
        {
            ngRRHH car = new ngRRHH();

            this.dgListadoCargos.DataSource = car.retornaRRHHDataSet();
            this.dgListadoCargos.DataMember = "RRHH";
        }
Example #2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            ngRRHH car = new ngRRHH();

            if (txtRutRRHH.Text.Trim().Length == 0 || txtNombre.Text.Trim().Length == 0 || txtApellido.Text.Trim().Length == 0 || cmbCodTipoRRHH.SelectedIndex == -1) // dtFechaNacimiento.Value.Date < DateTime.Now)
            {
                MessageBox.Show("Ningún campo puede estar vacío");
                return;
            }
            else
            {
                if (String.IsNullOrEmpty(car.buscaRRHH(this.txtRutRRHH.Text).Rut_RRHH))
                {
                    ngRRHH ncargo = new ngRRHH();
                    ngRRHH tod    = new ngRRHH();
                    ncargo.Rut_RRHH        = txtRutRRHH.Text;
                    ncargo.Nombre          = txtNombre.Text;
                    ncargo.Apellido        = txtApellido.Text;
                    ncargo.FechaNacimiento = dtFechaNacimiento.Value.Date;
                    ncargo.Cod_Tipo_RRHH   = Convert.ToString(cmbCodTipoRRHH.SelectedValue);
                    tod.ingresaRRHH(ncargo);
                    MessageBox.Show("RRHH Guardado Correctamente");
                    Limpiar();
                }
                else
                {
                    MessageBox.Show("RRHH ya existe", "Mensaje Sistema");
                    return;
                }
            }
        }
Example #3
0
        private void txtRutRRHH_Leave(object sender, EventArgs e)
        {
            ngRRHH ncar  = new ngRRHH();
            RRHH   ncar2 = new RRHH();

            ncar2 = ncar.buscaRRHH(txtRutRRHH.Text);

            bool rut1 = validarRut(txtRutRRHH.Text);
            bool rut2 = validaRut2(txtRutRRHH.Text);
            bool rut3 = validaRut3(txtRutRRHH.Text);

            try
            {
                if (rut1 == true && rut2 == true && rut3 == true)
                {
                    btnLimpiar.Enabled = true;
                    if (String.IsNullOrEmpty(ncar2.Rut_RRHH))
                    {
                        return;
                    }
                    else
                    {
                        txtRutRRHH.Text              = ncar2.Rut_RRHH;
                        txtNombre.Text               = ncar2.Nombre;
                        txtApellido.Text             = ncar2.Apellido;
                        dtFechaNacimiento.Value      = ncar2.FechaNacimiento;
                        cmbCodTipoRRHH.SelectedValue = ncar2.Cod_Tipo_RRHH;
                    }
                }
                else
                {
                    btnLimpiar.Enabled = false;
                    //bool cal = Limpiar();
                    if (txtRutRRHH.Text.Length == 0 /*|| cal == true*/)
                    {
                        //txtNombre.Focus();
                    }
                    else
                    {
                        MessageBox.Show("Debe ingresar un rut correcto");
                        txtRutRRHH.Focus();
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Example #4
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            ngRRHH ncargo = new ngRRHH();

            if (String.IsNullOrEmpty(ncargo.buscaRRHH(this.txtRutRRHH.Text).Rut_RRHH))
            {
                MessageBox.Show("No se puede eliminar RRHH", "Mensaje Sistema");
            }

            else
            {
                ncargo.eliminarRRHH(txtRutRRHH.Text);
                MessageBox.Show("RRHH eliminado", "Mensaje Sistema");
                Limpiar();
                this.txtRutRRHH.Focus();
            }
        }