Esempio n. 1
0
        private void dgPersonal_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DialogResult res;
            res = MessageBox.Show("“¿Está seguro que desea eliminar el registro seleccionado?", "Confirmación",
                MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
            if (res == DialogResult.Yes)
            {
                try
                {
                    var documento = int.Parse(dgPersonal.Rows[e.RowIndex].Cells[1].Value.ToString());
                    var gp = new GestorPersonal();
                    gp.Eliminar(documento);

                    //consulto luego de eliminar para refrescar la grilla
                    dgPersonal.DataSource = gp.Consultar();
                    dgPersonal.DataMember = "Personal";
                }
                catch (Exception ex)
                {
                }
            }
        }
Esempio n. 2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (txtApellido.Text == "")
            {
                MessageBox.Show("Ingrese Apellido");
                return;
            }
            if (txtNombres.Text == "")
            {
                MessageBox.Show("Ingrese Nombres");
                return;
            }

            var p = new Personal();
            p.Documento = global.documento;
            p.Fecha_nac = dtpFecNac.Value;
            p.Apellido = txtApellido.Text;
            p.Nombres = txtNombres.Text;
            p.Calleynum = txtCalleyNum.Text;
            p.Id_barrio = int.Parse(cmbBarrios.SelectedValue.ToString());
            //2016
            p.Id_perfil = int.Parse(cmbPerfil.SelectedValue.ToString());
            p.Caract_cel = txtCaractCel.Text;
            p.Caract_tel = txtCaractFijo.Text;

            if (pbFoto.Image != null)
            {
                p.foto = ImgToByte(pbFoto.Image);
            }

            p.Id_localidad = int.Parse(cmbLocalidades.SelectedValue.ToString());
            p.Email = txtEmail.Text;
            p.Tel_fijo = txtTelFijo.Text;
            p.Tel_cel = txtCel.Text;

            if (rbMasculino.Checked)
                p.Sexo = 'm';
            else
                p.Sexo = 'f';

            //ver de no usar entindad aca, sino q el gestor la conozca y use

            var gp = new GestorPersonal();

            guardado = gp.Modificar(p);

            if (guardado == "Guardado")
            {
                MessageBox.Show("Modificado Correctamente");
                limpiar();
                return;
            }

            if (guardado == "Error al Guardar")
            {
                MessageBox.Show("No Modificado, error de escritura");
                limpiar();
            }
        }
 private void SeleccionarPersonal_Load(object sender, EventArgs e)
 {
     var gp = new GestorPersonal();
     dgPersonal.DataSource = gp.Consultar();
     dgPersonal.DataMember = "Personal";
 }
 private void SeleccionarProfesor_Load(object sender, EventArgs e)
 {
     var gp = new GestorPersonal();
     dgProfesores.DataSource = gp.ConsultarProfes(6); //6 perfil profesor
     dgProfesores.DataMember = "UsuariosXPerfiles";
 }