private void _AbrirModificarLegajo(DataGridView grid) { try { if (grid.SelectedRows.Count != 1) { throw new Exception("Se debe seleccionar una fila a modificar"); } string IdAModificar = grid.SelectedRows[0].Cells["Codigo"].Value.ToString(); Legajo LegajoAModificar = new Legajo(); LegajoAModificar = L.BuscarUno(IdAModificar); AgModLegajo AgMod = new AgModLegajo(LegajoAModificar) { StartPosition = FormStartPosition.CenterScreen }; AgMod.ShowDialog(); //ActualizarGrilla(); } catch (Exception err) { MessageBox.Show(err.Message, "Error"); } }
private void TB_Buscar_Click(object sender, EventArgs e) { try { if (TB_CodLegajo.Text == "" || TB_Año.Text == "") { throw new Exception("Se deben cargar los datos de legajo y año"); } dtCronograma = Cr.BuscarUno(TB_CodLegajo.Text, TB_Año.Text); Legajo _L = new Legajo(); _L = _L.BuscarUno(TB_CodLegajo.Text); TB_DesLegajo.Text = _L.Descripcion; lblAtencion.Visible = false; if (dtCronograma.Rows.Count == 0) { dtCronograma = L.BuscarCursosPlanificacion(TB_CodLegajo.Text); // Mostramos la ventana de Atencion. lblAtencion.Visible = true; } DGV_Crono.DataSource = dtCronograma; } catch (Exception err) { MessageBox.Show(err.Message, "Error"); } }
private void TB_Codigo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { if (TB_Codigo.Text.Trim() == "") { return; } Legajo LegajoAModificar = new Legajo(); LegajoAModificar = L.BuscarUno(TB_Codigo.Text); _CargarLegajo(LegajoAModificar); TB_DescLegajo.Focus(); } else if (e.KeyData == Keys.Escape) { TB_Codigo.Text = ""; } }