private void BtnNuevo_Click_1(object sender, EventArgs e) { Frm_Registrar_Empleado.modificar = 0; Frm_Registrar_Empleado frm = new Frm_Registrar_Empleado(); AddOwnedForm(frm); frm.Text = "Nuevo Empleado"; Frm_Registrar_Empleado.BtnGE = false; frm.ShowDialog(); }
private void BtnModificar_Click(object sender, EventArgs e) { if (DgvPersonal.SelectedRows.Count > 0) { int rowindex = DgvPersonal.CurrentRow.Index; if (rowindex != -1) { try { Frm_Registrar_Empleado.modificar = 1; Frm_Registrar_Empleado frm = new Frm_Registrar_Empleado(); AddOwnedForm(frm); frm.Text = "Modificar Empleado"; Frm_Registrar_Empleado.BtnGE = true; Frm_Registrar_Empleado.cbxcargoselected = Convert.ToInt32(DgvPersonal.CurrentRow.Cells[0].Value); frm.CbxTipoDocumento.Enabled = false; frm.TxtNumeroDocumento.Enabled = false; frm.TxtNumeroDocumento.Text = DgvPersonal.CurrentRow.Cells[3].Value.ToString(); frm.TxtNombres.Text = DgvPersonal.CurrentRow.Cells[4].Value.ToString(); frm.TxtApellidos.Text = DgvPersonal.CurrentRow.Cells[5].Value.ToString(); if (DgvPersonal.CurrentRow.Cells[6].Value == DBNull.Value) { Frm_Registrar_Empleado.fechnaci = Convert.ToDateTime(DateTime.Now); } else { Frm_Registrar_Empleado.fechnaci = Convert.ToDateTime(DgvPersonal.CurrentRow.Cells[6].Value); } frm.TxtPais.Text = DgvPersonal.CurrentRow.Cells[7].Value.ToString(); frm.TxtCiudad.Text = DgvPersonal.CurrentRow.Cells[8].Value.ToString(); frm.TxtDireccion.Text = DgvPersonal.CurrentRow.Cells[9].Value.ToString(); frm.TxtEmail.Text = DgvPersonal.CurrentRow.Cells[10].Value.ToString(); frm.TxtTelefono.Text = DgvPersonal.CurrentRow.Cells[11].Value.ToString(); frm.ShowDialog(); } catch { // } } } else { MessageBox.Show("Seleccione un registro"); } }